Synchronously Moving Motors via Talon SRX

We are fine tuning an end-game action for our robot. Is there a way to move three motors, controlled by Talon SRXs, in near-perfect rotational synchronization? All three motors have encoders connected to the Talons. Because of some differences in loading, they might need to have different amounts of output (torque) to move at the same speed. The intent is to NOT have one motor get ahead of the others when rotating. Thank you FIRST community for your gracious professionalism!

In general, this is not possible for arbitrary loads on the motor. I could always apply 1000000Nm to one motor and kick it out of sync with the others.

Here’s one possible strategy:

Tune a position PID that is good at rejecting disturbances within the reasonable range of torques you expect independently for each motor. The key here is finding what reasonable is - the mechanical system will only be able to correct for so much. If a normal match applies loads beyond this, there’s not much software can do.

Once you’ve got position PID’s tuned up, from the roboRIO (edit: OR MagicMotion, either would probably work fine here), command a smoothly-changing position each loop. Guide the motors along the setpoint profile you want.

You might also consider adding logic to read the error from all 3 motors every loop. If the error on any one of them gets too big, keep the setpoint still until the error decreases. This gives a particular motor time to react to disturbances without the others getting too out of sync with it.

1 Like

If all three motors have integrated encoders with the talons, I would suggest trying to configure kF, kP, and (possibly) kD and apply the MotionMagic output mode to drive them all the same distance over the same amount of time.

Using a feed-forward motion profile like this will likely reduce the error you’re seeing down to zero.

Basically what @gerthworm said. Don’t try to control all three independently; that’s a good way for them to get out of sync from uneven loading.

Pick which motor you expect to have the most resistance torque (if they should be about equal then pick one randomly). Use MotionMagic to set a reasonable motion profile for that motor to follow. Then use PIDf to control the other two motors to match their position to the first motor’s current position. If the error between any of the motors is over a certain limit, stop the motion profile until the other motors catch up.

3 Likes

That you all for your reply. Is there a good resource for a tutorial/example of MotionMagic implementation in Java? Also, for clarification, the rear motor will have a heavilier load, but should be consistent since the weight/center-of-gravity of the robot will not be charging. The front two will have a lighter, shared load.

You could use the Follower control mode on the TalonSRX to slave two of the motors, and just use PID on one of them (maybe the one with the heavy load?) which would get them all to move in the same way

That’s likely a bad idea. Follower mode sets each motor controller to the same output %. That’s fine for mechanically-connected motors like drive motors in the same gearbox. For mechanically-independent motors, on the other hand, each motor can see different loads from the others. If they’re all set to the same output %, they’ll respond differently. Using PID to command each “follower” motor to the same position as the “master” motor ensures that they will stay aligned even if a follower sees a different load from the master.

2 Likes

Thanks to all for your helpful responses! We are experimenting with the ideas that @gerthworm and @AriMB recommended. You are the reason that #chiefdelphi is such a great #community.

1 Like

It worked! We now have three motors, fully synced, bi-directionally. Third-level climb is awesome. Many thanks to @AriMB and @gerthworm. Best of luck to you and your teams! I hope to see you in Houston or Detroit.

1 Like

So glad to hear it! Best of luck! Yes much hope to run into you at one of the two places! Still haven’t decided which I will attend in person…

1 Like

Assuming you are using the Phoenix talon library, you could do:
//I’m just throwing in the initializing code in to help it make more sense
Motor1 = new WPI_TalonSRX(/your Id/);
//Config motor as per usual
Motor2 = new WPI_Talon_SRX(/input/)
//config motor as per usual, then use following line
Motor2.follow(motor1);

Repeat motor 2 for motor 3

Sorry, Didn’t read thread close enough to see follower mode was already suggested

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