+++ /dev/null
-package frc.robot.commands.gpm;
-
-import edu.wpi.first.wpilibj.GenericHID;
-import edu.wpi.first.wpilibj.PS5Controller;
-import edu.wpi.first.wpilibj2.command.InstantCommand;
-import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
-import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
-import frc.robot.commands.drive_comm.DriveToPose;
-import frc.robot.constants.FieldConstants;
-import frc.robot.subsystems.Climb.LinearClimb;
-import frc.robot.subsystems.drivetrain.Drivetrain;
-
-public class ClimbCommand extends SequentialCommandGroup{
-
- public ClimbCommand(LinearClimb climb, Drivetrain drive, PS5Controller controller){
- addCommands(
- new ParallelCommandGroup(
- new InstantCommand(() -> climb.goUp()),
- new DriveToPose(drive, () -> FieldConstants.getClimbLocation())
- ),
- // TODO: Make it stop rumbling after like a second
- new InstantCommand(() -> controller.setRumble(GenericHID.RumbleType.kBothRumble, 1.0))
- );
- }
-
-
-}
--- /dev/null
+package frc.robot.commands.gpm;
+
+import edu.wpi.first.wpilibj2.command.InstantCommand;
+import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
+import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
+import frc.robot.commands.drive_comm.DriveToPose;
+import frc.robot.constants.FieldConstants;
+import frc.robot.subsystems.Climb.LinearClimb;
+import frc.robot.subsystems.drivetrain.Drivetrain;
+
+public class ClimbDriveCommand extends SequentialCommandGroup{
+
+ public ClimbDriveCommand(LinearClimb climb, Drivetrain drive){
+ addCommands(
+ new ParallelCommandGroup(
+ new InstantCommand(() -> climb.climbPosition()),
+ new DriveToPose(drive, () -> FieldConstants.getClimbLocation())
+ )
+ );
+ }
+
+
+}
import edu.wpi.first.wpilibj2.command.FunctionalCommand;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
+import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
+import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.Robot;
import frc.robot.commands.gpm.AutoShootCommand;
+import frc.robot.commands.gpm.ClimbDriveCommand;
import frc.robot.commands.gpm.ReverseMotors;
import frc.robot.constants.Constants;
import frc.robot.subsystems.Climb.LinearClimb;
climb.stopCalibrating();
}));
- // Climb climb
+ // Climb retract
driver.get(PS5Button.CROSS).onTrue(new InstantCommand(()-> {
- climb.goDown();
+ climb.retract();
+ }));
+
+ // Drive to climb position and rumble
+ driver.get(PS5Button.TRIANGLE).onTrue(new SequentialCommandGroup(
+ new ClimbDriveCommand(climb, getDrivetrain()),
+ new InstantCommand(()-> this.startRumble()),
+ new WaitCommand(1),
+ new InstantCommand(()-> this.endRumble())
+ )
+ );
+ }
+
+ // Hood
+ if (hood != null) {
+ // Calibration
+ driver.get(PS5Button.PS).onTrue(new InstantCommand(()->{
+ hood.calibrate();
+ })).onFalse(new InstantCommand(()->{
+ hood.stopCalibrating();
}));
}
}
setCurrentLimits(ClimbConstants.CALIBRATION_CURRENT);
SmartDashboard.putData("Go Up", new InstantCommand(() -> goUp()));
- SmartDashboard.putData("Go Down", new InstantCommand(() -> goDown()));
- SmartDashboard.putData("Climb", new InstantCommand(() -> climb()));
+ SmartDashboard.putData("Go Down", new InstantCommand(() -> retract()));
+ SmartDashboard.putData("Climb", new InstantCommand(() -> climbPosition()));
motor.setPosition(0);
/**
* goes to the down position
*/
- public void goDown() {
+ public void retract() {
MAX_POWER = 0.2;
setSetpoint(metersToRotations(ClimbConstants.BOTTOM_POSITION));
}
/**
* goes to the climb position
*/
- public void climb() {
+ public void climbPosition() {
MAX_POWER = 0.8;
setSetpoint(metersToRotations(ClimbConstants.CLIMB_POSITION));
}