Phoenix V6 deprecated CANCoders

My team has used CANCoders for a while, and with the new Phoenix v6 update the old CANCoder class has been deprecated. I wasn’t able to find much help with the migration guide, and I want to fix all our deprecated errors.

I found a class called CANcoders, and I want to know before I push to github, is the entire CANCoder change of v5 to v6 just removing the capital letter? I don’t want to over or undercomplicate it.

Deprecated code: absoluteEncoder = new CANCoder(absoluteEncoderId);
Error: The constructor CANCoder(int) has been deprecated since version 2024 and marked for removal

Update: I changed it to a uncapital letter and a method we used got marked as not in the new class, i couldnt find it anywhere in the documentation that tharunprogrammer showed me, so im going to have to try to research that.
encase you are curious the method is canCoderObject.configAbsoluteSensorRange

Here is the all migration API: https://pro.docs.ctr-electronics.com/_/downloads/en/latest/pdf/

2 Likes

Here is how I use it in YAGSL

1 Like

Just in case anyone runs into a similar problem, it looks like the CANcoders now provide their absolute value in rotations instead of degrees like last year. It took me two hours to figure out why none of our swerve modules were working after updating.

I’m guessing that this is how we configure CANcoders now, I used Tuner X but it took a few attempts for the settings to persist.

// Turn encoder configuration
CANcoderConfiguration config = new CANcoderConfiguration();
config.MagnetSensor.MagnetOffset = magneticOffset;
config.MagnetSensor.AbsoluteSensorRange = AbsoluteSensorRangeValue.Signed_PlusMinusHalf;
config.MagnetSensor.SensorDirection = SensorDirectionValue.Clockwise_Positive;
m_turnEncoder.getConfigurator().apply(config);

Yes. The change from degrees to rotations bit us too. It seems very poorly advertised! Thanks for the CANcoderConfiguration info. We’d been looking for that.

1 Like

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