mirror of
https://github.com/Team4388/2019-Hit-or-Miss.git
synced 2026-06-09 00:28:05 -06:00
Added wrist mode changing in OI
This commit is contained in:
@@ -16,6 +16,7 @@ import edu.wpi.first.wpilibj.buttons.*;
|
||||
import org.usfirst.frc4388.robot.subsystems.*;
|
||||
import org.usfirst.frc4388.utility.MPSoftwarePIDController.MPSoftwareTurnType;
|
||||
import org.usfirst.frc4388.robot.subsystems.Drive;
|
||||
import org.usfirst.frc4388.robot.subsystems.Wrist.WristControlMode;
|
||||
import org.usfirst.frc4388.utility.MPSoftwarePIDController.MPSoftwareTurnType;
|
||||
|
||||
import edu.wpi.first.wpilibj.buttons.Button;
|
||||
@@ -59,7 +60,11 @@ public class OI
|
||||
|
||||
JoystickButton shiftDown = new JoystickButton(m_driverXbox.getJoyStick(), XboxController.LEFT_BUMPER_BUTTON);
|
||||
shiftDown.whenPressed(new DriveSpeedShift(false));
|
||||
// shiftDown.whenPressed(new LEDIndicators(false));
|
||||
// shiftDown.whenPressed(new LEDIndicators(false));
|
||||
|
||||
//Wrist
|
||||
JoystickButton wristManualMode = new JoystickButton(m_operatorXbox.getJoyStick(), XboxController.A_BUTTON);
|
||||
wristManualMode.whenPressed(new WristSetMode(WristControlMode.JOYSTICK_MANUAL));
|
||||
|
||||
|
||||
//Operator Xbox
|
||||
|
||||
@@ -86,15 +86,6 @@ public class Wrist extends Subsystem
|
||||
|
||||
manualOverride = Robot.oi.getOperatorJoystick().getRawButton(XboxController.A_BUTTON);
|
||||
|
||||
if(manualOverride == true)
|
||||
{
|
||||
setWristControlMode(wristControlMode.JOYSTICK_MANUAL);
|
||||
}
|
||||
else if(manualOverride == false)
|
||||
{
|
||||
setWristControlMode(wristControlMode.PID);
|
||||
}
|
||||
|
||||
while(getWristControlMode() == wristControlMode.JOYSTICK_MANUAL)
|
||||
{
|
||||
wristRight.set(wristJoystickInput);
|
||||
@@ -163,6 +154,45 @@ public class Wrist extends Subsystem
|
||||
{
|
||||
wristRight.set(ControlMode.PercentOutput, speed);
|
||||
setWristControlMode(wristControlMode.JOYSTICK_MANUAL);
|
||||
}
|
||||
|
||||
//@Override
|
||||
public void onLoop(double timestamp)
|
||||
{
|
||||
synchronized (Wrist.this) {
|
||||
switch(getWristControlMode() ) {
|
||||
case PID:
|
||||
controlPidWithJoystick();
|
||||
break;
|
||||
case JOYSTICK_MANUAL:
|
||||
controlManualWithJoystick();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void controlPidWithJoystick()
|
||||
{
|
||||
|
||||
|
||||
///CHANGE ACCORDING TO DIFFERENT LEVELS ON SPACESHIP
|
||||
/*
|
||||
//double joystickPosition = -Robot.oi.getOperatorController().getLeftYAxis();
|
||||
//double deltaPosition = joystickPosition * joystickInchesPerMs;
|
||||
|
||||
targetPositionInchesPID = targetPositionInchesPID + deltaPosition;
|
||||
updatePositionPID(targetPositionInchesPID);
|
||||
*/
|
||||
}
|
||||
|
||||
private void controlManualWithJoystick()
|
||||
{
|
||||
double joystickSpeed;
|
||||
|
||||
joystickSpeed = -Robot.oi.getOperatorController().getLeftYAxis();
|
||||
setSpeedJoystick(joystickSpeed);
|
||||
}
|
||||
|
||||
public synchronized boolean isFinished()
|
||||
|
||||
Reference in New Issue
Block a user