Compare commits

..

No commits in common. "27ba15f95fb67c07ede38d9dbeb86a5038fa4825" and "a0dc53800fde891d45bd55416cdb6b022b8fcb24" have entirely different histories.

4 changed files with 16 additions and 23 deletions

View File

@ -21,9 +21,7 @@ public class LEDactive extends Command {
// Called when the command is initially scheduled.
@Override
public void initialize() {
led.led(25, 25, 100);
}
public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
@ -31,7 +29,7 @@ public class LEDactive extends Command {
if(accumulateur.photocell())
led.led(0, 255, 0);
else{
led.led(255, 0, 0);
led.led(25, 25, 100);
}
}
@ -39,7 +37,7 @@ public class LEDactive extends Command {
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
led.led(0, 0, 0);
led.led(25, 25, 100);
}
// Returns true when the command should end.

View File

@ -4,7 +4,8 @@
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;
@ -15,28 +16,24 @@ 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<Command> autoChooser;
private final SendableChooser<Command> 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));
//NamedCommands.registerCommand("Desaccumuler", new Desaccumuler(accumulateur));
//autoChooser = AutoBuilder.buildAutoChooser();
NamedCommands.registerCommand("lancer", new Lancer(lanceur, accumulateur));
NamedCommands.registerCommand("Desaccumuler", new Desaccumuler(accumulateur));
autoChooser = AutoBuilder.buildAutoChooser();
dashboard.addCamera("limelight3G", "limelight3G","limelight.local:5800")
.withSize(3,4)
.withPosition(5,0);
@ -47,9 +44,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() {
@ -57,11 +54,9 @@ 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 null;
// return autoChooser.getSelected();
return autoChooser.getSelected();
}
}

View File

@ -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(1);
CANdle led = new CANdle(0);
public void led(int R, int G, int B){
led.setLEDs(R, G, B);
}

View File

@ -35,7 +35,7 @@ public class Lanceur extends SubsystemBase {
final WPI_TalonSRX lanceur2 = new WPI_TalonSRX(15);
final CANSparkMax tourelle = new CANSparkMax(2, MotorType.kBrushless);
final DigitalInput limitswitch1 = new DigitalInput(0);
final DigitalInput limitswitch2 = new DigitalInput(3);
final DigitalInput limitswitch2 = new DigitalInput(1);
private GenericEntry vitesse =
dashboard.add("vitesselanceur", 0.2)
.withSize(0,0)