Understanding Absolute Encoder Reference Frames

Hello Fellow ODrivers,

I have two revolute joints (call them J1 and J2) that have absolute encoders on the load side. They have physical stops that limit their range.

For J1, my absolute raw encoder values range from 0.157 → 0 ->1 → 0.432 Turns
My desired zero-point for J1 is at 0.792 Turns raw

For J2 my absolute raw encoder values range from 0.320 → 0 → -> 0.511 Turns
My desired zero-point for J2 is at 0.911 Turns raw

I wanted to use this quick guide on the ODrive website but I am not sure if I can actually use it or if I am using it right. Every time I power up and calibrate I seem to loose my zeros.

Is there a different way to tell the ODrives that I would like the raw readings of 0.792 and 0.911 to be where my axes zeros are? Additionally, can I use the absolute encoder raw32 values to zero my axes (assuming this gives me better accuracy)?

I think in this case you would just set pos_vel_mapper.config.offset for J1 to -0.792 and, and -0.911 for J2.

Additionally, can I use the absolute encoder raw32 values to zero my axes (assuming this gives me better accuracy)?

That’s something slightly different, it’s essentially just an additional turn count for RS485 encoders that’s always active even when the encoder isn’t being used for load/commutation, in case you want to just be able to monitor the position and turn count – not relavent for your system.

1 Like

Sounds good. I will try that out.

In the same vein, I have a linear axis with end stops. My min_endstop is configured as follows:

# Min End Of Travel
    odrv1.config.gpio2_mode = GpioMode.DIGITAL
    odrv1.axis0.min_endstop.config.gpio_num = 2
    odrv1.axis0.min_endstop.config.is_active_high = True
    odrv1.axis0.min_endstop.config.offset = 0.25
    odrv1.axis0.min_endstop.config.debounce_ms = 25
    odrv1.axis0.min_endstop.config.enabled = True

I saved the configuration and then ran the homing sequence

run_state(odrv1.axis0, AxisState.HOMING)

It seems the final step of the sequence is to move to the axis/ zero position. My ODrive does not move to 0.25 turns from the min_endstop but rather to some other seemingly random spot.

I also have a max_endstop that I have configured as well

# Max End Of Travel
    odrv1.config.gpio10_mode = GpioMode.DIGITAL
    odrv1.axis0.max_endstop.config.gpio_num = 10
    odrv1.axis0.max_endstop.config.is_active_high = True
    odrv1.axis0.max_endstop.config.offset = 0.0
    odrv1.axis0.max_endstop.config.debounce_ms = 25
    odrv1.axis0.max_endstop.config.enabled = True

Could anything here be causing the behavior I described above?

It seems the final step of the sequence is to move to the axis/ zero position. My ODrive does not move to 0.25 turns from the min_endstop but rather to some other seemingly random spot.

Do you have absolute_setpoints set to True? What’s the value of pos_estimate after the ODrive hits the endstop then finishes the move back to what should be -0.25 turns from the endstop (e.g. new zero).