Reducing CanCoder messaging rate?

Trying to reduce how much CAN messaging the CTR CanCoders are doing. I really only use them at robot init once, so the refresh rate could be very slow ideally. I understand they are at 10ms by default?

Can anyone provide a java example of how to set this?

I can’t tell from the documentation if I should be using

_canCoder.velocityMeasurementPeriod = SensorVelocityMeasPeriod.Period_25Ms;



1 Like

setStatusFramePeriod is what you’re looking for.

Keep in mind by reducing the status frame period you are reducing the rate at which you get encoder data updates.

The velocity measurement period is the period over which velocity samples are averaged to filter out noise.

Do you have any example java code how you set that?

1 Like

Have you looked at CTRE’s examples? For example here’s one: although I don’t like that they did it in teleop init rather then robot init.

1 Like

I don’t see CanCoders at all in that code example

Joe is referring to lines like this that showcase the setStatusFramePeriod function:

That function is being called on a motor controller in the example but it’s a common API function that exists on all Phoenix CAN classes.

CANcoder Status Information:

So something like this would hit the can bus every 100ms instead of the usual 10ms?

CANCoder rot_encoder_bl = init(new CANCoder(CAN.DT_BL_CANCODER));
rot_encoder_bl.setStatusFramePeriod(CANCoderStatusFrame.SensorData, 100, 100);


The Messaging rate caused an issue (we were unaware of at the time) with our current 2022 robot where our max Falcon motor usage was 15. Our robot uses 17. Changing it to 100ms fixed the problem for us.


To clarify for talonFXs, if most of our PID loops are running on integrated sensors, the onboard PIDs don’t need the canbus for the feedback loop, is that correct?

Most of these status frames, are IN FACT (stupid question coming up), status frames for GETTING, and I don’t need them for SETTING.

I can turn all of these status groups off?

Yes, status frames continuously report data on the can bus. If you don’t need to get the data in your program, you can increase the period.

1 Like

good to know. I’m gonna be wiping almost all of this stuff out!
I’m guessing this makes phoenix tuner a little harder to use the plotting function?

Some reading:

CTRE docs:
Common Device API — Phoenix documentation

REV docs:
Control Interfaces - SPARK MAX

1 Like

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