Closed loop velocity control issue

In every control mode it is working good, in Toque control , position control and velocity control when I give the commands like axis>.controller.input_pos =
.controller.input_vel = <turn/s>
.controller.input_torque =

but in Velocity control it is behaving like position control which it should not happen . It is not moving freely when i keep it in Velocity control and without giving commands to run. It is coming back to the position when i rotate the anti gravity motor with the hand. I have plotted using live plotter start_liveplotter(lambda:[odrv0.axis0.encoder.vel_estimate, odrv0.axis0.controller.vel_setpoint])

you can check the config
controlller

gain_scheduling_width = 10.0 (float)
enable_vel_limit = True (bool)
enable_current_mode_vel_limit = True (bool)
enable_gain_scheduling = False (bool)
enable_overspeed_error = True (bool)
control_mode = 2 (int)
input_mode = 1 (int)
pos_gain = 138.0 (float)
vel_gain = 1.850000023841858 (float)
vel_integrator_gain = 9.25 (float)
vel_limit = 10000.0 (float)
vel_limit_tolerance = 1.2000000476837158 (float)
vel_ramp_rate = 1.0 (float)
torque_ramp_rate = 0.009999999776482582 (float)
circular_setpoints = False (bool)
circular_setpoint_range = 1.0 (float)
homing_speed = 0.25 (float)
inertia = 0.0 (float)
axis_to_mirror = 255 (int)
mirror_ratio = 1.0 (float)
load_encoder_axis = 0 (int)
input_filter_bandwidth = 2.0 (float)
anticogging:
index = 0 (int)
pre_calibrated = False (bool)
calib_anticogging = False (bool)
calib_pos_threshold = 1.0 (float)
calib_vel_threshold = 1.0 (float)
cogging_ratio = 1.0 (float)
anticogging_enabled = True (bool)

motor config
pre_calibrated = True (bool)
pole_pairs = 11 (int)
calibration_current = 10.0 (float)
resistance_calib_max_voltage = 2.0 (float)
phase_inductance = 2.1256775653455406e-05 (float)
phase_resistance = 0.04419001191854477 (float)
torque_constant = 1.0 (float)
direction = 1 (int)
motor_type = 0 (int)
current_lim = 10.0 (float)
current_lim_margin = 8.0 (float)
torque_lim = inf (float)
inverter_temp_limit_lower = 100.0 (float)
inverter_temp_limit_upper = 120.0 (float)
requested_current_range = 60.0 (float)
current_control_bandwidth = 1000.0 (float)
acim_slip_velocity = 14.706000328063965 (float)
acim_gain_min_flux = 10.0 (float)
acim_autoflux_min_Id = 10.0 (float)
acim_autoflux_enable = False (bool)
acim_autoflux_attack_gain = 10.0 (float)
acim_autoflux_decay_gain = 1.0 (float)

Please help , Thanks in advance :slight_smile:

This is normal and confusing.

In velocity control mode, vel_gain is a proportional gain: The faster it’s going, the harder it will push back.
vel_integrator_gain is an integrator: The faster it’s going, for longer, the harder it pushes back. Except velocity * time = position. So if your velocity measurement is good, it will actually integrate the error * time accurately, and when you let go of the motor and this “unwinds”, it ends up back at the same position.

You can put vel_integrator_gain = 0 to “fix” this

2 Likes

thanks for the help it worked!!

1 Like