Odrive not calibrated after reboot

Hey, I’m working with a Python program that controls an ODrive Pro. After rebooting the motor, whenever I try to send a command, it throws an error saying the motor isn’t calibrated. I noticed this happens because axis.pos_vel_mapper.pos_abs is NaN.

If I manually assign it a value, everything starts working normally again. For now, I’ve added a check in my Python script that sets it to a valid number right after a reboot, before sending any new commands.

Is there an ODrive-specific setting or parameter that would make it remember its position after a reboot or at least automatically reset it to 0.0?

Sounds like you set absolute_setpoints to True. If you set it to False, it’ll automatically set the position to zero at startup. If you want an absolute / consistent position/angle mapping between the ODrive’s count and the actual motor angle/position, you should check out the position reference frame section of the docs. Namely:

Startup-Relative Reference Frame

This is the default configuration. A position of 0.0 corresponds to the physical position at which the ODrive started up. This mode useful for sending incremental position commands (“move 2 turns forward”).

This mode is selected by seting <axis>.controller.config.absolute_setpoints to False.

and

Custom User Reference Frame

The reference frame is defined by the user, based on external information.

This mode is useful if the user wants to implement a custom homing procedure or has some other way of determining the axis position, which is not natively supported by the ODrive (for example a vision-based approach).

To use this mode, simply write the current axis position to <axis>.pos_estimate. This is typically done once every time the ODrive powers up or reboots.

For improved safety, it is also recommended to set <axis>.controller.config.absolute_setpoints to True. This makes the ODrive reject position control commands after startup until <axis>.pos_estimate has been set.

(the part that’s causing your issue highlighted in bold :slight_smile: )