WPI_TalonSRX motor safety not working with followers?

We have 6 motor controllers for the drivetrain on the CAN bus, 2 of which are VictorSPXes and 4 are TalonSRXes. I’ve declared and initialized them as follows:

public static final WPI_VictorSPX rVictor = new WPI_VictorSPX(0);
public static final WPI_VictorSPX lVictor = new WPI_VictorSPX(3);
public static final WPI_TalonSRX lTalon1 = new WPI_TalonSRX(4);
public static final WPI_TalonSRX lTalon2 = new WPI_TalonSRX(5);
public static final WPI_TalonSRX rTalon1 = new WPI_TalonSRX(1);
public static final WPI_TalonSRX rTalon2 = new WPI_TalonSRX(2);



As you can see, the Talons are set to follow the Victors, so when driving, only the output for the Victors are set:

RobotMap.lVictor.set(ControlMode.PercentOutput, Math.max(-1, Math.min(1, -left)));
RobotMap.rVictor.set(ControlMode.PercentOutput, Math.max(-1, Math.min(1, right)));

However, when I run this code, the Talons keep on reporting motor safety errors (speed not updated frequent enough), so I had to disable safety for all the Talons. Shouldn’t the output for the Talons be updated automatically? What am I doing wrong here?

You could either turn the safety off, or repeat the follow() methods each time you update the lead motors.

Yeah, turning the safety for the Talons off does solve the problem. However I’m worried if I do that, then when the Victors are stopped by the motor safety, the Talons will keep on going. I’m also really confused about the follow methods; in my experience they only need to be called once for the outputs to follow, so I find it very weird that they need to be called repeatedly for motor safety. Is this a feature or some kind of bug?

Why would that be the case? Isn’t the whole point of the follower to mirror the output voltage of the master? So, if the safety mechanism sets your victor to 0, why wouldn’t that propagate through the bus to the Talon?

1 Like

I know that it should and probably will… But the part of the watchdogs for the Talons not getting fed by setting the victors made me uncertain about it. Thanks for the help!

What MS is

Motor Safety is a feature from WPI that auto-neutrals your MC if you stop calling set, (because your code crashed or debugger halted execution).

Keep in mind this is not a replacement for an attentive person operating the Driver Station.

Generally I don’t often find a reason to use Motor Safety in Java, unless I expressly want to attached the source-level debugger and expect my motors to stop when a breakpoint has tripped.

What CTRE MCs do

Since follower Talon/Vics typically do not get periodic set calls, it is appropriate to not enable motor safety (motor safety defaults off in CTRE MCs). Otherwise they will neutral (Self-test should report disabled control mode).

Followers do mirror the master output arbitrarily, so if the motor-safety forces the master to neutral, the followers will neutral as well.

You can do this experiment trivially by wrapping your set call with a button press and observe the MC response with the robot seated on a tote (with wheels free spinning).


What happens if connection with the master is lost, e.g. due to a physical break in the CAN network or the master’s breaker tripping?

If the master is lost, the follower will neutral (after a timeout).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.