mirror of
https://github.com/Team4388/2019-Hit-or-Miss.git
synced 2026-06-09 00:28:05 -06:00
Update to climber systems
Saftey should work now, all needs testing WPI
This commit is contained in:
@@ -49,8 +49,8 @@ public class OI
|
||||
CarriageEject.whenPressed(new IntakeSetSpeed(Carriage.CUBE_INTAKE_SPEED));
|
||||
CarriageEject.whenReleased(new IntakeSetSpeed(0.0));
|
||||
*/
|
||||
JoystickButton climbUp = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.RIGHT_TRIGGER_AXIS);
|
||||
int speed = XboxController.RIGHT_TRIGGER_AXIS;
|
||||
JoystickButton climbUp = new XBoxTriggerButton(m_operatorXbox, XboxController.RIGHT_TRIGGER);
|
||||
float speed = XboxController.RIGHT_TRIGGER_AXIS;
|
||||
climbUp.whenPressed(new InitiateClimber(true, speed));
|
||||
climbUp.whenReleased(new InitiateClimber(false, speed));
|
||||
|
||||
@@ -69,10 +69,14 @@ public class OI
|
||||
openIntake.whenPressed(new IntakePosition(true));
|
||||
|
||||
JoystickButton CloseIntake = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.RIGHT_BUMPER_BUTTON);
|
||||
CloseIntake.whenPressed(new IntakePosition(false));
|
||||
CloseIntake.whenPressed(new IntakePosition(false));
|
||||
*/
|
||||
JoystickButton safteySwitch = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.START_BUTTON);
|
||||
safteySwitch.whenPressed(new startSaftey(true));
|
||||
safteySwitch.whenReleased(new startSaftey(false));
|
||||
|
||||
SmartDashboard.putData("PRE GAME!!!!", new PreGame());
|
||||
*/
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("An error occurred in the OI constructor");
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import edu.wpi.first.wpilibj.command.Command;
|
||||
public class InitiateClimber extends Command
|
||||
{
|
||||
boolean climb;
|
||||
boolean saftey;
|
||||
float speed;
|
||||
|
||||
public InitiateClimber(boolean Climb, int speed) {
|
||||
@@ -16,16 +17,25 @@ public class InitiateClimber extends Command
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public startSaftey(boolean saftey){
|
||||
requires(Robot.climber);
|
||||
this.saftey = saftey;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute() {
|
||||
Robot.climber.setClimbSpeed(climb, speed);
|
||||
}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
if(climb && saftey){ //If climb and saftey button are 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()
|
||||
protected boolean isFinished() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,23 +79,26 @@ public class Climber extends Subsystem{
|
||||
}
|
||||
|
||||
public void setClimbSpeed(boolean Climb, float speed) {
|
||||
if (Climb && safteySwitch) {
|
||||
if(isPressed.isFwdLimitSwitchClosed()) //If back at max height
|
||||
{
|
||||
if (Climb) {
|
||||
if(isPressed.isFwdLimitSwitchClosed()){ //If back at max height
|
||||
climberBack.set(0);
|
||||
climberFront.set(FRONT_FREQ * speed);
|
||||
}
|
||||
else if (isPressed.isFwdLimitSwitchClosed() == false) //If back not at max height
|
||||
{
|
||||
else if (isPressed.isFwdLimitSwitchClosed() == false){ //If back not at max height
|
||||
climberBack.set(BACK_FREQ * speed);
|
||||
climberFront.set(FRONT_FREQ * speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Climb == false) {
|
||||
climberBack.set(0);
|
||||
climberFront.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public flipRatchet(){
|
||||
//Code to flip out the front arms of the climber WIP
|
||||
}
|
||||
}
|
||||
/*TODO
|
||||
* add command code for flipping front out (including button press)
|
||||
|
||||
Reference in New Issue
Block a user