Skip to content

Commit ccf6bea

Browse files
committed
pretty sure climbers are toggleable now
1 parent f76acae commit ccf6bea

File tree

3 files changed

+12
-35
lines changed

3 files changed

+12
-35
lines changed

src/main/java/frc/robot/RobotContainer.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class RobotContainer {
3535
ControllerConstants.kOperationControllerId);
3636

3737
private boolean climbing = false;
38+
private boolean extending = false;
3839

3940
// Auto Commands Chooser
4041
private final Command m_straightAuto = new StraightAutoCmd(m_swerve);
@@ -107,7 +108,7 @@ public RobotContainer() {
107108

108109
m_LEDs.setDefaultCommand(new LEDCmd(m_shooter, m_swerve, m_limelight, m_LEDs));
109110

110-
m_climbers.setDefaultCommand(new ClimbersCmd(m_climbers, m_operationsController.povUp()));
111+
m_climbers.setDefaultCommand(m_climbers.defaultCmd());
111112

112113
NamedCommands.registerCommand("fullSpeakerShoot", fullSpeakerShoot);
113114
NamedCommands.registerCommand("readyAutoShoot", m_shooter.readyAutoShoot());
@@ -169,12 +170,14 @@ private void configureBindings() {
169170

170171
new Trigger(() -> m_shooter.isNoteInShooter() && DriverStation.isTeleop()).whileTrue(m_intake.noteInShooterCommand().withInterruptBehavior(InterruptionBehavior.kCancelIncoming));
171172

172-
m_operationsController.povUp().onTrue(new InstantCommand(() -> climbing = true));
173-
m_operationsController.povDown().onTrue(new InstantCommand(() -> climbing = false));
173+
m_operationsController.povLeft().onTrue(new InstantCommand(() -> climbing = false));
174+
m_operationsController.povUp().onTrue(new InstantCommand(() -> {climbing = true; extending = true;}));
175+
m_operationsController.povDown().onTrue(new InstantCommand(() -> extending = false));
176+
new Trigger(() -> extending == true).whileTrue(new RunCommand(() -> m_climbers.extend()));
174177
new Trigger(() -> climbing == true).whileTrue(new RunCommand(() -> {
175178
m_shooter.climb();
176179
m_intake.climb();
177-
}, m_shooter, m_intake).withInterruptBehavior(InterruptionBehavior.kCancelIncoming));
180+
}, m_climbers, m_shooter, m_intake).withInterruptBehavior(InterruptionBehavior.kCancelIncoming));
178181
}
179182

180183
public Swerve getSwerve() {

src/main/java/frc/robot/commands/ClimbersCmd.java

-31
This file was deleted.

src/main/java/frc/robot/subsystems/Climbers.java

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.revrobotics.CANSparkBase.IdleMode;
88
import com.revrobotics.CANSparkLowLevel.MotorType;
99

10+
import edu.wpi.first.wpilibj2.command.Command;
1011
import edu.wpi.first.wpilibj2.command.SubsystemBase;
1112
import frc.robot.Constants.ClimberConstants;
1213

@@ -50,6 +51,10 @@ public void retract() {
5051
m_rightClimberPidController.setReference(ClimberConstants.kRetractHeightRotations, ControlType.kPosition);
5152
}
5253

54+
public Command defaultCmd() {
55+
return run(() -> retract());
56+
}
57+
5358
public void stop() {
5459
m_climberMotorL.stopMotor();
5560
m_climberMotorR.stopMotor();

0 commit comments

Comments
 (0)