Help with encoder pre-calibration

Hi there,

I have 2 x motors setup on my odrive in current control mode with 4096 cpr encoders with no index. All is good following the motor and encoder calibrations however when I try to run directly on power-up without calibrating I was seeing strange issues where the motors, when given the same current command, sometimes they would both turn the same direction, sometimes the would be turning different directions and sometimes the acceleration of one vs the other was much slower. I have found that if I call AXIS_STATE_ENCODER_OFFSET_CALIBRATION on power up and re-calibrate both motors then I do get consistent behaviour. However, a calibration every startup is not possible for my application (vehicle) as there would be load.

These are some of my observations which I think point to the problem but I need some of your expertise to help solve the problem:

  1. Following encoder calibration (and at any other time) I cannot ever set encoder.pre_calibrated = True. It is always False.

  2. On power-up encoder.is_ready is always False. In my application I set this to True on startup and can command current to the motors but this is where I see the inconsistent effects.

Can anyone offer any insight into this problem as I have not found anything on this forum?

My encoder settings are:
error = 0x0000 (int)
is_ready = True (bool)
index_found = False (bool)
shadow_count = 442919 (int)
count_in_cpr = 551 (int)
interpolation = 0.5 (float)
phase = 1.9721193313598633 (float)
pos_estimate = 442919.125 (float)
pos_cpr = 551.68994140625 (float)
hall_state = 4 (int)
vel_estimate = 0.0 (float)
calib_scan_response = 4079.0 (float)
mode = 0 (int)
use_index = False (bool)
find_idx_on_lockin_only = False (bool)
pre_calibrated = False (bool)
zero_count_on_find_idx = True (bool)
cpr = 4096 (int)
offset = 1926 (int)
offset_float = 0.7973593473434448 (float)
enable_phase_interpolation = True (bool)
bandwidth = 3000.0 (float)
calib_range = 0.019999999552965164 (float)
calib_scan_distance = 50.26548385620117 (float)
calib_scan_omega = 12.566370964050293 (float)
idx_search_unidirectional = False (bool)
ignore_illegal_hall_state = False (bool)
set_linear_count(count: int)

Thanks so much.

This is not possible, sorry. You must calibrate if you only have an encoder with no index or absolute output. The other issues you mention (things staying False) are deliberately programmed in an attempt to prevent users from getting into CLOSED_LOOP without a proper calibration.

As Wetmelon says, an incremental encoder doesn’t give enough information to start up without calibration. It tells by how much the motor has moved, but we still don’t know where it started from.
To apply full torque to the motor, the ODrive has to energise the coils in such a way that the magnetic field from the coils is perpendicular to the field from the magnets, i.e. it needs to know where the rotor is. So we have to calibrate by forcing the motor to a certain position and hoping (assuming) that it gets there. If there is a load on it that prevents that, you’re in trouble and you need an absolute encoder.

Fortunately, these are cheap. :slight_smile:

When using an absolute encoder such as this, you will be able to set pre_calibrated=True in the encoder settings, which will mean you don’t need to calibrate on start up.

Guys, thanks for your responses. That clears this up. I’ll need to work out a solution to this and trying to get the AS5048 built in to our motors seems like the way to go. (These were some custom-deisgned motors for us).

The encoder chipset in our motors is the AM4096. They do have a UVW commutation output. As I understand it this emulates Hall effect feedback? Perhaps if I switch over to this for now I may be able to run the motors without the calibration on every startup?

We specifically wanted the high-resolution encoder for precise control but to enable our testing to proceed while we look into move encoder the Hall feedback method would be ok in the short-run.

That encoder has an index pulse, labelled Ri.

Connect that to the index input of the ODrive, and you can then turn the wheels by hand a bit after startup, instead of calibration.

Also, it has absolute output over SSI. SSI isn’t supported (yet) by ODrive, but give it time and it might be.