I tried to drive two motors with 24V v3.5 Odrive board,and encoder was mounted well.I had flashed firmware and entered below codes on Anaconda to set configuration:
odrv0.axis0.motor.config.current_lim=10
odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT
odrv0.axis0.motor.config.pole_pairs=11
odrv0.axis0.motor.config.calibration_current=10
odrv0.axis0.motor.config.direction = 1
odrv0.axis0.motor.config.calibration_current = 10.0
odrv0.axis0.motor.config.resistance_calib_max_voltage = 12.0odrv0.config.brake_resistance=0
odrv0.axis0.controller.config.vel_limit=50000
odrv0.axis0.controller.config.vel_gain = 0.01
odrv0.axis0.controller.config.vel_integrator_gain = 0.05
odrv0.axis0.controller.config.control_mode = 2
odrv0.axis0.controller.vel_setpoint = 400
odrv0.axis0.controller.config.kp_theta = 0.04 * 6000 / (2 * 3.1415926)
odrv0.axis0.controller.config.kd_theta = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)
odrv0.axis0.controller.config.kp_gamma = 0.0 * 6000 / (2 * 3.1415926)
odrv0.axis0.controller.config.kd_gamma = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.cpr = 2000
odrv0.axis0.encoder.config.calib_range = 0.2
odrv0.axis0.encoder.config.use_index=Trueodrv0.axis1.motor.config.current_lim=10
odrv0.axis1.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT
odrv0.axis1.motor.config.pole_pairs=11
odrv0.axis1.motor.config.calibration_current=10
odrv0.axis1.motor.config.direction = 1
odrv0.axis1.motor.config.calibration_current = 10.0
odrv0.axis1.motor.config.resistance_calib_max_voltage = 12.0odrv0.config.brake_resistance=0
odrv0.axis1.controller.config.vel_limit=50000
odrv0.axis1.controller.config.vel_gain = 0.01
odrv0.axis1.controller.config.vel_integrator_gain = 0.05
odrv0.axis1.controller.config.control_mode = 2
odrv0.axis1.controller.vel_setpoint = 400
odrv0.axis1.controller.config.kp_theta = 0.04 * 6000 / (2 * 3.1415926)
odrv0.axis1.controller.config.kd_theta = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)
odrv0.axis1.controller.config.kp_gamma = 0.0 * 6000 / (2 * 3.1415926)
odrv0.axis1.controller.config.kd_gamma = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)odrv0.axis1.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis1.encoder.config.cpr = 2000
odrv0.axis1.encoder.config.calib_range = 0.2
odrv0.axis1.encoder.config.use_index=Trueodrv0.axis0.config.startup_motor_calibration=True
odrv0.axis0.config.startup_encoder_index_search=True
odrv0.axis0.config.startup_encoder_offset_calibration=True
odrv0.axis0.requested_state=AXIS_STATE_STARTUP_SEQUENCEodrv0.axis0.encoder.config.pre_calibrated=True
odrv0.axis0.motor.config.pre_calibrated = Trueodrv0.axis1.config.startup_motor_calibration=True
odrv0.axis1.config.startup_encoder_index_search=True
odrv0.axis1.config.startup_encoder_offset_calibration=True
odrv0.axis1.requested_state=AXIS_STATE_STARTUP_SEQUENCEodrv0.axis1.encoder.config.pre_calibrated=True
odrv0.axis1.motor.config.pre_calibrated = Trueodrv0.save_configuration()
odrv0.reboot()
I got errors below:
In [18]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
ERROR_MOTOR_FAILED
motor: no error
encoder: Error(s):
ERROR_CPR_OUT_OF_RANGE
I had tried to run the same codes several times and got the same errors.Therefore I checked M0 wirng and mounting ,but nothing wrong showed up.
I noticed M0 have no promblem with finding index and ‘‘found_index=True’’.However,M0 spined in one direction and stopped instead of changed direction and kept spinning for a while when M0 runed ‘‘encoder_offset_calibration’’.
I also had checked ‘‘axis0.encoder.shadow_count’’,which was initial 0 and alternated between 0 and 1 when I manually spined M0.
Can anyone offer me a kindly help?