robot-2024/src/main/java/frc/robot/RobotContainer.java

64 lines
2.0 KiB
Java
Raw Normal View History

2024-01-17 19:19:54 -05:00
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot;
2024-01-23 18:41:48 -05:00
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.MathUtil;
2024-01-17 19:19:54 -05:00
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
2024-01-23 18:41:48 -05:00
import edu.wpi.first.wpilibj2.command.RunCommand;
// Manette
import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
2024-01-30 19:52:21 -05:00
import frc.robot.command.Balayer;
2024-01-30 19:52:09 -05:00
import frc.robot.command.GuiderBas;
import frc.robot.command.GuiderHaut;
2024-01-23 18:41:48 -05:00
// Subsystem
import frc.robot.subsystem.Accumulateur;
import frc.robot.subsystem.Balayeuse;
import frc.robot.subsystem.Drive;
import frc.robot.subsystem.Grimpeur;
import frc.robot.subsystem.Guideur;
import frc.robot.subsystem.Lanceur;
2024-01-17 19:19:54 -05:00
public class RobotContainer {
2024-01-23 18:41:48 -05:00
Drive drive = new Drive();
Accumulateur accumulateur = new Accumulateur();
Balayeuse balayeuse = new Balayeuse();
Grimpeur grimpeur = new Grimpeur();
Guideur guideur = new Guideur();
Lanceur lanceur = new Lanceur();
2024-01-30 19:52:21 -05:00
Balayer balayer = new Balayer(balayeuse, accumulateur);
2024-01-30 19:52:09 -05:00
GuiderHaut guiderHaut = new GuiderHaut(guideur);
GuiderBas guiderBas = new GuiderBas(guideur);
2024-01-30 19:53:18 -05:00
2024-01-23 18:41:48 -05:00
CommandJoystick joystick = new CommandJoystick(0);
CommandXboxController manette = new CommandXboxController(1);
2024-01-17 19:19:54 -05:00
public RobotContainer() {
2024-01-23 18:41:48 -05:00
CameraServer.startAutomaticCapture();
2024-01-30 19:52:09 -05:00
manette.a().onTrue(guiderBas);
manette.b().onTrue(guiderHaut);
2024-01-17 19:19:54 -05:00
configureBindings();
2024-01-23 18:41:48 -05:00
drive.setDefaultCommand(new RunCommand(()->{
drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2));
},drive));
2024-01-17 19:19:54 -05:00
}
2024-01-25 20:05:20 -05:00
private void configureBindings() {
2024-01-30 19:52:21 -05:00
joystick.button(3).toggleOnTrue(balayer);
2024-01-25 20:05:20 -05:00
}
2024-01-17 19:19:54 -05:00
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
}
}