Fix rachetFlip

This commit is contained in:
Keenan D. Buckley
2019-02-16 16:26:06 -07:00
parent dde0cdf4fa
commit 500faccd3d
4 changed files with 15 additions and 21 deletions
@@ -61,14 +61,14 @@ public class OI
liftBallIntake.whenPressed(new LiftBallDropHatch());
JoystickButton climbUp = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.RIGHT_TRIGGER_AXIS);
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));
JoystickButton ratchetFlip = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.RIGHT_TRIGGER_AXIS);
ratchetFlip.whenPressed(new ratchetFlip(true, speed));
ratchetFlip.whenReleased(new ratchetFlip(false, speed));
JoystickButton ratchetFlip = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.Y_BUTTON);
ratchetFlip.whenPressed(new ratchetFlip(0.5));
ratchetFlip.whenReleased(new ratchetFlip(0));
JoystickButton shiftUp = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.RIGHT_BUMPER_BUTTON);
shiftUp.whenPressed(new DriveSpeedShift(true));
@@ -7,12 +7,12 @@ import edu.wpi.first.wpilibj.command.Command;
public class InitiateClimber extends Command
{
boolean climb;
static boolean CLIMB;
double speed;
public InitiateClimber(boolean climb, double speed) {
requires(Robot.climber);
this.climb = climb;
this.CLIMB = climb;
this.speed = speed;
}
@@ -23,8 +23,8 @@ public class InitiateClimber extends Command
@Override
protected void execute() {
if(climb){ //If climb button is pressed
Robot.climber.setClimbSpeed(climb, speed);
if(CLIMB){ //If climb button is pressed
Robot.climber.setClimbSpeed(CLIMB, speed);
}
else{
Robot.climber.setClimbSpeed(false, 0);
@@ -6,34 +6,28 @@ import org.usfirst.frc4388.robot.Constants;
import edu.wpi.first.wpilibj.command.Command;
public class ratchetFlip extends Command {
boolean flip;
double speed;
public ratchetFlip(boolean flip, double speed) {
private double speed;
public ratchetFlip(double speed) {
requires(Robot.climber);
this.flip = flip;
this.speed = speed;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
Robot.climber.flipRatchet(speed);
}
// Called repeatedly when this Command is scheduled to run
@Override
protected void execute() {
if(flip){
Robot.climber.flipRatchet(true, speed);
}
else{
Robot.climber.flipRatchet(false, speed);
}
}
// Make this return true when this Command no longer needs to run execute()
@Override
protected boolean isFinished() {
return false;
return true;
}
// Called once after isFinished returns true
@@ -107,7 +107,7 @@ public class Climber extends Subsystem{
this.safetySwitch = safetySwitch;
}
public void flipRatchet(boolean flip, double speed){
climberFront.set(FRONT_FREQ * speed);
public void flipRatchet(double speed){
climberFront.set(speed);
}
}