Velocity control mode only works for a couple seconds

Hello. I was working on Odrive Arduino interface and I ran into a problem in velocity control: The motor stops after running for a couple seconds. Usually, if the velocity counts is really high, like 100000 counts, motor only runs for 3-5 seconds; it runs a little longer if speed is lower, but will eventually stop.

This problem also exist when I run velocity_control_mode in Anaconda Prompt. There is no error at all. Could someone help me solve this issue? Thank you

No error? So using dump_errors(odrv0) shows nothing?

Yes. It shows no error

In [2]: dump_errors(odrv0)
axis: no error
motor: no error
encoder: no error
controller: no error
axis: no error
motor: no error
encoder: no error
controller: no error

This also happens in current control. The motor runs and stops, no error. I still cannot find the reason.

Could someone help me on this issue? I really appreciate it. My settings are below:

Controller Setting: odrv0.axis0.controller:
error = 0x0000 (int)
pos_setpoint = -19016.236328125 (float)
vel_setpoint = 20150.0 (float)
vel_integrator_current = 5.012912750244141 (float)
current_setpoint = 0.0 (float)
vel_ramp_target = 0.0 (float)
vel_ramp_enable = False (bool)
control_mode = 2 (int)
pos_gain = 1.0 (float)
vel_gain = 0.0005000000237487257 (float)
vel_integrator_gain = 0.05000000074505806 (float)
vel_limit = 5000000.0 (float)
vel_limit_tolerance = 1.2000000476837158 (float)
vel_ramp_rate = 10000.0 (float)
setpoints_in_cpr = False (bool)
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)

motor setting: odrv0.axis0.motor
error = 0x0000 (int)
armed_state = 0 (int)
is_calibrated = True (bool)
current_meas_phB = -0.023738503456115723 (float)
current_meas_phC = -0.06381690502166748 (float)
DC_calib_phB = -1.5674428939819336 (float)
DC_calib_phC = -1.3259977102279663 (float)
phase_current_rev_gain = 0.012500000186264515 (float)
p_gain = 0.0015777726657688618 (float)
i_gain = 4.2501068115234375 (float)
v_current_control_integral_d = -0.033692196011543274 (float)
v_current_control_integral_q = -0.6311197876930237 (float)
Ibus = 0.6719387769699097 (float)
final_v_alpha = -0.03591299429535866 (float)
final_v_beta = -0.6310408115386963 (float)
Iq_setpoint = -15.0 (float)
Iq_measured = -14.948433876037598 (float)
max_allowed_current = 30.375 (float)
overcurrent_trip_level = 33.75 (float)
drv_fault = 0 (int)
TIMING_LOG_ADC_CB_I = 2670 (int)
TIMING_LOG_ADC_CB_DC = 13078 (int)
TIMING_LOG_MEAS_R = 7462 (int)
TIMING_LOG_MEAS_L = 7446 (int)
pre_calibrated = True (bool)
pole_pairs = 7 (int)
calibration_current = 10.0 (float)
resistance_calib_max_voltage = 4.0 (float)
phase_inductance = 1.5777726730448194e-05 (float)
phase_resistance = 0.042501069605350494 (float)
direction = -1 (int)
motor_type = 0 (int)
current_lim = 15.0 (float)
requested_current_range = 25.0 (float)
current_control_bandwidth = 100.0 (float)

It is weird you’re not getting any errors when the motor stops after running for a while.
maybe try this in odrivetool console and see if either shadow_count jumps or stops changing.

start_liveplotter(lambda:[odrv0.axis0.encoder.vel_estimate, odrv0.axis0.encoder.shadow_count])

Also I think if you provide more information about the motor and the encoder you are using (maybe picture of your setup) then someone might be able to help.

Old thread but @KEVIN_HAN did you ever figure this out? I’m running into a similar problem with a 10.5" scooter motor, 15 pole pairs, external encoder. I can get position and trapezoidal moves working flawlessly and smoothly forever, but velocity and ramp velocity yield at best a second or two of motion. Shadow_count seems to reflect movement. vel_estimate, though, seems to be flatlined, but that may just be a scale problem in this chart; I did see numbers from a print statement. On the chart below you see the beginning of a smooth motion and then it just sort of peters out.

I’ll try to upload some of the other values as soon as I can. Sorry for the uninformative chart, I use a mac so I had to prepare a VM in order to use the live plotter and I’m just learning to use it.