Problem in Sensorless Mode

Hi together!

i am trying to get my motor (335kv 10 pole) to run in sensorless mode. The motor stops rotating after a few revolutions. The motor should spin with constant velocity.

My code:

odrv0.config.brake_resistance = 2

odrv0.axis1.motor.config.pole_pairs = 5
odrv0.axis1.motor.config.current_lim = 3
odrv0.axis1.controller.config.vel_limit =30000
odrv0.axis1.motor.config.calibration_current = 2
odrv0.axis1.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT

odrv0.axis1.controller.config.vel_gain = 0.01
odrv0.axis1.controller.config.vel_integrator_gain = 0.05
odrv0.axis1.controller.config.control_mode = 2
odrv0.axis1.sensorless_estimator.config.pm_flux_linkage = 5.51328895422 / (5 * 335)
odrv0.axis1.motor.config.direction = 1

odrv0.axis1.motor.config.current_lim = 2 * odrv0.axis0.config.sensorless_ramp.current

odrv0.save_configuration()
odrv0.reboot()

odrv0.axis1.requested_state = AXIS_STATE_MOTOR_CALIBRATION

odrv0.axis1.controller.input_vel = 400
odrv0.axis1.requested_state = AXIS_STATE_SENSORLESS_CONTROL

Error:

axis1
axis: Error(s):
AXIS_ERROR_MOTOR_FAILED
motor: Error(s):
MOTOR_ERROR_CURRENT_LIMIT_VIOLATION
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error

Did i missed something?
Thanks
Jannis

Is ist possible to adjust the velocity ramp and the speed the foc is used?

Thanks
Jannis

Hi together,
the motor is now doing 110 Hz, but at 120 Hz, still the same error.
Any ideas?

code:

odrv0.axis0.motor.config.pole_pairs = 5
odrv0.axis0.motor.config.current_lim = 6
odrv0.axis0.controller.config.vel_limit = 220
odrv0.axis0.motor.config.calibration_current = 4
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT

odrv0.axis0.controller.config.vel_ramp_rate = 0.0001
odrv0.axis0.controller.config.vel_gain = 0.01
odrv0.axis0.controller.config.vel_integrator_gain = 0.01
odrv0.axis0.controller.config.control_mode = 2
odrv0.axis0.sensorless_estimator.config.pm_flux_linkage = 5.51328895422 / (5 * 335)
odrv0.axis0.motor.config.direction = 1

odrv0.axis0.motor.config.current_lim = 2 * odrv0.axis0.config.sensorless_ramp.current

odrv0.save_configuration()
odrv0.reboot()

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION

odrv0.axis0.controller.input_vel = 200
odrv0.axis0.requested_state = AXIS_STATE_SENSORLESS_CONTROL

Thanks!

Do you have any video or recorded data perhaps?

Hi togther,
i have still the same error. I put the current limit to 20A ( and don´t overwrite it later). 100 Hz is no problem and sounds good (1.3 A!). At 120 Hz the motor switch off immediately. After switsching off the USB connection is lost.
The following error occurs after replugging:

In [53]: dump_errors(odrv0)
axis0
axis: Error(s):
AXIS_ERROR_MOTOR_FAILED
motor: Error(s):
MOTOR_ERROR_CURRENT_LIMIT_VIOLATION
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error

Is ther a speed limit for sensorless mode?
Are there other current limit?

more data running at 50 Hz:

In [14]: odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION

In [15]: odrv0.axis0.controller.input_vel = 50

In [16]: odrv0.axis0.requested_state = AXIS_STATE_SENSORLESS_CONTROL

In [17]: odrv0.axis0
Out[17]:
error = 0x0000 (int)
step_dir_active = False (bool)
current_state = 5 (int)
requested_state = 0 (int)
loop_counter = 426986 (int)
lockin_state = 0 (int)
is_homed = False (bool)
config:
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)
startup_homing = False (bool)
enable_step_dir = False (bool)
step_dir_always_on = False (bool)
turns_per_step = 0.0009765625 (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_node_id_extended = False (bool)
can_heartbeat_rate_ms = 100 (int)
fet_thermistor:
error = 0x0000 (int)
temperature = 30.11614227294922 (float)
config: …
motor_thermistor:
error = 0x0000 (int)
temperature = 0.0 (float)
config: …
motor:
error = 0x0000 (int)
armed_state = 3 (int)
is_calibrated = True (bool)
current_meas_phB = 0.7711542844772339 (float)
current_meas_phC = -1.0513683557510376 (float)
DC_calib_phB = 0.47744518518447876 (float)
DC_calib_phC = 0.36651161313056946 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
effective_current_lim = 20.0 (float)
current_control: …
gate_driver: …
timing_log: …
config: …
controller:
error = 0x0000 (int)
input_pos = 0.0 (float)
input_vel = 50.0 (float)
input_torque = 0.0 (float)
pos_setpoint = 0.0 (float)
vel_setpoint = 50.0 (float)
torque_setpoint = 0.0 (float)
trajectory_done = True (bool)
vel_integrator_torque = 0.0487302765250206 (float)
anticogging_valid = False (bool)
config: …
move_incremental(displacement: float, from_input_pos: bool)
start_anticogging_calibration()
encoder:
error = 0x0000 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 0 (int)
count_in_cpr = 0 (int)
interpolation = 0.5 (float)
phase = 0.0019173622131347656 (float)
pos_estimate = 0.0 (float)
pos_estimate_counts = 0.0 (float)
pos_cpr = 0.0 (float)
pos_cpr_counts = 0.0 (float)
pos_circular = 0.0 (float)
hall_state = 7 (int)
vel_estimate = 0.0 (float)
vel_estimate_counts = 0.0 (float)
calib_scan_response = 0.0 (float)
pos_abs = 0 (int)
spi_error_rate = 0.0 (float)
config: …
set_linear_count(count: int)
sensorless_estimator:
error = 0x0000 (int)
phase = 1.3539940118789673 (float)
pll_pos = 1.9358432292938232 (float)
vel_estimate = 49.94762420654297 (float)
config: …
trap_traj:

Thanks!
Jannis

The motor should be good to about 600hz electrical. At 120hz mechanical * 5 pole pairs, you’re at exactly 600Hz electrical, oddly enough. That is the limit that we expect from ODrive v3.

1 Like

I’m struggling with Sensorless too.

If I use the samples posted above I can get the motor spinning, but the speed appears independant of odrv0.axis0.controller.input_vel = 0 - stopped
odrv0.axis0.controller.input_vel = 10 - runs
odrv0.axis0.controller.input_vel = 20 - runs as 10
odrv0.axis0.controller.input_vel = 200 - runs as 10
odrv0.axis0.controller.input_vel = 3000 - runs as 10

(using a J-drone motor that I think has 3 poles, 850KV - 3.6 board and the latest firmware)

Hi Roland,

What do you have you velocity limit set to?

Is 600 Hz the limit of sensorless mode or in general?

Thanks
Jannis

It’s the limit in general, due to the design of V3

Interesting - I didn’t know that. What is driving this limit?

It’s because we only have two current shunts and the 3rd phase is calculated. Unfortunately we can only sample the shunts during certain phases of motor commutation, which means there is a bit of a “dead band” where we can only measure one shunt and not both. This has pretty significant effects on the drive’s ability to compensate. v4 will not have this problem :slight_smile: