pratique-2025/src/main/java/frc/robot/RobotContainer.java

55 lines
2.2 KiB
Java
Raw Normal View History

2024-10-21 19:30:01 -04: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-11-04 18:38:50 -05:00
import edu.wpi.first.math.MathUtil;
2024-10-30 19:14:06 -04:00
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
2024-10-21 19:30:01 -04:00
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
2024-11-04 18:38:50 -05:00
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.Commands.Desaccumuler;
import frc.robot.Commands.FollowAprilTag;
import frc.robot.Commands.Lancer;
2024-11-04 18:23:33 -05:00
import frc.robot.Subsystems.Accumulateur;
import frc.robot.Subsystems.Drive;
import frc.robot.Subsystems.Lanceur;
import frc.robot.Subsystems.Limelight3G;
2024-10-21 19:30:01 -04:00
public class RobotContainer {
2024-11-04 18:23:33 -05:00
Lanceur lanceur= new Lanceur();
Accumulateur accumulateur = new Accumulateur();
Limelight3G limelight3G = new Limelight3G();
Drive drive = new Drive();
2024-10-30 19:14:06 -04:00
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
2024-11-04 18:38:50 -05:00
CommandXboxController manette = new CommandXboxController(0);
2024-10-21 19:30:01 -04:00
public RobotContainer() {
2024-10-30 19:14:06 -04:00
dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800")
.withSize(3,4)
.withPosition(0,0);
dashboard.addCamera("limelight3", "limelight3","limelight.local:5800")
.withSize(3,4)
.withPosition(3,0);
2024-10-21 19:30:01 -04:00
configureBindings();
2024-11-04 18:38:50 -05:00
drive.setDefaultCommand(new RunCommand(()->{
drive.drive(-MathUtil.applyDeadband(manette.getRightX(),0.2), MathUtil.applyDeadband(-manette.getRightY(),0.2), MathUtil.applyDeadband(-manette.getRightX(), 0.2));
},drive));
}
private void configureBindings() {
Lancer lancer= new Lancer(lanceur);
Desaccumuler desaccumuler = new Desaccumuler(accumulateur);
FollowAprilTag aprilTag = new FollowAprilTag(limelight3G, lanceur);
2024-11-04 18:52:16 -05:00
manette.x().whileTrue(new Lancer(lanceur));
manette.leftBumper().toggleOnTrue(new FollowAprilTag(limelight3G, lanceur));
manette.a().whileTrue(new Desaccumuler(accumulateur));
2024-10-21 19:30:01 -04:00
}
public Command getAutonomousCommand() {
return Commands.print("No autonomous command configured");
}
}