In the manual, position control is described with a CUI AMT encoder but speed control with a Hall encoder.
Is there anything against using a CUI for speed control? If not, how do I configure it?
I have a D5065-270KV motor from ODrive, and a CUI AMT encoder set to 500ppr (= 2000cpr).
I have calibrated successfully and position control works fine.
However in speed control, nothing happens, so when I do:
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis0.controller.input_vel = 1
Odrive simply doesn’t react at all. (my max velocity is set to 2)
I received no answers, but maybe someone can tell me where on Github the C++ code of velocity control firmware is stored. It would help me to understand why the odrive doesn’t react to a velocity command, while not coming back with an error.
Higher resolution is better for velocity control. CUI encoder is going to be better than the halls for this.
Maybe try increasing your vel_gain
and make the vel_integrator_gain
non-zero.
I now tried sensorless control according to the manual:
odrv0.axis0.config.sensorless_ramp.vel = 160
odrv0.axis0.config.sensorless_ramp.accel = 16
odrv0.axis0.controller.config.vel_gain = 0.01
odrv0.axis0.controller.config.vel_integrator_gain = 0.05
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis0.controller.config.vel_limit = 1.2 * odrv0.axis0.config.sensorless_ramp.vel / (2 * 3.1416 * odrv0.axis0.motor.config.pole_pairs)
odrv0.axis0.motor.config.current_lim = 2 * odrv0.axis0.config.sensorless_ramp.current
odrv0.axis0.sensorless_estimator.config.pm_flux_linkage = 5.51328895422 / (odrv0.axis0.motor.config.pole_pairs * MOTOR_KV)
odrv0.axis0.config.enable_sensorless_mode = True
odrv0.axis0.config.enable_sensorless_mode = True
odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
then:
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
the motor now rotates fine but oDrive still ignores the odrv0.axis0.controller.input_vel = … command, so I can’t change the speed while the motor is spinning.
Is that normal?