diff --git a/src/main/java/frc/robot/Commands/LEDactive.java b/src/main/java/frc/robot/Commands/LEDactive.java index e1768bd..782110f 100644 --- a/src/main/java/frc/robot/Commands/LEDactive.java +++ b/src/main/java/frc/robot/Commands/LEDactive.java @@ -21,7 +21,9 @@ public class LEDactive extends Command { // Called when the command is initially scheduled. @Override - public void initialize() {} + public void initialize() { + led.led(25, 25, 100); + } // Called every time the scheduler runs while the command is scheduled. @Override @@ -29,7 +31,7 @@ public class LEDactive extends Command { if(accumulateur.photocell()) led.led(0, 255, 0); else{ - led.led(25, 25, 100); + led.led(255, 0, 0); } } @@ -37,7 +39,7 @@ public class LEDactive extends Command { // Called once the command ends or is interrupted. @Override public void end(boolean interrupted) { - led.led(25, 25, 100); + led.led(0, 0, 0); } // Returns true when the command should end. diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 50c1543..493faa4 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -4,8 +4,7 @@ package frc.robot; -import com.pathplanner.lib.auto.AutoBuilder; -import com.pathplanner.lib.auto.NamedCommands; + import edu.wpi.first.math.MathUtil; import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard; @@ -16,23 +15,27 @@ 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.LEDactive; import frc.robot.Commands.Lancer; import frc.robot.Subsystems.Accumulateur; +import frc.robot.Subsystems.LED; //import frc.robot.Subsystems.Drive; import frc.robot.Subsystems.Lanceur; import frc.robot.Subsystems.Limelight3G; - +//import com.pathplanner.lib.auto.AutoBuilder; +//import com.pathplanner.lib.auto.NamedCommands; public class RobotContainer { - private final SendableChooser autoChooser; + // private final SendableChooser autoChooser; Lanceur lanceur= new Lanceur(); Accumulateur accumulateur = new Accumulateur(); Limelight3G limelight3G = new Limelight3G(); + LED led = new LED(); //Drive drive = new Drive(); ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); CommandXboxController manette = new CommandXboxController(0); public RobotContainer() { - NamedCommands.registerCommand("lancer", new Lancer(lanceur, accumulateur)); - autoChooser = AutoBuilder.buildAutoChooser(); + //NamedCommands.registerCommand("lancer", new Lancer(lanceur, accumulateur)); + //autoChooser = AutoBuilder.buildAutoChooser(); dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800") .withSize(3,4) .withPosition(5,0); @@ -43,9 +46,9 @@ public class RobotContainer { //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)); - dashboard.add("autochooser",autoChooser) - .withSize(1,1) - .withPosition(8,0); + // dashboard.add("autochooser",autoChooser) + //.withSize(1,1) + // .withPosition(8,0); } private void configureBindings() { @@ -53,9 +56,11 @@ public class RobotContainer { manette.x().whileTrue(new Lancer(lanceur,accumulateur)); manette.leftBumper().toggleOnTrue(new FollowAprilTag(limelight3G, lanceur)); manette.a().whileTrue(new Desaccumuler(accumulateur)); + manette.y().whileTrue(new LEDactive(accumulateur, led)); } public Command getAutonomousCommand() { - return autoChooser.getSelected(); + return null; + // return autoChooser.getSelected(); } } \ No newline at end of file diff --git a/src/main/java/frc/robot/Subsystems/LED.java b/src/main/java/frc/robot/Subsystems/LED.java index ea77b49..f711eee 100644 --- a/src/main/java/frc/robot/Subsystems/LED.java +++ b/src/main/java/frc/robot/Subsystems/LED.java @@ -11,7 +11,7 @@ import edu.wpi.first.wpilibj2.command.SubsystemBase; public class LED extends SubsystemBase { /** Creates a new LED. */ public LED() {} - CANdle led = new CANdle(0); + CANdle led = new CANdle(1); public void led(int R, int G, int B){ led.setLEDs(R, G, B); } diff --git a/src/main/java/frc/robot/Subsystems/Lanceur.java b/src/main/java/frc/robot/Subsystems/Lanceur.java index c80ae5d..2e7b227 100644 --- a/src/main/java/frc/robot/Subsystems/Lanceur.java +++ b/src/main/java/frc/robot/Subsystems/Lanceur.java @@ -32,10 +32,10 @@ public class Lanceur extends SubsystemBase { ShuffleboardTab dashboard = Shuffleboard.getTab("dashboard"); final WPI_TalonSRX lanceur1 = new WPI_TalonSRX(0); - final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(1); + final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(2); final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushless); final DigitalInput limitswitch1 = new DigitalInput(0); - final DigitalInput limitswitch2 = new DigitalInput(1); + final DigitalInput limitswitch2 = new DigitalInput(3); private GenericEntry vitesse = dashboard.add("vitesselanceur", 0.2) .withSize(0,0)