diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java index 865059f..8019237 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/OI.java @@ -63,8 +63,8 @@ public class OI JoystickButton climbUp = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.RIGHT_TRIGGER_AXIS); double speed = m_driverXbox.getRightTriggerAxis(); - //climbUp.whenPressed(new InitiateClimber(true, speed)); - //climbUp.whenReleased(new InitiateClimber(false, speed)); + climbUp.whenPressed(new InitiateClimber(speed)); + climbUp.whenReleased(new InitiateClimber(0)); JoystickButton ratchetFlip = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.Y_BUTTON); ratchetFlip.whenPressed(new ratchetFlip(0.5)); diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/InitiateClimber.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/InitiateClimber.java index 42682ea..f7e4885 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/InitiateClimber.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/InitiateClimber.java @@ -7,30 +7,24 @@ import edu.wpi.first.wpilibj.command.Command; public class InitiateClimber extends Command { - static boolean CLIMB; - double speed; + static double SPEED; - public InitiateClimber(boolean climb, double speed) { + public InitiateClimber(double speed) { requires(Robot.climber); - this.CLIMB = climb; - this.speed = speed; + this.SPEED = speed; } @Override protected void initialize() { - + Robot.climber.setClimbSpeed(SPEED); } @Override protected void execute() { - if(CLIMB){ //If climb button is pressed - Robot.climber.setClimbSpeed(CLIMB, speed); - } - else{ - Robot.climber.setClimbSpeed(false, 0); - } + } - // Make this return true when this Command no longer needs to run execute() + + // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return true; } diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/ratchetFlip.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/ratchetFlip.java index 37e5f64..e7c8c76 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/ratchetFlip.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/commands/ratchetFlip.java @@ -15,7 +15,9 @@ public class ratchetFlip extends Command { // Called just before this Command runs the first time @Override protected void initialize() { - Robot.climber.flipRatchet(speed); + if (InitiateClimber.SPEED == 0){ + Robot.climber.flipRatchet(speed); + } } // Called repeatedly when this Command is scheduled to run diff --git a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Climber.java b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Climber.java index 6a54225..1546ea5 100644 --- a/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Climber.java +++ b/2019robot/src/main/java/org/usfirst/frc4388/robot/subsystems/Climber.java @@ -83,11 +83,10 @@ public class Climber extends Subsystem{ @Override public void periodic() { // Put code here to be run every loop - } - public void setClimbSpeed(boolean Climb, double speed) { - if (Climb && safetySwitch) { + public void setClimbSpeed(double speed) { + if (safetySwitch) { if(isPressed.isFwdLimitSwitchClosed()){ //If leg at max height climberBack.set(0); climberFront.set(FRONT_FREQ * speed); @@ -97,7 +96,7 @@ public class Climber extends Subsystem{ climberFront.set(FRONT_FREQ * speed); } } - if (!Climb || !safetySwitch) { + if (!safetySwitch) { climberBack.set(0); climberFront.set(0); }