Current saturation below motor.config.current_lim

Hello, I’m using the 24V ODrive v3.5 to power a T-Motor U3 KV700. I just went through the getting started guide, tuned the position controller, and am going through the rest of the documentation to see how things work.

One of the first things I tried was increasing motor.config.current_lim to see how much I could push the system (still keeping it in position control but applying a disturbance and checking the applied current). When I set motor.config.current_lim any higher than the default 10A (right now I’m trying 20A) and apply a disturbance, the current (both in Iq_measured and Iq_setpoint) saturates at 11.5 (11.500000953674316) or -12.5 (-12.537500381469727) depending on the direction I apply a disturbance. I’ve looked around in the documentation to see what else might be causing this but haven’t found anything. My power supply isn’t saturating either. Anyone know what I’m missing?

Controller settings in odrv0.axis0.controller:

error = 0x0000 (int)
pos_setpoint = -21.984375 (float)
vel_setpoint = 0.0 (float)
vel_integrator_current = 0.0 (float)
current_setpoint = 0.5 (float)
vel_ramp_target = 0.0 (float)
vel_ramp_enable = False (bool)
config:
control_mode = 3 (int)
pos_gain = 50.0 (float)
vel_gain = 0.0003000000142492354 (float)
vel_integrator_gain = 0.0 (float)
vel_limit = 40000.0 (float)
vel_limit_tolerance = 0.0 (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)
start_anticogging_calibration()

Motor settings in odrv0.axis0.motor:

error = 0x0000 (int)
armed_state = 3 (int)
is_calibrated = True (bool)
current_meas_phB = -0.2519184350967407 (float)
current_meas_phC = 0.2588951587677002 (float)
DC_calib_phB = -1.4805927276611328 (float)
DC_calib_phC = -2.272979974746704 (float)
phase_current_rev_gain = 0.02500000037252903 (float)
current_control:
p_gain = 0.02000526711344719 (float)
i_gain = 103.69937896728516 (float)
v_current_control_integral_d = -0.011798991821706295 (float)
v_current_control_integral_q = 0.0824267566204071 (float)
Ibus = 0.0017087971791625023 (float)
final_v_alpha = 0.014038833789527416 (float)
final_v_beta = -0.05565432086586952 (float)
Iq_setpoint = -0.12379783391952515 (float)
Iq_measured = 0.11780458688735962 (float)
max_allowed_current = 60.75 (float)
overcurrent_trip_level = 67.5 (float)
config:
pre_calibrated = True (bool)
pole_pairs = 7 (int)
calibration_current = 5.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 2.0005267288070172e-05 (float)
phase_resistance = 0.10369938611984253 (float)
direction = -1 (int)
motor_type = 0 (int)
current_lim = 25.0 (float)
requested_current_range = 60.0 (float)
current_control_bandwidth = 1000.0 (float)

Start by setting the current_setpoint = 0. That should give you +/- 12A instead of the +11.5 / - 12.5 you have now.

And then you will want to set vel_integrator_gain > 0.0.

Let me know if it continues to saturate after that.

Changing current_setpoint does center the applied torque, and setting vel_integrator_gain = 0.001 produces torques up to 20 A, which is great. Seems the saturation is related to the controller (and specifically the proportional term)? Any ideas where this is set?

I suspect what’s happening is your vel_gain and vel_integrator_gain are too low, so your controller is ending up in a strange quasi-steady-state that’s preventing it from applying full current.

  1. Put the controller in Current Control mode, and make sure it works well (you’ll want to put a stick or something on it so you can easily apply a load and stop it from running away)
  2. Put the controller in velocity control mode, and tune your vel_gain and vel_integrator_gain so that it tracks a velocity setpoint quickly but without significant overshoot.
  3. Put the controller in position control mode, and tune the pos_gain so it tracks the position well.

We use a Cascade controller, so you always want to tune from the inside out.

1 Like