Skip to content

Commit 1ffdc16

Browse files
authored
feat: climber state machine implementation (#42)
1 parent 671a941 commit 1ffdc16

File tree

7 files changed

+256
-272
lines changed

7 files changed

+256
-272
lines changed
104 KB
Loading

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
1010
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1111
import edu.wpi.first.wpilibj2.command.Command;
12-
import edu.wpi.first.wpilibj2.command.Commands;
1312
import edu.wpi.first.wpilibj2.command.ConditionalCommand;
14-
import edu.wpi.first.wpilibj2.command.InstantCommand;
1513
import frc.robot.algaeflywheel.AlgaeRoller;
1614
import frc.robot.algaepivot.AlgaeSubsystem;
1715
import frc.robot.auton.AutonMaster;
16+
import frc.robot.climber.Climber;
1817
import frc.robot.driver.DriverXbox;
1918
import frc.robot.drivetrain.CommandSwerveDrivetrain;
2019
import frc.robot.drivetrain.TunerConstants;
@@ -24,7 +23,6 @@
2423
import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType;
2524
import frc.robot.operator.OperatorXbox;
2625
import frc.robot.vision.PoseEstimatorSubsystem;
27-
import frc.robot.vision.VisionConfig;
2826

2927
import frc.robot.rushinator.*;
3028
import frc.robot.rushinator.commands.*;
@@ -38,7 +36,7 @@
3836
public class RobotContainer {
3937
public static double kMaxVelocity = TunerConstants.kSpeedAt12Volts.in(MetersPerSecond);
4038
public static double kMaxAngularVelocity = RotationsPerSecond.of(1.0).in(RadiansPerSecond);
41-
39+
4240
public static boolean modeFast = true;
4341

4442
/* Setting up bindings for necessary control of the swerve drive platform */
@@ -70,7 +68,7 @@ public RobotContainer() {
7068
* @return the command to run in autonomous
7169
*/
7270
public Command getAutonomousCommand() {
73-
// return CommandSwerveDrivetrain.getInstance().applyRequest(() ->
71+
// return CommandSwerveDrivetrain.getInstance().applyRequest(() ->
7472
// RobotContainer.drive.withVelocityX(0.25 * RobotContainer.kMaxVelocity) // Drive forward with negative Y (forward)
7573
// .withVelocityY(0.0) // Drive left with negative X (left)
7674
// .withRotationalRate(0.0) // Drive counterclockwise with negative X (left)
@@ -84,6 +82,10 @@ public void setDefaultCommands() {
8482
final var operator = OperatorXbox.getInstance();
8583
final var currAlliance = DriverStation.getAlliance().get();
8684

85+
// TODO: Re-enable climber once setpoints have been tuned
86+
// final var climber = new Climber(operator::getClimberDeploy, operator::getClimberRetract, operator::getClimberOverride, Climber.OperatingMode.kManual);
87+
// climber.setDefaultCommand(new Climber.DefaultCommand(climber));
88+
8789
CommandSwerveDrivetrain.getInstance().setDefaultCommand(
8890
CommandSwerveDrivetrain.getInstance().applyRequest(() -> {
8991
if (currAlliance == Alliance.Blue){
@@ -143,7 +145,7 @@ public void setDefaultCommands() {
143145
// }
144146
// RushinatorWrist.getInstance().setDefaultCommand(new HoldWristPosition());
145147
// RushinatorWrist.getInstance().setDefaultCommand(new ManualWristControl(() -> operator.getLeftY()));
146-
148+
147149

148150
// CommandSwerveDrivetrain.getInstance().setDefaultCommand(
149151
// CommandSwerveDrivetrain.getInstance().applyRequest(() -> {
@@ -172,23 +174,23 @@ public void setDefaultCommands() {
172174
);
173175
RushinatorWrist.getInstance().setDefaultCommand(
174176
new ConditionalCommand(
175-
new SetWristState(RushinatorWrist.State.kTravelRight),
176-
new SetWristState(RushinatorWrist.State.kTravelLeft),
177+
new SetWristState(RushinatorWrist.State.kTravelRight),
178+
new SetWristState(RushinatorWrist.State.kTravelLeft),
177179
() -> RushinatorWrist.kLastState == RushinatorWrist.State.kTravelRight ||
178-
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL4RightWrist ||
179-
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL3RightWrist ||
180-
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL2RightWrist ||
180+
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL4RightWrist ||
181+
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL3RightWrist ||
182+
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL2RightWrist ||
181183
RushinatorWrist.kLastState == RushinatorWrist.State.kScoreL1Mid ||
182184
RushinatorWrist.kLastState == RushinatorWrist.State.kGroundMid ||
183185
RushinatorWrist.kLastState == RushinatorWrist.State.kHPMid ||
184186
RushinatorWrist.kLastState == RushinatorWrist.State.kTravelL4Right ||
185187
RushinatorWrist.kLastState == RushinatorWrist.State.kClimblRight
186188
)
187189
);
188-
190+
189191
AlgaeRoller.getInstance().setDefaultCommand(new AlgaeRoller.DefaultCommand());
190-
192+
191193
// CoralSubsystem.getInstance().setDefaultCommand(new CoralSubsystem.TuningCommand(() -> (driver.getRightX() + 1) / 2.0f));
192194
}
193195
}
194-
196+

0 commit comments

Comments
 (0)