Controller overspeed error

I have a board which is Odrive 3.6-24V and a Gimbal Motor GB54-2. I want to control this motor with AS5047P. My project requires the encoder to work in absolute state,so I git clone https://github.com/Wetmelon/ODrive.git . Then I flashed the firmware. After that , my motor works fine in incremental mode.But when I changed to absolute value mode,there were problems.
What did I do:

In [91]:  odrv0.axis0.config.startup_motor_calibration = True

In [92]:  odrv0.axis0.config.startup_encoder_index_search = False

In [93]: odrv0.axis0.config.startup_encoder_offset_calibration = True

In [94]:  odrv0.axis0.config.startup_closed_loop_control = True

In [95]: odrv0.axis0.config.startup_sensorless_control = True

In [96]:  odrv0.axis0.encoder.config.use_index =False

In [97]:  odrv0.axis0.encoder.config.cpr=16384

In [98]: odrv0.axis0.motor.config.pole_pairs = 7

In [99]: odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_GIMBAL

In [100]: odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 4

In [101]: odrv0.axis0.encoder.config.mode = 257

odrv0.axis0.motor.config.resistance_calib_max_voltage = 6

and this:

 In [51]: odrv0.axis0
Out[51]:
error = 0x0200 (int)
step_dir_active = False (bool)
current_state = 1 (int)
requested_state = 0 (int)
loop_counter = 850041 (int)
lockin_state = 0 (int)
is_homed = False (bool)
config:
  startup_motor_calibration = True (bool)
  startup_encoder_index_search = False (bool)
  startup_encoder_offset_calibration = True (bool)
  startup_closed_loop_control = True (bool)
  startup_sensorless_control = True (bool)
  startup_homing = False (bool)
  enable_step_dir = False (bool)
  counts_per_step = 2.0 (float)
  watchdog_timeout = 0.0 (float)
  enable_watchdog = False (bool)
  step_gpio_pin = 1 (int)
  dir_gpio_pin = 2 (int)
  calibration_lockin: ...
  sensorless_ramp: ...
  general_lockin: ...
  can_node_id = 0 (int)
  can_heartbeat_rate_ms = 100 (int)
motor:
  error = 0x0010 (int)
  armed_state = 0 (int)
  is_calibrated = True (bool)
  current_meas_phB = -0.04117631912231445 (float)
  current_meas_phC = 0.058704160153865814 (float)
  DC_calib_phB = -0.5227470993995667 (float)
  DC_calib_phC = 0.10237519443035126 (float)
  phase_current_rev_gain = 0.02500000037252903 (float)
  thermal_current_lim = 47.97045135498047 (float)
  get_inverter_temp()
  current_control: ...
  gate_driver: ...
  timing_log: ...
  config: ...
controller:
  error = 0x0001 (int)
  input_pos = 4078.015625 (float)
  input_vel = 0.0 (float)
  input_current = 0.0 (float)
  pos_setpoint = 4078.015625 (float)
  vel_setpoint = 0.0 (float)
  current_setpoint = 0.0 (float)
  trajectory_done = True (bool)
  vel_integrator_current = 0.015419754199683666 (float)
  anticogging_valid = False (bool)
  gain_scheduling_width = 10.0 (float)
  config: ...
  move_incremental(displacement: float, from_goal_point: bool)
  start_anticogging_calibration()
encoder:
  error = 0x0000 (int)
  is_ready = True (bool)
  index_found = False (bool)
  shadow_count = 3461 (int)
  count_in_cpr = 3463 (int)
  interpolation = 1.0 (float)
  phase = -1.575730323791504 (float)
  pos_estimate = 3463.453125 (float)
  pos_cpr = 3463.15625 (float)
  hall_state = 7 (int)
  vel_estimate = 125.0 (float)
  calib_scan_response = 18673.0 (float)
  pos_abs = 3464 (int)
  spi_error_rate = 0.0 (float)
  config: ...
  set_linear_count(count: int)
sensorless_estimator:
  error = 0x0000 (int)
  phase = 0.0 (float)
  pll_pos = 0.0 (float)
  vel_estimate = 0.0 (float)
  config: ...
trap_traj:
  config: ...
min_endstop:
  endstop_state = False (bool)
  config: ...
max_endstop:
  endstop_state = False (bool)
  config: ...
watchdog_feed()
clear_errors()

These are my settings,and then when I started , the motor could turn forward once and then reverse once. But when I wrote dump_errors(odrv0) , it showed that:

In [102]: dump_errors(odrv0)
axis0
  axis: Error(s):
    ERROR_CONTROLLER_FAILED
  motor: Error(s):
    ERROR_CONTROL_DEADLINE_MISSED
  encoder: no error
  controller: Error(s):
    ERROR_OVERSPEED
axis1
  axis: no error
  motor: no error
  encoder: no error
  controller: no error

So I browsed the forum for solutions to this problem and tried to solve it.
First I wrote this line,but it did not work:

odrv0.axis0.controller.config.vel_limit_tolerance = 0

Second I increased the odrv0.axis0.controller.config.vel_limit, and when I set the limit to 30000,The motor vibrated, but the error remained. I dare not increase it any more.
Third I gradually reduced the gain , but the error remained forever ,This is my final parameters :

In [88]: odrv0.axis0.controller.config.vel_integrator_gain
Out[88]: 0.0

In [89]: odrv0.axis0.controller.config.vel_gain
Out[89]: 9.999999747378752e-06

In [90]: odrv0.axis0.controller.config.pos_gain
Out[90]: 1.0

So , does anyone know what I should do? It is important for me and my project to resolve this error. Your help will be greatly appreciated.

The problem has been solved, thanks

1 Like

What did you do to fix it?

I just typed these codes:

odrv0.axis0.config.startup_motor_calibration = False
   odrv0.axis0.config.startup_encoder_index_search = False

   odrv0.axis0.config.startup_encoder_offset_calibration = False

   odrv0.axis0.config.startup_closed_loop_control = False

   odrv0.axis0.config.startup_sensorless_control = False

   odrv0.axis0.encoder.config.use_index = False

and I don’t know why.

1 Like

Tsouper,
because I am faced with the same problem and everything is running on your side - how did you set the variable ?odrv0.axis0.controller.config.enable_overspeed_error

thanks