Raw encoder data not aligning with configured CPR

Hello,

I have noticed that my encoder’s raw output (odrv0.inc_encoder0.raw) does not align with the CPR that I have configured. Reading the raw data outputs values higher than 48,000 (up to 65,000) even though my encoder only has 48,000 counts per revolution. I turned the motor shaft by one full revolution and the counts do not line up - one revolution I saw a count of 3512, and on the next I saw a count of 48372 on nearly the exact same position.

During my encoder offset calibration, about half of the time it fails with the error: ProcedureResult.POLE_PAIR_CPR_MISMATCH
But the other half of the time I have success and there are no issues.

I have confirmed that the encoder does have a CPR of 48,000 - so I am not sure why the value that I have written to the encoder config is not limiting the raw output of the encoder. Snippet of code below to show what is happening. Any thoughts on why this is happening? Is there a CPR configuration that I missed somewhere?

Edit 1: This is on an Odrive Pro V4.4
Edit 2: It seems the raw encoder values are wrapping from 65,444 to 0. So it is counting up to 65,444 instead of 48,000.

In [47]: odrv0.inc_encoder0.config.cpr
Out[47]: 48000

In [48]: odrv0.inc_encoder0
Out[48]:
config:
  cpr: 48000 (uint32)
  enabled: True (bool)
pos_max: 0.8344270586967468 (float)
pos_min: 0.8344062566757202 (float)
pos_residual: 0.0 (float)
raw: 48372 (uint16)
status: 0 (uint8)

You are right, the value of raw is not reporting correctly. More specifically, it is reporting a value that does not have a lot of meaning (uint16 wraparound, hence 0-65535). This is a bug we’ll be sorting out ASAP, thanks for pointing it out!

Note: This bug only applies to the reported value of raw, so the incremental encoder should still be functioning properly.

I would suggest checking for any loose connections in the wiring, or mechanical slippage between the motor and encoder. Plotting the measured position / velocity in the GUI will help narrow in on any inconsistencies in the data.

Got it, thanks!

1 Like