mirror of
https://github.com/Team4388/2019-Hit-or-Miss.git
synced 2026-06-09 00:28:05 -06:00
Fix rachetFlip
This commit is contained in:
@@ -61,14 +61,14 @@ public class OI
|
|||||||
liftBallIntake.whenPressed(new LiftBallDropHatch());
|
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();
|
double speed = m_driverXbox.getRightTriggerAxis();
|
||||||
climbUp.whenPressed(new InitiateClimber(true, speed));
|
climbUp.whenPressed(new InitiateClimber(true, speed));
|
||||||
climbUp.whenReleased(new InitiateClimber(false, speed));
|
climbUp.whenReleased(new InitiateClimber(false, speed));
|
||||||
|
|
||||||
JoystickButton ratchetFlip = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.RIGHT_TRIGGER_AXIS);
|
JoystickButton ratchetFlip = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.Y_BUTTON);
|
||||||
ratchetFlip.whenPressed(new ratchetFlip(true, speed));
|
ratchetFlip.whenPressed(new ratchetFlip(0.5));
|
||||||
ratchetFlip.whenReleased(new ratchetFlip(false, speed));
|
ratchetFlip.whenReleased(new ratchetFlip(0));
|
||||||
|
|
||||||
JoystickButton shiftUp = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.RIGHT_BUMPER_BUTTON);
|
JoystickButton shiftUp = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.RIGHT_BUMPER_BUTTON);
|
||||||
shiftUp.whenPressed(new DriveSpeedShift(true));
|
shiftUp.whenPressed(new DriveSpeedShift(true));
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import edu.wpi.first.wpilibj.command.Command;
|
|||||||
|
|
||||||
public class InitiateClimber extends Command
|
public class InitiateClimber extends Command
|
||||||
{
|
{
|
||||||
boolean climb;
|
static boolean CLIMB;
|
||||||
double speed;
|
double speed;
|
||||||
|
|
||||||
public InitiateClimber(boolean climb, double speed) {
|
public InitiateClimber(boolean climb, double speed) {
|
||||||
requires(Robot.climber);
|
requires(Robot.climber);
|
||||||
this.climb = climb;
|
this.CLIMB = climb;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ public class InitiateClimber extends Command
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute() {
|
protected void execute() {
|
||||||
if(climb){ //If climb button is pressed
|
if(CLIMB){ //If climb button is pressed
|
||||||
Robot.climber.setClimbSpeed(climb, speed);
|
Robot.climber.setClimbSpeed(CLIMB, speed);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Robot.climber.setClimbSpeed(false, 0);
|
Robot.climber.setClimbSpeed(false, 0);
|
||||||
|
|||||||
@@ -6,34 +6,28 @@ import org.usfirst.frc4388.robot.Constants;
|
|||||||
import edu.wpi.first.wpilibj.command.Command;
|
import edu.wpi.first.wpilibj.command.Command;
|
||||||
|
|
||||||
public class ratchetFlip extends Command {
|
public class ratchetFlip extends Command {
|
||||||
boolean flip;
|
private double speed;
|
||||||
double speed;
|
public ratchetFlip(double speed) {
|
||||||
public ratchetFlip(boolean flip, double speed) {
|
|
||||||
requires(Robot.climber);
|
requires(Robot.climber);
|
||||||
this.flip = flip;
|
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called just before this Command runs the first time
|
// Called just before this Command runs the first time
|
||||||
@Override
|
@Override
|
||||||
protected void initialize() {
|
protected void initialize() {
|
||||||
|
Robot.climber.flipRatchet(speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called repeatedly when this Command is scheduled to run
|
// Called repeatedly when this Command is scheduled to run
|
||||||
@Override
|
@Override
|
||||||
protected void execute() {
|
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()
|
// Make this return true when this Command no longer needs to run execute()
|
||||||
@Override
|
@Override
|
||||||
protected boolean isFinished() {
|
protected boolean isFinished() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called once after isFinished returns true
|
// Called once after isFinished returns true
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class Climber extends Subsystem{
|
|||||||
this.safetySwitch = safetySwitch;
|
this.safetySwitch = safetySwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flipRatchet(boolean flip, double speed){
|
public void flipRatchet(double speed){
|
||||||
climberFront.set(FRONT_FREQ * speed);
|
climberFront.set(speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user