TalonSRX Swerve Drive Encoder Distance


#1

Hi,

We are currently trying to make a drive distance autonomous command. In order to do this, we have to calculate the distance traveled using the getSelectedSensorPosition() method and the circumference of the wheels. What is the range of values that the method would return?


#2

It returns sensor units…
https://www.ctr-electronics.com/downloads/api/cpp/html/classctre_1_1phoenix_1_1motorcontrol_1_1can_1_1_base_motor_controller.html#afb93c9461299c26b8250e8f22c69d360
… which is based on your sensor resolution…
https://phoenix-documentation.readthedocs.io/en/latest/ch14_MCSensor.html#sensor-resolution

Make sure you confirm this empirically…
https://phoenix-documentation.readthedocs.io/en/latest/ch14_MCSensor.html#confirm-sensor-resolution-velocity

Overall

Assuming you’ve completed your motor controller bring-up…
https://phoenix-documentation.readthedocs.io/en/latest/ch13_MC.html
… you should then follow the Talon sensor bringup for best results…
https://phoenix-documentation.readthedocs.io/en/latest/ch14_MCSensor.html#

Test your sensors thoroughly before you begin closed-looping.
Otherwise you’ll lose dev time in the long run.

Make sense?


#3

Okay, thank you!