Problems getting motor starting after reboot


I’m having problems starting the motor once the ODrive is rebooted. I’m kinda lost on what exactly to set after the boot to have it running successfuly.

Here’s something I do after the boot:
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH

Then, after I request the CLOSED_LOOP state, it doesn’t work. But that’s not always the case. Sometimes it does after resetting the axis error or encoder error and trying everything in various order.

I have AMT10-V encoder with 8192 turns. All of the commands run and turn the motor, but the encoder is not ready. To be honest, I don’t know what exactly sets the encoder is_ready state. It looks like when the is_ready is true, it works, otherwise it does not.

This is the output from the .encoder.

error = 0x0000 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 30996 (int)
count_in_cpr = 6420 (int)
interpolation = 0.5 (float)
phase = -0.05323982238769531 (float)
pos_estimate = 30996.96484375 (float)
pos_cpr = 6420.7685546875 (float)
hall_state = 0 (int)
vel_estimate = 0.0 (float)
  mode = 0 (int)
  use_index = True (bool)
  pre_calibrated = False (bool)
  idx_search_speed = 50.0 (float)
  cpr = 8192 (int)
  offset = 14646 (int)
  offset_float = 1.2071046829223633 (float)
  bandwidth = 1000.0 (float)
  calib_range = 0.05000000074505806 (float)

Motor is RaceStar BL 4076 with 4 Poles and 2000KV.

Thanks in advance.

You should only have to do odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE then CLOSED_LOOP.

Alternatively, use the startup configs

odrv0.axis0.config.startup_motor_calibration = True
odrv0.axis0.config.startup_encoder_offset_calibration = True
odrv0.axis0.config.startup_encoder_index_search = True
odrv0.axis0.config.startup_closed_loop_control = True

Make sure you don’t have any of the “precalibrated” configs set (for testing, you can enable them later once everything is working)

It would help us to give you advice if you can tell us what the error codes were.