mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
CANJaguar::Disable stops periodic setpoints
Calling CANJaguar::Disable() now makes NetComms stop periodic setpoint messages, so the motor actually stops until EnableControl() is called again. Change-Id: Ib4eb4ad5f729be5c74e799f02ed000511de1e03d
This commit is contained in:
@@ -1033,27 +1033,19 @@ public class CANJaguar implements MotorSafety, PIDOutput, SpeedController, LiveW
|
||||
* Stop driving the output based on the feedback.
|
||||
*/
|
||||
public void disableControl() {
|
||||
switch(m_controlMode) {
|
||||
case PercentVbus:
|
||||
sendMessage(CANJNI.LM_API_VOLT_DIS, new byte[0], 0);
|
||||
break;
|
||||
// Disable all control modes.
|
||||
sendMessage(CANJNI.LM_API_VOLT_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_SPD_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_POS_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_ICTRL_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_VCOMP_DIS, new byte[0], 0);
|
||||
|
||||
case Speed:
|
||||
sendMessage(CANJNI.LM_API_SPD_DIS, new byte[0], 0);
|
||||
break;
|
||||
|
||||
case Position:
|
||||
sendMessage(CANJNI.LM_API_POS_DIS, new byte[0], 0);
|
||||
break;
|
||||
|
||||
case Current:
|
||||
sendMessage(CANJNI.LM_API_ICTRL_DIS, new byte[0], 0);
|
||||
break;
|
||||
|
||||
case Voltage:
|
||||
sendMessage(CANJNI.LM_API_VCOMP_DIS, new byte[0], 0);
|
||||
break;
|
||||
}
|
||||
// Stop all periodic setpoints
|
||||
sendMessage(CANJNI.LM_API_VOLT_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_SPD_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_POS_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_ICTRL_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_VCOMP_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
|
||||
m_controlEnabled = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user