"Error Control deadline missed" dumped on applying variable load

Hello sir , I am using ODrive v3.5 with firmware 4.7 . I am using a 170 kV motor with pole pairs 20. Also i am using an optical encoder with 1600 counts per revolution mounted on the motor with effective gear ratio between encoder and motor as 2:1. So the cpr for the motor as 3200. But since i am using the motor to operate a leg of the quad pad , hence i am using a gear reduction of 11.35.
This is my motor config:

pre_calibrated = True (bool)
pole_pairs = 227 (int)
calibration_current = 50.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 7.33741080694017e-06 (float)
phase_resistance = 0.022274766117334366 (float)
direction = -1 (int)
motor_type = 0 (int)
current_lim = 60.0 (float)
requested_current_range = 100.0 (float)
current_control_bandwidth = 1000.0 (float)

I have multiplied the pole_pairs with 11.35 as i have multiplied the same with cpr.

This is my encoder config:

mode = 0 (int)
use_index = False (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
zero_count_on_find_idx = True (bool)
cpr = 36320 (int)
offset = -602 (int)
offset_float = -0.4655000567436218 (float)
bandwidth = 1000.0 (float)
calib_range = 0.019999999552965164 (float)

This is my controller config:

control_mode = 3 (int)
pos_gain = 24.0 (float)
vel_gain = 0.0044999998062849045 (float)
vel_integrator_gain = 0.0 (float)
vel_limit = 65000.0 (float)
vel_limit_tolerance = 1.2000000476837158 (float)
vel_ramp_rate = 10000.0 (float)
setpoints_in_cpr = True (bool)

I am using circular position control and operating the leg in a planned trajectory with time by giving the required position from arduino to odrive via pwm signal. Everything works well for few cycles but after that an error dumps on the axis as “Error Motor Disarm” and on the motor as “Error Control Deadline Missed”.
Sometimes even this error comes just after entering the closed loop control and sometimes when we increase the load on the leg.

Currently we are using axis1 but this error comes on axis0 too. Also out of four legs , this error consistently come on one leg , other three legs are working quite fine. Actually this error was dumped on each leg initially but now after proper tuning , the consistency of error is reduced. But still after three or four cycles , the error is dumped.

This is my axis:

error = 0x0020 (int)
step_dir_active = False (bool)
current_state = 1 (int)
requested_state = 0 (int)
loop_counter = 3152564 (int)
  startup_motor_calibration = False (bool)
  startup_encoder_index_search = False (bool)
  startup_encoder_offset_calibration = False (bool)
  startup_closed_loop_control = False (bool)
  startup_sensorless_control = False (bool)
  enable_step_dir = False (bool)
  counts_per_step = 2.0 (float)
  step_gpio_pin = 1 (int)
  dir_gpio_pin = 2 (int)
  ramp_up_time = 0.4000000059604645 (float)
  ramp_up_distance = 12.566370964050293 (float)
  spin_up_current = 10.0 (float)
  spin_up_acceleration = 400.0 (float)
  spin_up_target_vel = 400.0 (float)
  error = 0x0010 (int)
  armed_state = 0 (int)
  is_calibrated = True (bool)
  current_meas_phB = -0.044431209564208984 (float)
  current_meas_phC = -0.11622047424316406 (float)
  DC_calib_phB = -3.5817019939422607 (float)
  DC_calib_phC = -3.188002347946167 (float)
  phase_current_rev_gain = 0.05000000074505806 (float)
  current_control: ...
  gate_driver: ...
  timing_log: ...
  config: ...
  error = 0x0000 (int)
  pos_setpoint = 65154.234375 (float)
  vel_setpoint = 34000.0 (float)
  vel_integrator_current = 1.5368376970291138 (float)
  current_setpoint = 0.0 (float)
  vel_ramp_target = 0.0 (float)
  config: ...
  set_pos_setpoint(pos_setpoint: float, vel_feed_forward: float, current_feed_forward: float)
  set_vel_setpoint(vel_setpoint: float, current_feed_forward: float)
  set_current_setpoint(current_setpoint: float)
  move_to_pos(goal_point: float)
  error = 0x0000 (int)
  is_ready = True (bool)
  index_found = False (bool)
  shadow_count = 75346 (int)
  count_in_cpr = 2706 (int)
  interpolation = 0.5 (float)
  phase = -2.357374668121338 (float)
  pos_estimate = 75346.234375 (float)
  pos_cpr = 2706.234619140625 (float)
  hall_state = 5 (int)
  vel_estimate = 0.0 (float)
  config: ...
  error = 0x0000 (int)
  phase = -3.132059097290039 (float)
  pll_pos = -3.1323015689849854 (float)
  vel_estimate = 0.0249188095331192 (float)
  config: ...
  config: ...

I have a bit of knowledge about this error when i read controller.cpp in the firmware. This error comes when controller can’t send pwm signals when required but i can’t understand why is this error dumping after few cycles.

PS: My position and velocity control are working well with isolated motor i.e, without the leg and gear reduction.

I am having this trouble since several days, searched everywhere but the error can’t be resolved. I have to complete this project under fixed deadline. Hope for a quick reply @madcowswe @Wetmelon . Thanks.

Hello Sarthak, I have scratched my head over “Error Control deadline missed” error being thrown and tried a lot of things to solve it. It turned out to be false positive in the encoder Z line of the OTHER MOTOR axis. Having load may cause more noise in the encoder cables thus trigger the error faster. Quick way to test this is unplug encoder cables from axis0 when using axis1 and see if same error occurs.

The control deadline missed error happens when the motor thread crashes or takes too long to update the PWM timer --default behavior is to assume something went terribly wrong and halt.

If you have GDB and an ST-Link, check the FOC_current() function for any NANs which may be the result of noise or bad calculations.

Thanks for the reply @naktamello . As you have said , i tried removing the encoder pins of other axis , but error still dumps after few cycles. Also i am not using encoder z pin.

Looks like it is completely different cause from mine.
You probably would have seen this post by searching the forum with the error:

if not try reverting to firmware 0.4.6?

@madcowswe hi , currently I am having the same problem with my arm manipulator which is drives by odrive- . It is also dumping control deadline missed error . I have tried it with 4.7 as well as 4.8 firmware. Hope for a quick reply.

We may have fixed this on devel (as per this change).
Can you try compiling devel and flashing it and report if it has been fixed for you?

Thanks for the reply, we are trying this and will reply you.

No problem so far!!thanks for your help

@madcowswe , thanks for the reply but now something abrupt is happening. Axis1 is showing no error at all on continuous rotation but axis0 is showing some abrupt behavior. It had not dumped any error but did not responded good in position control. Current goes on increasing but the motor did not rotated . Neither it outputs any error nor it reaches the desired position. Mosfets goes on heating.

You flashed devel? Can you confirm that the ERROR_CONTROL_DEADLINE_MISSED is not happening anymore?

The issue you are describing for your Axis0 sounds like encoder slip. Please try recalibrating the encoder offset.

@madcowswe hello sir, thanks for the reply.
I have flashed the devel branch into my odrive. Now the problem of ERROR_CONTROL_DEADLINE_MISSED does not happen anymore but when i did the position control sometimes it outputs ERROR_OVER_SPEED along with ERROR_CONTROL_DEADLINE_MISSED. To overcome this i have made vel_limit_tolerance zero and it does not outputs this error anymore. But now ERROR_CURRENT_SENSE_SATURATION is happening very often.

My controller config is:

control_mode = 3 (int)
pos_gain = 24.5 (float)
vel_gain = 0.0017000000225380063 (float)
vel_integrator_gain = 0.0027000000700354576 (float)
vel_limit = 75000.0 (float)
vel_limit_tolerance = 0.0 (float)
vel_ramp_rate = 10000.0 (float)
setpoints_in_cpr = True (bool)

My motor config is:

pre_calibrated = True (bool)
pole_pairs = 227 (int)
calibration_current = 50.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 7.059957169985864e-06 (float)
phase_resistance = 0.022711167111992836 (float)
direction = -1 (int)
motor_type = 0 (int)
current_lim = 60.0 (float)
inverter_temp_limit_lower = 100.0 (float)
inverter_temp_limit_upper = 120.0 (float)
requested_current_range = 100.0 (float)
current_control_bandwidth = 1000.0 (float)

Also i tried to change vel_integrator_gain in order to tune it but can’t find much relevant.
I checked the phase B phase C currents. This is the graph:

Blue one is for phase B and orange one is for phase C.
When i did continuous position increment, after some cycles the leg (motor) started rotating in the opposite direction abruptly for few seconds and after that it outputs the ERROR_CURRENT_SENSE_SATURATION (0x400).

This is my motot.current_control:

p_gain = 0.00705995736643672 (float)
i_gain = 22.71116828918457 (float)
v_current_control_integral_d = 0.0 (float)
v_current_control_integral_q = 0.0 (float)
Ibus = 0.0 (float)
final_v_alpha = 0.0 (float)
final_v_beta = 0.0 (float)
Iq_setpoint = 0.0 (float)
Iq_measured = 0.0 (float)
Id_measured = 0.0 (float)
I_measured_report_filter_k = 1.0 (float)
max_allowed_current = 121.5 (float)
overcurrent_trip_level = 135.0 (float)

These are my issues and queries:

  1. What is the reason behind ERROR_CONTROL_DEADLINE_MISSED and ERROR_OVER_SPEED ?

  2. My phase B and phase C currents are lower than overcurrent_trip_level and mac_allowed_current, still i am getting ERROR_CURRENT_SENSE_SATURATION. What does these parameters mean?

  3. How to tune vel_integrator_gain for variable loading and to lower the vibrations?

That is likely encoder slip. Can you check the physical mounting and the wiring of your encoder?

@madcowswe thanks for the reply. This problem has been resolved now.
Previously i was using AS5047P ABI magnetic rotary encoder. So may be there was slipping of magnet but now i am using optical encoders and there is no slipping and it is working fine.

Still i am curious to know the cause of the above errors i.e, ERROR_CURRENT_SENSE_SATURATION and ERROR_ CONTROL_DEADLINE_MISSED. Can you help me so that i can find this in the firmware as well. Thanks.

@madcowswe hello sir .
Previously i was using magnetic encoders which might had not worked because of magnet slipping but currently i am using optical rotary encoders by making sure that there is no slipping between encoders and motors. But still on applying variable load, it again dumped 0x10 error in motor i.e, ERROR_CONTROL_DEADLINE_MISSED. I had flashed devel branch as you have said. Please figure it out as soon as possible. Out of 10 times this error is dumped every 3 times.