BLDC Hub motor is not running with oDrive Controller

I am trying to run 2 12inch BLDC 36v hub motors bought from eBay following the Hoover guide instructions but it is not working. Can anyone help?

Can you describe what you are doing and how it is not working?
What do you get from the dump_errors(odrv0) command?

In [2]: dump_errors(odrv0)
system: no error
axis0
  axis: Error(s):
    AXIS_ERROR_INVALID_STATE
  motor: no error
  sensorless_estimator: no error
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: no error
  sensorless_estimator: no error
  encoder: no error
  controller: no error
In [15]: odrv0.axis0.motor
Out[15]: 
DC_calib_phA: 1.1326559782028198 (float)
DC_calib_phB: -0.3369083106517792 (float)
DC_calib_phC: -0.795839250087738 (float)
I_bus: 0.0 (float)
config:
  I_bus_hard_max: inf (float)
  I_bus_hard_min: -inf (float)
  I_leak_max: 0.10000000149011612 (float)
  R_wL_FF_enable: False (bool)
  acim_autoflux_attack_gain: 10.0 (float)
  acim_autoflux_decay_gain: 1.0 (float)
  acim_autoflux_enable: False (bool)
  acim_autoflux_min_Id: 10.0 (float)
  acim_gain_min_flux: 10.0 (float)
  bEMF_FF_enable: False (bool)
  calibration_current: 10.0 (float)
  current_control_bandwidth: 100.0 (float)
  current_lim: 10.0 (float)
  current_lim_margin: 8.0 (float)
  dc_calib_tau: 0.20000000298023224 (float)
  inverter_temp_limit_lower: 100.0 (float)
  inverter_temp_limit_upper: 120.0 (float)
  motor_type: 0 (uint8)
  phase_inductance: 0.0 (float)
  phase_resistance: 0.0 (float)
  pole_pairs: 15 (int32)
  pre_calibrated: False (bool)
  requested_current_range: 25.0 (float)
  resistance_calib_max_voltage: 4.0 (float)
  torque_constant: 8.270000457763672 (float)
  torque_lim: inf (float)
current_control:
  I_measured_report_filter_k: 1.0 (float)
  Ialpha_measured: 0.0 (float)
  Ibeta_measured: 0.0 (float)
  Id_measured: 0.0 (float)
  Id_setpoint: 0.0 (float)
  Iq_measured: 0.0 (float)
  Iq_setpoint: 0.0 (float)
  Vd_setpoint: 0.0 (float)
  Vq_setpoint: 0.0 (float)
  final_v_alpha: 0.0 (float)
  final_v_beta: 0.0 (float)
  i_gain: nan (float)
  p_gain: 0.0 (float)
  phase: 0.0 (float)
  phase_vel: 0.0 (float)
  power: 0.0 (float)
  v_current_control_integral_d: 0.0 (float)
  v_current_control_integral_q: 0.0 (float)
current_meas_phA: -1.1311670541763306 (float)
current_meas_phB: 0.33566075563430786 (float)
current_meas_phC: 0.7952427268028259 (float)
effective_current_lim: 10.0 (float)
error: 0 (uint64)
fet_thermistor:
  config: ...
  temperature: 30.922367095947266 (float)
is_armed: False (bool)
is_calibrated: False (bool)
last_error_time: 0.0 (float)
max_allowed_current: 30.375 (float)
max_dc_calib: 3.0375001430511475 (float)
motor_thermistor:
  config: ...
  temperature: 0.0 (float)
n_evt_current_measurement: 237453 (uint32)
n_evt_pwm_update: 237461 (uint32)
phase_current_rev_gain: 0.012500000186264515 (float)
Connected to ODrive 2062356E5748 as odrv0
In [1]: odrv0.axis0.requested_state=AXIS_STATE_MOTOR_CALIBRATION

Oh no odrv0 disappeared
In [2]: 02:42:56.858982035 [LEGACY_OBJ] JSON read operation failed
1 Like
Connected to ODrive 2062356E5748 as odrv0
In [1]: odrv0.axis0.requested_state=AXIS_STATE_MOTOR_CALIBRATION

Oh no odrv0 disappeared
In [2]: 03:11:29.346667296 [LEGACY_OBJ] JSON read operation failed
03:11:30.376414478 [USB] Could not claim interface  on USB device: -6
03:11:32.712068645 [USB] Could not claim interface  on USB device: -6
Reconnected to ODrive 2062356E5748 as odrv0

I am using a USB3 hub connected with the Jetson AGX Xavier

These are the output from the encoder settings

n [33]: odrv0.axis0.encoder
Out[33]: 
calib_scan_response: 0.0 (float)
config:
  abs_spi_cs_gpio_pin: 1 (uint16)
  bandwidth: 100.0 (float)
  calib_range: 0.019999999552965164 (float)
  calib_scan_distance: 150.0 (float)
  calib_scan_omega: 12.566370964050293 (float)
  cpr: 90 (int32)
  direction: 0 (int32)
  enable_phase_interpolation: True (bool)
  find_idx_on_lockin_only: False (bool)
  hall_polarity: 0 (uint8)
  hall_polarity_calibrated: False (bool)
  ignore_illegal_hall_state: False (bool
index_offset: 0.0 (float)
  mode: 1 (uint16)
  phase_offset: 0 (int32)
  phase_offset_float: 0.0 (float)
  pre_calibrated: False (bool)
  sincos_gpio_pin_cos: 4 (uint16)
  sincos_gpio_pin_sin: 3 (uint16)
  use_index: False (bool)
  use_index_offset: True (bool)
count_in_cpr: 0 (int32)
delta_pos_cpr_counts: 0.0 (float)
error: 0 (uint16)
hall_state: 6 (uint8)
index_found: False (bool)
interpolation: 0.5 (float)
is_ready: False (bool)
phase: 0.0 (float)
pos_abs: 0 (int32)
pos_circular: 0.0 (float)
pos_cpr_counts: 0.0 (float)
pos_estimate: 0.0 (float)
pos_estimate_counts: 0.0 (float)
set_linear_count(obj: object_ref, count: int32)
shadow_count: 0 (int32)
spi_error_rate: 0.0 (float)
vel_estimate: 0.0 (float)
vel_estimate_counts: 0.0 (fl
error: 0 (uint16)
hall_state: 6 (uint8)
index_found: False (bool)
interpolation: 0.5 (float)
is_ready: False (bool)
phase: 0.0 (float)
pos_abs: 0 (int32)
pos_circular: 0.0 (float)
pos_cpr_counts: 0.0 (float)
pos_estimate: 0.0 (float)
pos_estimate_counts: 0.0 (float)
set_linear_count(obj: object_ref, count: int32)
shadow_count: 0 (int32)
spi_error_rate: 0.0 (float)
vel_estimate: 0.0 (float)
vel_estimate_counts: 0.0 (float)

I am trying to run and control this motors using ROS. I used the Hoover configuration guide to set the required settings but it is failing and I can see dump_errors and also when I set motor calibration the controller is disappear. Then I have to power cycle the controller to get connected again.

odrv0.axis0.requested_state=AXIS_STATE_MOTOR_CALIBRATION

Oh no odrv0 disappeared

Ok, so you have USB comms issues. This is nothing to do with software, it’s a hardware problem (electrical noise)
Have you tried using the ferrite rings from the shop?

No, I did not buy them when I bought the controller. I am also getting encoder errors 528

odrv0.axis0.encoder.error

The general Hoover motor is 6.5 inch but my hub motor with the wheel is 12 inches each, do I need different configuration parameters like pole_pairs, encoder.cpr, bandwidth or else? Can you help me with any suggestions?

Do I need any external encoders for the motor, the has encoder with halls? Can you suggest any brushless motors work well with the controller? I am looking for a motor with a wheel which is larger than 10 inches.

Pole pairs might be higher with a larger diameter motor. You can check by putting two of the phases across a bench power supply set to current limit at an amp or two, and turn it by hand, counting the ‘detent’ bumps.

Hall sensors are fine for velocity control, but for more precise control you might need an encoder.

I’d say Stick with what you have for now - it’s hard to find wheel motors with built in high resolution encoders, for any reasonable price, but you might be able to attach some external encoders if you do need them later on.

I don’t have the right equipment to get the ‘detent’. Is there any service provider who can do it for me? Can you help me to figure it out for a service fee? @towen

Did you try this: Getting Started | ODrive

Connected to ODrive 2062356E5748 as odrv0
In [1]: odrv0.axis0.motor.error
Out[1]: 0

In [2]: odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION^M
…:

In [3]: odrv0.axis0.motor.config.pre_calibrated = True^M
…:

In [4]: odrv0.save_configuration()
Oh no odrv0 disappeared

Reconnected to ODrive 2062356E5748 as odrv0
In [5]: odrv0.axis0.requested_state = AXIS_STATE_ENCODER_HALL_POLARITY_CALIBRATION^M
…:

In [6]: odrv0.axis0.encoder.error
Out[6]: 16

In [7]: odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION^M
…:

In [8]: odrv0.axis0.encoder.error
Out[8]: 528

In [9]:

This is my configuration after changing the Pole pairs to 20 according to the Motor but still the motor does not move. @towen

odrv0.axis0.motor.config.pole_pairs = 20

odrv0.axis0.motor.config.resistance_calib_max_voltage = 4
odrv0.axis0.motor.config.requested_current_range = 25
odrv0.axis0.motor.config.current_control_bandwidth = 100
odrv0.axis0.motor.config.torque_constant = 8.27 / 27.7
odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 120
odrv0.axis0.encoder.config.calib_scan_distance = 200
!
odrv0.axis0.encoder.config.bandwidth = 100
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.controller.config.vel_gain = 0.02 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_integrator_gain = 0.1 * odrv0.axis0.motor.config.torque_constant * odrv0.axis0.encoder.config.cpr
odrv0.axis0.controller.config.vel_limit = 36
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL

after changing pole_pairs, you must run odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
before you can set axis_state=AXIS_STATE_CLOSED_LOOP_CONTROL

Also, make sure to use dump_errors(odrv0, True) before and after - this shows active errors and then clears them.

Hi @towen I put that command but right after that I lost the communication from my Ubuntu laptop to the controller connected via the USB cable it came with it. I had to power recycle the controller to login again.

Reconnected to ODrive 2062356E5748 as odrv0
In [3]: odrv0.axis0.motor.config.pole_pairs = 20

In [4]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

Oh no odrv0 disappeared

After reconnected though I did not power recycle yet

In [1]: odrv0.axis0.requested_state
Out[1]: 0

In [2]: odrv0.axis0.motor.config.pole_pairs
Out[2]: 20

In [3]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

Oh no odrv0 disappeared
Reconnected to ODrive 2062356E5748 as odrv0
In [4]: odrv0.axis0.requested_state
Out[4]: 0

In [5]: odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE

Oh no odrv0 disappeared
In [6]: 23:17:39.881339498 [LEGACY_PROTOCOL] received unexpected ACK: 419

After a hard reset I got the following

eclbd@eclbd-laptop:~$ odrivetool
ODrive control utility v0.5.3.post0
Website: https://odriverobotics.com/
Docs: https://docs.odriverobotics.com/
Forums: https://discourse.odriverobotics.com/
Discord: ODrive
Github: GitHub - odriverobotics/ODrive: High performance motor control

Please connect your ODrive.
You can also type help() or quit().

Connected to ODrive 2062356E5748 as odrv0
In [1]: odrv0.axis0.requested_state
Out[1]: 0

In [2]: odrv0.axis0.motor.config.pole_pairs
Out[2]: 7

Connected to ODrive 2062356E5748 as odrv0
In [1]: dump_errors(odrv0, True)
system: no error
axis0
axis: no error
motor: no error
sensorless_estimator: no error
encoder: Error(s):
ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH
controller: no error
axis1
axis: no error
motor: no error
sensorless_estimator: no error
encoder: no error
controller: no error