Merge branch 'main' of https://git.demerso.net/pls5618/2024/robot
This commit is contained in:
@@ -10,11 +10,16 @@ import com.pathplanner.lib.commands.PathPlannerAuto;
|
||||
|
||||
import edu.wpi.first.cameraserver.CameraServer;
|
||||
import edu.wpi.first.math.MathUtil;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
|
||||
import edu.wpi.first.wpilibj2.command.RunCommand;
|
||||
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
|
||||
|
||||
// Manette
|
||||
import edu.wpi.first.wpilibj2.command.WaitCommand;
|
||||
// Manettes
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
@@ -29,7 +34,9 @@ import frc.robot.command.GuiderHaut;
|
||||
import frc.robot.command.Lancer;
|
||||
import frc.robot.command.LancerNote;
|
||||
import frc.robot.command.Lancerampli;
|
||||
|
||||
import frc.robot.command.Limelight_tracker;
|
||||
import frc.robot.command.PistonFerme;
|
||||
import frc.robot.command.Pistongrimpeur;
|
||||
// Subsystems
|
||||
import frc.robot.subsystem.Accumulateur;
|
||||
import frc.robot.subsystem.Balayeuse;
|
||||
@@ -43,6 +50,7 @@ import frc.robot.subsystem.Pixy;
|
||||
|
||||
|
||||
public class RobotContainer {
|
||||
ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard");
|
||||
private final SendableChooser<Command> autoChooser;
|
||||
Drive drive = new Drive();
|
||||
Accumulateur accumulateur = new Accumulateur();
|
||||
@@ -50,32 +58,36 @@ public class RobotContainer {
|
||||
Grimpeur grimpeur = new Grimpeur();
|
||||
Guideur guideur = new Guideur();
|
||||
Lanceur lanceur = new Lanceur();
|
||||
Balayer balayer = new Balayer(balayeuse, accumulateur);
|
||||
GuiderHaut guiderHaut = new GuiderHaut(guideur);
|
||||
GuiderBas guiderBas = new GuiderBas(guideur);
|
||||
Limelight limelight = new Limelight();
|
||||
Lancer lancer = new Lancer(lanceur,limelight);
|
||||
LancerNote lancernote = new LancerNote(lanceur, accumulateur);
|
||||
Lancerampli lancerampli = new Lancerampli(lanceur,limelight);
|
||||
LED LED = new LED();
|
||||
Pixy pixy = new Pixy();
|
||||
CommandJoystick joystick = new CommandJoystick(0);
|
||||
CommandXboxController manette = new CommandXboxController(1);
|
||||
//command
|
||||
PistonFerme pistonFerme = new PistonFerme(grimpeur);
|
||||
Balayer balayer = new Balayer(balayeuse, accumulateur);
|
||||
GuiderHaut guiderHaut = new GuiderHaut(guideur);
|
||||
Lancer lancer = new Lancer(lanceur,limelight);
|
||||
LancerNote lancernote = new LancerNote(lanceur, accumulateur);
|
||||
Lancerampli lancerampli = new Lancerampli(lanceur,limelight);
|
||||
GrimpeurDroit grimpeurDroit = new GrimpeurDroit(grimpeur, manette::getLeftX);
|
||||
GrimpeurGauche grimpeurGauche = new GrimpeurGauche(grimpeur, manette::getLeftY);
|
||||
LED LED = new LED();
|
||||
AllumeLED allumeLED = new AllumeLED(LED);
|
||||
Pixy pixy = new Pixy();
|
||||
Pistongrimpeur pistongrimpeur = new Pistongrimpeur(grimpeur, LED);
|
||||
public RobotContainer() {
|
||||
dashboard.addCamera("limelight", "limelight","limelight.local:5800");
|
||||
NamedCommands.registerCommand("balayer",new Balayer(balayeuse, accumulateur));
|
||||
NamedCommands.registerCommand("lancer", new LancerNote(lanceur, accumulateur));
|
||||
NamedCommands.registerCommand("piston", new PistonFerme(grimpeur));
|
||||
autoChooser = AutoBuilder.buildAutoChooser();
|
||||
|
||||
CameraServer.startAutomaticCapture();
|
||||
manette.a().whileTrue(guiderBas);
|
||||
manette.b().whileTrue(guiderHaut);
|
||||
joystick.button(3).toggleOnTrue(balayer);
|
||||
joystick.button(1).whileTrue(lancernote);
|
||||
|
||||
manette.a().whileTrue(new GuiderBas(guideur));
|
||||
manette.b().whileTrue(new GuiderHaut(guideur));
|
||||
joystick.button(3).toggleOnTrue(new Balayer(balayeuse, accumulateur));
|
||||
joystick.button(1).whileTrue(new LancerNote(lanceur, accumulateur));
|
||||
joystick.button(4).whileTrue(new ParallelCommandGroup(new Lancer(lanceur,limelight),new Limelight_tracker(limelight,drive)));
|
||||
joystick.button(2).whileTrue(new ParallelCommandGroup(new Lancerampli(lanceur,limelight),new Limelight_tracker(limelight,drive),new GuiderHaut(guideur)));
|
||||
configureBindings();
|
||||
drive.setDefaultCommand(new RunCommand(()->{
|
||||
drive.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2));
|
||||
@@ -84,6 +96,9 @@ public class RobotContainer {
|
||||
grimpeur.droit(manette.getLeftX());}
|
||||
,grimpeur));
|
||||
LED.setDefaultCommand(allumeLED);
|
||||
dashboard.add("autochooser",autoChooser)
|
||||
.withSize(2,1)
|
||||
.withPosition(1,1);
|
||||
}
|
||||
|
||||
private void configureBindings() {
|
||||
@@ -92,5 +107,6 @@ public class RobotContainer {
|
||||
|
||||
public Command getAutonomousCommand(){
|
||||
return autoChooser.getSelected();
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user