CTRE Talon SRX - Output not updated often enough

For some reason, instead of making the motors all run at a continuous speed, when we run some basic code, they just spin for a short time, then stop for a short time, and then spin again,

in some kind of loop.

We are using TalonSRX motors which have been updated to firmware version 3.3. We have 3 motors on each side of the robot, where 2 of those 3 on each side are set as followers of another.

Here is how we are getting the motors to run:

public class Robot extends IterativeRobot {
	public static final int FRONT_LEFT_MOTOR = 1;
	public static final int FRONT_RIGHT_MOTOR = 2;
	public static final int REAR_LEFT_MOTOR = 3;
	public static final int REAR_RIGHT_MOTOR = 4;
	public static final int LEFT_MOTOR = 5;
	public static final int RIGHT_MOTOR = 6;
	private WPI_TalonSRX lm = new WPI_TalonSRX(LEFT_MOTOR);
	private WPI_TalonSRX ls1 = new WPI_TalonSRX(FRONT_LEFT_MOTOR);
	private WPI_TalonSRX ls2 = new WPI_TalonSRX(REAR_LEFT_MOTOR);
	private WPI_TalonSRX rm = new WPI_TalonSRX(RIGHT_MOTOR);
	private WPI_TalonSRX rs1 = new WPI_TalonSRX(FRONT_RIGHT_MOTOR);
	private WPI_TalonSRX rs2 = new WPI_TalonSRX(REAR_RIGHT_MOTOR);

	public void robotInit() {
		ls1.set(ControlMode.Follower, LEFT_MOTOR);
		ls2.set(ControlMode.Follower, LEFT_MOTOR);
		rs1.set(ControlMode.Follower, RIGHT_MOTOR);
		rs2.set(ControlMode.Follower, RIGHT_MOTOR);

	public void autonomousInit() {
		rm.set(ControlMode.PercentOutput, 0.3);
		lm.set(ControlMode.PercentOutput, 0.3);

Any advise someone could give would be greatly appreciated, we are completely lost :confused:

You need to put the .set() calls into autonomousPeriodic(), not autonomousInit(). This is called “motor safety” because you’re not periodically calling set. It’s designed to prevent runaway issues when the motors aren’t actually under control of the code.

We tried changing it to run in autonomousPeriodic(), and also tried only initializing the motors as TalonSRX motors instead of the WPILib compatible equivalent. We also tried running them in a while loop inside autonomous periodic with a delay of 1ms between iterations.

In all these situations we get roughly the same effect. The difference between calling set() repeatedly in a loop and calling it once in autonomousInit() is that the time it takes to switch from running to stopped and vice versa is shorter - more like a small fraction of a second instead of 1/2 a second.

Fixed it!

Turns out we had missed an update for WPILib.