Error_control_deadline_missed

Hi guys !

I have an 24V odrive board 3.6 with firmware v0.4.11 and I’m using it with a brushless motor from hobbyking (Turnigy Aerodrive SK3 - 4250-350kv) and a cheap encoder (B015GYY7XU)

I setup my odrive as the documentation suggest:

odrv0.axis0.motor.config:

pre_calibrated = False (bool)
pole_pairs = 7 (int)
calibration_current = 10.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 2.110511741193477e-05 (float)
phase_resistance = 0.04368022829294205 (float)
direction = -1 (int)
motor_type = 0 (int)
current_lim = 20.0 (float)
current_lim_tolerance = 1.25 (float)
inverter_temp_limit_lower = 100.0 (float)
inverter_temp_limit_upper = 120.0 (float)
requested_current_range = 60.0 (float)
current_control_bandwidth = 1000.0 (float)

odrv0.axis0.controller.config

control_mode = 3 (int)
pos_gain = 20.0 (float)
vel_gain = 0.0005000000237487257 (float)
vel_integrator_gain = 0.0010000000474974513 (float)
vel_limit = 20000.0 (float)
vel_limit_tolerance = 1.2000000476837158 (float)
vel_ramp_rate = 10000.0 (float)
setpoints_in_cpr = False (bool)

odrv0.axis0.encoder.config

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 = 2400 (int)
offset = -1279 (int)
offset_float = 0.1684531271457672 (float)
enable_phase_interpolation = True (bool)
bandwidth = 1000.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)

The full_calibration and the closed_loop_control work just fine. But when I want to move the motor with pos_setpoint, I’m getting this error:

axis0
axis: Error(s):
ERROR_CONTROLLER_FAILED
motor: Error(s):
ERROR_CONTROL_DEADLINE_MISSED
encoder: no error
controller: Error(s):
ERROR_OVERSPEED

I’m trying to figure out what happen for 2 weeks now. I played with a lot of params, try 12V and 24v power supply, change the motor and the encoder (but same ref), try python script instead of odrivetool.
Same result :frowning:

I have the feeling that the problem come from the encoder (600 ppr so 2400 cpr) because I read

“Usually that error is caused by noise on the index pulse line of the encoders. It gets picked up and triggers an interrupt on repeat.”

But my setup is pretty clean and I don’t understand how there can be noise

Am I missing something ? Any ideas ?
Thanks for your help

Ignore the CONTROL_DEADLINE_MISSED - it’s misleading. It’s caused by the real error, which is ERROR_OVERSPEED.

As in a similar thread here:

  1. Do not set the position demand using pos_setpoint= to move a long distance.
    Set your trap_traj vel_limit to be below (e.g. half) the actual vel_limit, and use controller.move_to_pos() instead, to generate and follow trajectory to the new position
  2. Increase the vel_limit
  3. Reduce your controller gains
3 Likes

Thank you for the anwser :ok_hand:

move_to_pos() seems to work much better than pos_setpoint.

Where can I read more about the trap_traj attributs ? I would like to know what is the difference between trap_traj.vel_limit and controller.vel_limit.
Also what about the controller gains ?

Thanks again

Hi @Bechilled

See https://docs.odriverobotics.com/#trajectory-control
Also https://docs.odriverobotics.com/control

The vel_limit is a safety speed limit - the drive will lock out in error if it is exceeded.

The ODrive implements various PID control loops (see second link). If you set pos_setpoint directly, then you are simply changing the control reference (effectively, you are asking for infinite acceleration) - if it’s more than a few counts away from the actual position, then the integrator will wind up and the drive will use maximum available voltage and current to accelerate, until it approaches the new position. This may exceed the vel_limit and cause it to shut down.

trap_traj.vel_limit is not so much a limit but a cruising speed - the trajectory generator plans a smooth ramp in position reference, so as not to cause such severe acceleration.

As for control gains, see link and/or read up about how PID controllers work :slight_smile:

2 Likes