ODrive micro weird one time behaviour after calibration

I have a situation where I’m checking the encoder position in a while loop and if it moves more than 0.004 (due to external conact with something)I trigger a function call. This trigger is usually very consistent; however, I noticed that after you do a calibration the trigger is off by a very little amount. This amount is enough to cause issues for my application. Does anyone know why this may be happening? I have a workaround where after I do a calibration if it triggers it goes back and does another trigger. The second (and every subsequent trigger is correct, but the first trigger after calibration never is. (But it’s wrong by a consistent amount))

The motor and encoder move a bit during calibration. What encoder are you using? If it’s an absolute encoder, you don’t need to do calibration on power up. If it’s an incremental encoder with an index pulse, you can use an index search procedure to zero or reference the motor’s angle to the index pulse.

the onboard hall effect

You don’t have to calibrate on power up then – once you do a calibration and save the configuration (which will be done automatically in the GUI calibration flow), it’ll restore the calibration on boot. You can save the absolute position (within one revolution) between boots with the absolute encoder reference frame.