Onboard PIDs on Talon w/ Sensors from Rio

Hi,
We were wondering if it is in any way possible to feed the Talons with a sensor that is connected to the RoboRio. (We are trying to use SRX Mag Encoders with Falcons. Our current setup is Gadgeteer Breakout Modules connected to the Rio.) As far as we have read from the documentation, we could not find any ways to do so.

If it is possible, would the different frequencies of loops on the Rio and the Talons cause any issues? Or, could this be resolved by running the sensor feeding on a separate faster thread?

It’s probably technically possible, although it would require some reverse engineering of CTRE’s CANbus messages.

However, why would you want to do that? There are basically two strategies for control loops in FRC: run on the RIO, or run on the motor controller. The advantage of running a control loop on the motor controller is a faster loop rate: a Talon SRX runs a PID loop at 1 kHz, from what I hear. The advantage of running a control loop on the RIO is greater flexibility: you can add arbitrary feedforwards, adaptively modify the algorithm, or even run something that’s completely different from PID.

Now, if you have a sensor that’s connected to the RIO, even if you’re forwarding that data to a loop on a motor controller, you’re already limited by the RIO’s speed: you can feed sensor updates to the motor controller at most once per RIO loop, so the motor controller’s higher loop rate is effectively wasted.

Given that you can’t forward sensor data to the motor controller faster than the RIO is running, why not just implement the PID controller on the RIO in the first place?

7 Likes

I’d say you probably could if you tried really hard, but you probably shouldn’t.

Plug those encoders into a CANifier. You could also run a PID on the RoboRIO itself. You probably don’t need ultra-high control loop rates.

I think you should look at the CANifier and remote sensors:

http://www.ctr-electronics.com/can-can-canifier-driver-led-driver-gpio.html#product_tabs_technical_resources