Odrive does not execute position or velocity commands

Hello!
I am new to Odrive, and so the mistake i am making might be very stupid, but I hope some of you can help me fix it.

I am running an Odrive v3.5, with v0.5.3 driver. Currently i am trying to control the motor through the odrivetool running on an RPi, with a USB connection to the Odrive board.

The two following commands issues the “beep” and then causes the motors to turn in one direction

odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.axis0.requested_state = CONTROL_MODE_POSITION_CONTROL

However, from the Odrive getting started documentation i can understand that the motors should turn both directions.
If i run the following commands, nothing happens, regardless of changing control mode.

odrv0.axis0.controller.input_pos = 2
odrv0.axis0.controller.input_vel = 2

The motors are powered by a 17V 5A Tabletop power supply, and when the motors start turning during calibration sequence, it only draws 1A, so i am confident, that it is not a power problem.

Below is the config of my motor and controller along with the output of dump_errors from odrivetool.
I have tried to post as much information as i thought was relevant, but being green in the field might mean that i have left something out, please let me know, and i will try and find it asap.

The config of my odrv0.axis0

In [19]: odrv0.axis0.controller.config
Out[19]:
anticogging:
anticogging_enabled: True (bool)
calib_anticogging: False (bool)
calib_pos_threshold: 1.0 (float)
calib_vel_threshold: 1.0 (float)
cogging_ratio: 1.0 (float)
index: 0 (uint32)
pre_calibrated: False (bool)
axis_to_mirror: 255 (uint8)
circular_setpoint_range: 1.0 (float)
circular_setpoints: False (bool)
control_mode: 3 (uint8)
electrical_power_bandwidth: 20.0 (float)
enable_gain_scheduling: False (bool)
enable_overspeed_error: True (bool)
enable_torque_mode_vel_limit: True (bool)
enable_vel_limit: True (bool)
gain_scheduling_width: 10.0 (float)
homing_speed: 0.25 (float)
inertia: 0.0 (float)
input_filter_bandwidth: 2.0 (float)
input_mode: 1 (uint8)
load_encoder_axis: 0 (uint8)
mechanical_power_bandwidth: 20.0 (float)
mirror_ratio: 1.0 (float)
pos_gain: 20.0 (float)
spinout_electrical_power_threshold: 10.0 (float)
spinout_mechanical_power_threshold: -10.0 (float)
steps_per_circular_range: 1024 (int32)
torque_mirror_ratio: 0.0 (float)
torque_ramp_rate: 0.009999999776482582 (float)
vel_gain: 0.1666666716337204 (float)
vel_integrator_gain: 0.3333333432674408 (float)
vel_limit: 3.0 (float)
vel_limit_tolerance: 1.2000000476837158 (float)
vel_ramp_rate: 1.0 (float)

odrv0.motor.config

In [25]: odrv0.axis0.motor.config
Out[25]:
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: 5.0 (float)
current_control_bandwidth: 1000.0 (float)
current_lim: 5.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.0007919398485682905 (float)
phase_resistance: 0.3521248400211334 (float)
pole_pairs: 7 (int32)
pre_calibrated: False (bool)
requested_current_range: 60.0 (float)
resistance_calib_max_voltage: 2.0 (float)
torque_constant: 0.03999999910593033 (float)
torque_lim: inf (float)

Errors dumped by Odrivetool

In [23]: dump_errors(odrv0)
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

Here is your problem.
What motor and encoder are you using?

I will be back at the lab tomorrow and have a look. Meanwhile, i have been notified that the current is usually around 10A during the calibration sequence, so i will be giving it some juice tomorrow too, and then hopefully that will also fix something.

Will also look into solutions for the polepairs mismatch

I think you have been notified wrongly about the calibration current. 1A (17W) sounds about right for the current at the PSU if you have 5A in the motor. There is always more current (averaged over time) in the motor windings than is drawn from the DC bus, because the PWM never reaches 100%, especially when the motor is not moving very fast.

You could try increasing that to 10A, which might be what your adviser meant. You’ll probably see about 3A on the power supply.

Otherwise, it’s likely that either your encoder CPR or your motor pole_pairs are configured incorrectly.

1 Like

Found some documentation on the motors and that fixed the pole pairs mismatch error. You were also correct that I was not lacking power to run the calibration. Thank you for your responses!

1 Like