How to modify CPR in ODrive Pro when using CUI-AMT212B-V-OD to account for 5:1 gearing between motor and encoder?

I’m using an ODrive Pro to drive a 15 pole pair hoverboard motor. I’m not using the internal hall effect sensors, but rather an external CUI-AMT212B-V-OD encoder geared to the motor through a 5:1 gearing ratio (picture below).

I cannot figure out how to modify the CPR of the encoder settings within either the online GUI or OdriveTool. The GUI seems to have no location for me to do this, and using the OdriveTool doesn’t seem to have any effect when I try to use the command: odrv0.inc_encoder0.config.cpr = 81920

When running the calibration sequence in the GUI, I get error: “Procedure error POLE_PAIR_CPR_MISMATCH. It looks like Motor > Pole Pairs should be 3. Please consult your motor datasheet and update the configuration”

I understand that this encoder is an absolute encoder, but I’m hoping Odrive supports this in some way as its an integer ratio.

Extra info: I experimented with setting the pole pairs to 3 (actual pole pairs of 15 divided by my encoder gear ration of 5) and it passes calibration, allows for control, but the velocity (and I’m guessing odometry) is off by a factor of 5.

Any help would be greatly appreciated!

Since absolute encoders don’t output CPR, just a 0-1 value, you’d have to modify your pole pairs, then correct for the velocity in software.

Why not use the internal hall sensors as the commutation encoder, and then the AMT encoder as the load encoder?

When you say “correct for the velocity in software”, is that possible to configure within the ODrive Pro logic? The turn key ROS2 driver for this board is what really drew me to ODrive, so I’d really like to not have to modify it on the ROS side.

I don’t understand the specifics of how to configure the ODrive Pro to use both the hall sensors and the encoders, but I’d gladly go down that path if you could share more info on how to accomplish that? (Brief Google and forum searching didn’t yield anything).

Unfortunately the hall sensors are only 4deg resolution, so both the low speed control and odometry accuracy of using it alone are insufficient for my needs (I’ve already tried that path)

I’ll be using velocity control and odometry feedback if that helps with anything.

I appreciate the help and guidance. I was definitely thinking about the format of the absolute encoder incorrectly

You can just put in your robot config that your wheel is 1/5 of the true diameter, and it should work fine, no need to do anything in the ROS driver itself.

My apologies to revive an old thread, my question is very similar to what has been asked and what you have suggested,
I have a 4:1 gear ratio and i am currently using the built-in magnetic encoder at the motor-level, and i am trying to integrate the CUI-AMT212B-V-OD on the output (gear) level to account for slippage due to cable-driven mechanism,
Is there a way to integrate both of those to be able to use the absolute encoder at gear-level?
I am using an ODrive S1 and the D5312S motor

My apologies to revive an old thread, my question is very similar to what has been asked and what you have suggested,

No worries!

I want to make sure I’m not misunderstanding you:

  • You have a D5312s, and you’re using the S1’s onboard magnetic encoder to sense the motor shaft position
  • The D5312s output is connected via cable (that can have some slippage) to another shaft (with a 4:1 overall gear ratio) to an AMT21.

And your question is just if you can use both these encoders at once, to do pos/vel control on the output shaft?

That’s exactly my question,
Hope that’s possible!

Yes, you can totally do that! If you’re setting this up in the GUI, just check “use separate commutation encoder.” Then set the load encoder to the AMT21, and the commutation encoder to the onboard encoder.

Note that if the directions of the encoders are opposite of each other (e.g. if the signs of commutation_mapper.vel is opposite than pos_vel_mapper.vel when you turn the shaft), you can set pos_vel_mapper.scale to -1 (and then run save_configuration).