This commit is contained in:
samuel desharnais 2024-02-13 18:25:33 -05:00
commit fbeacc51e3

View File

@ -6,20 +6,15 @@ package frc.robot;
import com.pathplanner.lib.auto.AutoBuilder; import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands; import com.pathplanner.lib.auto.NamedCommands;
import com.pathplanner.lib.commands.PathPlannerAuto;
import edu.wpi.first.cameraserver.CameraServer; import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.MathUtil;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab; import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser; 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.Command;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
// Manette
import edu.wpi.first.wpilibj2.command.WaitCommand;
// Manettes // Manettes
import edu.wpi.first.wpilibj2.command.button.CommandJoystick; import edu.wpi.first.wpilibj2.command.button.CommandJoystick;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController; import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
@ -37,6 +32,7 @@ import frc.robot.command.Lancerampli;
import frc.robot.command.Limelight_tracker; import frc.robot.command.Limelight_tracker;
import frc.robot.command.PistonFerme; import frc.robot.command.PistonFerme;
import frc.robot.command.Pistongrimpeur; import frc.robot.command.Pistongrimpeur;
// Subsystems // Subsystems
import frc.robot.subsystem.Accumulateur; import frc.robot.subsystem.Accumulateur;
import frc.robot.subsystem.Balayeuse; import frc.robot.subsystem.Balayeuse;
@ -46,7 +42,6 @@ import frc.robot.subsystem.Guideur;
import frc.robot.subsystem.LED; import frc.robot.subsystem.LED;
import frc.robot.subsystem.Lanceur; import frc.robot.subsystem.Lanceur;
import frc.robot.subsystem.Limelight; import frc.robot.subsystem.Limelight;
import frc.robot.subsystem.Pixy;
public class RobotContainer { public class RobotContainer {
@ -60,9 +55,9 @@ public class RobotContainer {
Lanceur lanceur = new Lanceur(); Lanceur lanceur = new Lanceur();
Limelight limelight = new Limelight(); Limelight limelight = new Limelight();
LED LED = new LED(); LED LED = new LED();
Pixy pixy = new Pixy();
CommandJoystick joystick = new CommandJoystick(0); CommandJoystick joystick = new CommandJoystick(0);
CommandXboxController manette = new CommandXboxController(1); CommandXboxController manette = new CommandXboxController(1);
//command //command
PistonFerme pistonFerme = new PistonFerme(grimpeur); PistonFerme pistonFerme = new PistonFerme(grimpeur);
Balayer balayer = new Balayer(balayeuse, accumulateur); Balayer balayer = new Balayer(balayeuse, accumulateur);
@ -88,10 +83,14 @@ public class RobotContainer {
joystick.button(1).whileTrue(new LancerNote(lanceur, 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(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))); joystick.button(2).whileTrue(new ParallelCommandGroup(new Lancerampli(lanceur,limelight),new Limelight_tracker(limelight,drive),new GuiderHaut(guideur)));
// deplacement
configureBindings(); configureBindings();
drive.setDefaultCommand(new RunCommand(()->{ 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.drive(-MathUtil.applyDeadband(joystick.getY(),0.2), MathUtil.applyDeadband(-joystick.getX(),0.2), MathUtil.applyDeadband(-joystick.getZ(), 0.2));
},drive)); },drive));
// grimpeur manuel
grimpeur.setDefaultCommand(new RunCommand(()->{ grimpeur.setDefaultCommand(new RunCommand(()->{
grimpeur.droit(manette.getLeftX()); grimpeur.droit(manette.getLeftX());
grimpeur.gauche(manette.getRightX());} grimpeur.gauche(manette.getRightX());}
@ -103,12 +102,9 @@ public class RobotContainer {
.withPosition(1,1); .withPosition(1,1);
} }
private void configureBindings() { private void configureBindings() {}
}
public Command getAutonomousCommand(){ public Command getAutonomousCommand(){
return autoChooser.getSelected(); return autoChooser.getSelected();
} }
} }