Question regarding .Follow()

Hi,

I was wondering if setting one Talon FX motor to “follow” another would result in the two motors both moving in their respective (+) directions (given inverts), or if it would result in both motors moving a certain mechanical direction (ex: both moving clockwise). I don’t think the documentation is clear in this respect.

Thanks in advance!

From my experience, Talon FX following will respect inverts. IIRC you can use an enum, InvertType I think, to set the inversion relative to the lead motor.

Here is our code to initialize our motors. The right Motor is inverted in order for its positive internal encoder direction to be the intended way (clockwise). The left motor’s positive internal encoder direction is already how we intend it (counterclockwise). I want to make it so that when I pass in a positive encoder tick to the right Motor, it will move in its positive direction (clockwise) while the left motor goes in its positive direction as well (counterclockwise).

This looks good, though I would recommend making the inversion for leftMotor explicit instead of leaving it default (since default behavior can change). On the second to last line in this snippet, what I would add is leftMotor.setInverted(InvertType.OpposeMaster);, which in this case is the same thing as leftMotor.setInverted(false);.

Thanks for your help! Just added your recommendation.

Will I have to recall leftMotor.follow() every time I run a set command for the right motor (the master)?

No, You only call that when initializing the motor.

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