Custom motor/encoder setup custom calibration?

Hi!

Apologies if this has been answered, I searched and found some similar questions but haven’t quite figured it out.

I built a custom motor connected to an optical encoder elsewhere (picture a robot joint with the encoder moving at a different rate from the motor). It doesn’t work like the typical brushless motor config (i.e. one rotation does not equate to a full rotation on the encoder with x pulses, in this setup it can’t physically do a full rotation etc…) and so I believe it requires a different type of calibration method than the out of the box setup: odrv0.axis1.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

As you might expect, calling: dump_errors(odrv0) after a stock calibration sequence results in:
axis: Error(s):
AXIS_ERROR_ENCODER_FAILED

Error(s):
ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH

So my question is really this: If I know the shadow tick counts after manually moving the encoder to the end limits print(odrv0.axis1.encoder.shadow_count), can I somehow feed this information back in as a configuration in place of the stock calibration?

What other parameters would need to be manually set to make that work?

Am I thinking about this the wrong way?

Any help is appreciated.

Should be fine so long as you factor the gear ratio into the CPR config
So if your gearing is 3:1 for a 4000cpr encoder, you should set the ODrive for 12000cpr.
But make sure you DON’t use the index, because obviously that won’t work - you will have to do offset calibration on each boot.

Un-shelving this project and revisiting. Thanks for the reply @towen . Do you know by chance how to calibrate with end stops in place? I can remove load on the motor for calibration but not the hard stops which would otherwise allow for free movement. Thanks!

It depends on the gear ratio i.e. how much movement of the motor do you have between the hardstops?
You can try setting encoder.config.calib_scan_distance to a lower value, but you would lose some precision in the encoder calibration.