Hi, I am trying to set up pre-calibration for my system. I am using CUI-102AMT encoders. I have odrive firmware v4.11 and am using a new V3.6 board
I perform the encoder with index calibration process as described in the documentation, and am able to actuate the motors while in closed loop control without error. However. If I reboot or power cycle the board and perform an encoder index search + move incremental call, the motor will spin out of control and error:
axis0
axis: Error(s):
ERROR_CONTROLLER_FAILED
motor: Error(s):
ERROR_CONTROL_DEADLINE_MISSED
encoder: no error
controller: Error(s):
ERROR_OVERSPEED
Is there something I am missing? Again, if I perform a normal calibration straight through there is no error and I am able to actuate the motors perfectly.
Details of my setup:
Default configs:
odrv0.config.brake_resistance = 0.5
odrv0.axis0.motor.config.current_lim = 13.0
odrv0.axis0.motor.config.calibration_current = 13.0
odrv0.axis0.motor.config.resistance_calib_max_voltage = 4.0
odrv0.axis0.motor.config.pole_pairs = 7
odrv0.axis0.motor.config.motor_type = 0
odrv0.axis0.encoder.config.cpr = 8192
odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.calib_range = 0.05
odrv0.axis0.controller.config.pos_gain = 100.0
odrv0.axis0.controller.config.vel_gain = 0.000125
odrv0.axis0.controller.config.vel_integrator_gain = 0.00001875
odrv0.axis0.controller.config.vel_limit = 901120.0
odrv0.axis0.trap_traj.config.vel_limit = 819200.0
odrv0.axis0.trap_traj.config.accel_limit = 8192000.0
odrv0.axis0.trap_traj.config.decel_limit = 8192000.0
Sequence of state calls:
odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
(I check if motor.config.phase_resistance >0 & motor.config.phase_inductance >0)
odrv0.axis0.encoder.config.use_index = True
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH
(I check if encoder.index_found = True)
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
odrv0.axis0.encoder.config.pre_calibrated = True
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.save_configuration()
odrv0.reboot()
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH
(I check if encoder.index_found = True)
odrv0.axis0.requested_state = AXIS_STATE__CLOSED_LOOP_CONTROL
odrv0.axis0.controller.move_incremental(7800, False)
The above typically works fine.
However, if I power cycle the board (or even perform another reboot() )and attempt:
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_INDEX_SEARCH
(I check if encoder.index_found = True)
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.controller.move_incremental(7800, False)
The motor will spin out of control and error.
Through my digging I noticed my error seems similar to odrive bugs discovered in these github threads:
Unable to use closed loop…
uncontrolled motor spinup…