Merge pull request 'New PR for One Handed Mode' (#1) from onehandedmode into main
Reviewed-on: #1
This commit is contained in:
commit
d5a5504cd1
@ -11,6 +11,7 @@ import edu.wpi.first.wpilibj.util.Color;
|
||||
import edu.wpi.first.wpilibj.util.Color8Bit;
|
||||
import edu.wpi.first.wpilibj2.command.Command;
|
||||
import edu.wpi.first.wpilibj2.command.Commands;
|
||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||
import frc.robot.LEDAnimationKit.AnimationManager;
|
||||
import frc.robot.LEDAnimationKit.LEDStrip;
|
||||
@ -38,10 +39,12 @@ public class RobotContainer {
|
||||
|
||||
private AnimationManager manager;
|
||||
|
||||
//private FluidRainbow rainbow;
|
||||
private FluidRainbow rainbow;
|
||||
|
||||
private Breathing b1;
|
||||
private Breathing b2;
|
||||
//private Breathing b1;
|
||||
//private Breathing b2;
|
||||
|
||||
private boolean oneHandedMode;
|
||||
|
||||
public RobotContainer() {
|
||||
drivetrain = new Drivetrain(true);
|
||||
@ -56,13 +59,13 @@ public class RobotContainer {
|
||||
);
|
||||
strip.start();
|
||||
|
||||
//rainbow = new FluidRainbow(strip, LEDConstants.kRainbowUpdateRate);
|
||||
//rainbow.start();
|
||||
l1 = new LogicalLEDStrip(strip, 0, 31);
|
||||
l2 = new LogicalLEDStrip(strip, 31, 62);
|
||||
rainbow = new FluidRainbow(strip, LEDConstants.kRainbowUpdateRate);
|
||||
rainbow.start();
|
||||
//l1 = new LogicalLEDStrip(strip, 0, 31);
|
||||
//l2 = new LogicalLEDStrip(strip, 31, 62);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
b1 = new Breathing(
|
||||
l1,
|
||||
LEDConstants.kBreathingUpdateRate,
|
||||
@ -79,14 +82,16 @@ public class RobotContainer {
|
||||
LEDConstants.kBreathingMinPercentage,
|
||||
LEDConstants.kBreathingMaxPercentage
|
||||
);
|
||||
b2.start();
|
||||
b2.start(); */
|
||||
|
||||
manager = new AnimationManager(new PhysicalLEDStrip[] {strip});
|
||||
//manager.registerAnimationForUpdate(rainbow);
|
||||
manager.registerAnimationForUpdate(b1);
|
||||
manager.registerAnimationForUpdate(b2);
|
||||
manager.registerAnimationForUpdate(rainbow);
|
||||
//manager.registerAnimationForUpdate(b1);
|
||||
//manager.registerAnimationForUpdate(b2);
|
||||
manager.start(LEDConstants.kAnimationManagerUpdateRate);
|
||||
|
||||
oneHandedMode = false;
|
||||
|
||||
configureBindings();
|
||||
configureShuffleboard();
|
||||
|
||||
@ -101,16 +106,19 @@ public class RobotContainer {
|
||||
)
|
||||
);
|
||||
|
||||
driver.back().onTrue(new InstantCommand(() -> oneHandedMode = !oneHandedMode));
|
||||
driver.start().onTrue(drivetrain.toggleSlowMode());
|
||||
|
||||
shooter.setDefaultCommand(
|
||||
shooter.setSpeed(
|
||||
driver::getRightTriggerAxis
|
||||
() -> oneHandedMode ? driver.getLeftTriggerAxis() : driver.getRightTriggerAxis()
|
||||
)
|
||||
);
|
||||
|
||||
driver.a().onTrue(pusher.spin());
|
||||
driver.a().onFalse(pusher.stop());
|
||||
driver.a().and(() -> !oneHandedMode).onTrue(pusher.spin());
|
||||
driver.a().and(() -> !oneHandedMode).onFalse(pusher.stop());
|
||||
driver.leftBumper().and(() -> oneHandedMode).onTrue(pusher.spin());
|
||||
driver.leftBumper().and(() -> oneHandedMode).onFalse(pusher.stop());
|
||||
}
|
||||
|
||||
private void configureShuffleboard() {
|
||||
@ -121,6 +129,11 @@ public class RobotContainer {
|
||||
.withSize(2, 1)
|
||||
.withWidget(BuiltInWidgets.kBooleanBox);
|
||||
|
||||
tab.addBoolean("One Handed Mode?", () -> oneHandedMode)
|
||||
.withPosition(2, 0)
|
||||
.withSize(2, 1)
|
||||
.withWidget(BuiltInWidgets.kBooleanBox);
|
||||
|
||||
Shuffleboard.selectTab("DRIVE");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user