Added ratchet systems

This commit is contained in:
ryan123rudder
2019-02-15 16:47:35 -07:00
parent f220a68867
commit fd8ab18ebb
3 changed files with 55 additions and 2 deletions
@@ -54,6 +54,10 @@ public class OI
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 shiftUp = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.RIGHT_BUMPER_BUTTON);
shiftUp.whenPressed(new DriveSpeedShift(true));
@@ -0,0 +1,49 @@
package org.usfirst.frc4388.robot.commands;
import org.usfirst.frc4388.robot.Robot;
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) {
requires(Robot.climber);
this.flip = flip;
this.speed = speed;
}
// Called just before this Command runs the first time
@Override
protected void initialize() {
}
// 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;
}
// Called once after isFinished returns true
@Override
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
@Override
protected void interrupted() {
}
}
@@ -100,8 +100,8 @@ public class Climber extends Subsystem{
this.safetySwitch = safetySwitch;
}
public void flipRatchet(){
///TODO: Code to flip out the front arms of the climber WIP
public void flipRatchet(boolean flip, double speed){
climberFront.set(FRONT_FREQ * speed);
}
}
/*