I’m trying to drive a pair of 190KV BLDC motors with integrated hall sensors. I’ve gotten past motor and encoder calibration, but since I don’t really understand closed-loop motor control, I don’t really grok the tuning process.
With the values I currently have, when I set a target velocity, the motor (I can only run one at a time before hitting some current limit) takes ~30 seconds to start spinning, and then gradually pics up speed. Then when I try to set the velocity back to 0, nothing happens: the only way to stop it is to set its state from
Here’s my setup code:
def set_config(odrv): # Settings to protect battery odrv.config.dc_bus_overvoltage_trip_level = 24.7 odrv.config.dc_bus_undervoltage_trip_level = 19.2 odrv.config.brake_resistance = 0.5 for axis in [odrv.axis1, odrv.axis0]: axis.motor.config.current_lim = 45 axis.motor.config.pole_pairs = 7 axis.motor.config.resistance_calib_max_voltage = 4 axis.motor.config.requested_current_range = 90 #Requires config save and reboot axis.motor.config.current_control_bandwidth = 100 axis.encoder.config.mode = ENCODER_MODE_HALL axis.encoder.config.cpr = 45 axis.encoder.config.bandwidth = 100 # I think the issue is in these 3 lines? axis.controller.config.pos_gain = 1 axis.controller.config.vel_gain = 0.02 axis.controller.config.vel_integrator_gain = .1 axis.controller.config.vel_limit = 1000 axis.controller.config.control_mode = CTRL_MODE_VELOCITY_CONTROL
Can anyone give pointers on the tuning process? I looked through https://docs.odriverobotics.com/control.html, but still don’t understand + the issues listed there aren’t the same as what I’m see.