Compare commits
2 Commits
a0dc53800f
...
27ba15f95f
Author | SHA1 | Date | |
---|---|---|---|
|
27ba15f95f | ||
|
7222a1ec1e |
@ -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.
|
||||
|
@ -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,24 +15,28 @@ 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);
|
||||
@ -44,9 +47,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() {
|
||||
@ -54,9 +57,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();
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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(1);
|
||||
final DigitalInput limitswitch2 = new DigitalInput(3);
|
||||
private GenericEntry vitesse =
|
||||
dashboard.add("vitesselanceur", 0.2)
|
||||
.withSize(0,0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user