Getting Motor to update faster

So I’m having trouble getting values from a motor at a fast pace. I have a Talon hooked up to a motor which is hooked to an Encoder with the idea that I can eventually do PID. Basically I have a program where I log the encoder Velocity along with time. The time updates pretty fast, about every .01 seconds, but the encoder velocity updates every .1 seconds, so the encoder velocity value is the same for ten iterations of time. I have been experimenting with setExpiration() and SetSafetyEnabled() and none of that has worked. I changed the expiration time to .01 figuring that the motor would update every .01 seconds but that didn’t work. I was wondering if I had to use EnableControl(). Any Ideas?

Sounds like your using a Talon SRX over CAN bus.

Be sure to update to latest FRC legal firmware 2.0. (Section 2.3).

Please read section 16.9 and section 20 for tweaking the update rates the Talon reports it’s signals over CAN bus.

setExpiration() and SetSafetyEnabled() is a totally different feature available for all motor controllers (has to do with auto-zero-ing your motors if software does not call set often enough). Also is explained in section 19.

Is there any reason why you are not letting the Talon SRX perform the close-loop for you (section 10.3 Velocity closed loop)?

Sections are in the Talon SRX Software Reference Manual…

Thanks for the advice. I was able to fix the problem associated with updating the Encoder Position value with SetStatusFrameRateMs(). However, this function did not update the Encoder Velocity value. They are both part of the CANTalon class for the encoder so I’m not sure why it would work for the Encoder Position but not the Encoder Velocity. Any more help?

So did you check the firmware version?

Yes, updating the talons did work. Thanks for the help!!! :slight_smile: