Fix armControlMode vs controlMode conflict

controlLoopUpdate() was reading rogue variable "controlMode", which never changed, instead of "armControlMode" used by the rest of the code
This commit is contained in:
Dave Staudacher
2019-03-06 05:56:54 -07:00
parent 009e3d1443
commit edaf45b6ca
@@ -91,7 +91,6 @@ public class Arm extends Subsystem implements ControlLoopable
// Pneumatics // Pneumatics
private Solenoid speedShift; private Solenoid speedShift;
private ArmControlMode controlMode = ArmControlMode.JOYSTICK_MANUAL;
// Misc // Misc
public static final double AUTO_ZERO_MOTOR_CURRENT = 4.0; public static final double AUTO_ZERO_MOTOR_CURRENT = 4.0;
private boolean isFinished; private boolean isFinished;
@@ -253,23 +252,23 @@ public class Arm extends Subsystem implements ControlLoopable
lastControlLoopUpdateTimestamp = currentTimestamp; lastControlLoopUpdateTimestamp = currentTimestamp;
// Do the update // Do the update
if (controlMode == ArmControlMode.JOYSTICK_MANUAL) { if (armControlMode == ArmControlMode.JOYSTICK_MANUAL) {
controlManualWithJoystick(); controlManualWithJoystick();
} }
else if (!isFinished) { else if (!isFinished) {
if (controlMode == ArmControlMode.MOTION_PROFILE) { if (armControlMode == ArmControlMode.MOTION_PROFILE) {
isFinished = mpController.controlLoopUpdate(getPositionInches()); isFinished = mpController.controlLoopUpdate(getPositionInches());
} }
if (controlMode == ArmControlMode.JOYSTICK_PID){ if (armControlMode == ArmControlMode.JOYSTICK_PID){
controlPidWithJoystick(); controlPidWithJoystick();
System.err.println("test of pid"); System.err.println("test of pid");
} }
/*else if (controlMode == ArmControlMode.MP_PATH_VELOCITY) { /*else if (armControlMode == ArmControlMode.MP_PATH_VELOCITY) {
isFinished = mpPathVelocityController.controlLoopUpdate(getGyroAngleDeg()); isFinished = mpPathVelocityController.controlLoopUpdate(getGyroAngleDeg());
} }
else if (controlMode == ArmControlMode.ADAPTIVE_PURSUIT) { else if (armControlMode == ArmControlMode.ADAPTIVE_PURSUIT) {
updatePose(); updatePose();
isFinished = adaptivePursuitController.controlLoopUpdate(currentPose); isFinished = adaptivePursuitController.controlLoopUpdate(currentPose);
}*/ }*/