How to check if CTRE Phoenix library has finished initialization?

Sorry for the wait, I got caught up with releasing 5.21.2, but I have some answers for you.
There were two things going on that half canceled each other out.

The first thing was how you were setting sensor position, it’s an order of operations thing.
You set sensor position on subsystem construction, but you update the simulated integrate sensor position on subsystem periodic.
This meant you were setting the sensor position before the device knew where it was, so you were setting it to the wrong value.
I copy-pasted your io.updateInputs(inputs) call just before seedSensorPosition() and that seemed to fix your issue.

The second thing was a bug in our API that caused configs to get re-sent around the time the Phoenix-Initialization message went out.
Setting the sensor position is done in the same manner as configuring a parameter on our motor controllers.
This meant the setSelectedSensorPosition frame went out a second time around when the Phoenix-Initialization message printed, which happened to “fix” your bug and obscured the real problem.
This bug has been fixed and is available in our 5.21.2 release that’s just released.

Hope this helps!

1 Like