I have two mechanisms that are independent of each other, not mechanically linked, and they both have a CTRE Mag encoder on them. I’m wondering how I would go about synchronizing these mechanisms in software so that they would always be in the same place relative to each other, and their encoder positions are always the same.
Can you give me a specific example of what you’re trying to do? That may help. The main reason I’ve used this is for the drive train. We use a 4 CIM drive train, and by putting the front talons in follower mode they’ll always work in sync and you only need one encoder per half of the drive train.
Follower mode definitely would not work in the case of different loads. Follower mode sets the input on the follower motor to be the same as the leader, but in this case you’d want different inputs to achieve the same output.
You can use TalonSRX closed-loop for differential. We added this last season (for diff-swerve, diff-drive-train, and other similar mechanisms).
Basically you make one master talon calculate PID + PID, and PID - PID.
The former is applied to the motor. The latter is sent to your AuxFollower (talon set to follow with FollowType.AuxOutput1).
You could even run a primary PID to servo the difference/sum of the two sensors to maintain level, while open looping the overall up/down of the mechanism.
Similar post here manipulating two sensors to produce a sum/difference to servo/maintain.
MotionMagic with Aux PID would be useful since your target mechanism is profiled along your single-axis, meaning Aux PID maintains the sensor difference just like a turn-closed-loop during an arc.
Whatever you do, start by configuring the peak outputs to be very weak or disconnect motors entirely while you work out direction/phases/etc during hardware-bringup.