mirror of
https://github.com/Team4388/2019-Hit-or-Miss.git
synced 2026-06-08 16:18:02 -06:00
Fix rachetFlip
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user