Control 2 motors with odrive v3.6

Setting:
Ubuntu: 20.04
Python: 3.10.0
Firmware: 0.5.1
OdriveBoard: v3.6
Motor: A2212/13T
Encoder: 1000KV

Problem:
I’m trying to control 2 motors with v3.6 board, and with the following setting, the first motor worked:

odrv0.config.brake_resistance = 2.0
odrv0.config.dc_bus_undervoltage_trip_level = 8.0
odrv0.config.dc_bus_overvoltage_trip_level = 56.0
odrv0.config.dc_max_positive_current = 20.0
odrv0.config.dc_max_negative_current = -3.0
odrv0.config.max_regen_current = 0
odrv0.save_configuration()

odrv0.axis0.motor.config.pole_pairs = 7
odrv0.axis0.motor.config.calibration_current = 5
odrv0.axis0.motor.config.resistance_calib_max_voltage = 2
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis0.motor.config.current_lim = 15
odrv0.axis0.motor.config.requested_current_range = 20
odrv0.save_configuration()

odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.cpr = 16384
odrv0.axis0.encoder.config.bandwidth = 3000
odrv0.axis0.config.calibration_lockin.current = 5
odrv0.axis0.config.calibration_lockin.ramp_time = 0.4
odrv0.axis0.config.calibration_lockin.ramp_distance = 3.1415927410125732
odrv0.axis0.config.calibration_lockin.accel = 20
odrv0.axis0.config.calibration_lockin.vel = 40
odrv0.save_configuration()

odrv0.axis0.controller.config.control_mode = CONTROL_MODE_TORQUE_CONTROL
odrv0.axis0.controller.config.vel_limit = 50
odrv0.axis0.controller.config.pos_gain = 30
odrv0.axis0.controller.config.vel_gain = 0.02
odrv0.axis0.controller.config.vel_integrator_gain = 0.2
odrv0.axis0.controller.config.input_mode = INPUT_MODE_PASSTHROUGH
odrv0.save_configuration()
odrv0.reboot()

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
odrv0.axis0.config.startup_encoder_offset_calibration = True
odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.config.startup_closed_loop_control = True
odrv0.save_configuration()
odrv0.reboot()

And then I tried the same configuration for the second motor but replace the axis0 to axis1:

odrv0.axis1.motor.config.pole_pairs = 7
odrv0.axis1.motor.config.calibration_current = 5
odrv0.axis1.motor.config.resistance_calib_max_voltage = 2
odrv0.axis1.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis1.motor.config.current_lim = 15
odrv0.axis1.motor.config.requested_current_range = 20
odrv0.save_configuration()

odrv0.axis1.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis1.encoder.config.cpr = 16384
odrv0.axis1.encoder.config.bandwidth = 3000
odrv0.axis1.config.calibration_lockin.current = 5
odrv0.axis1.config.calibration_lockin.ramp_time = 0.4
odrv0.axis1.config.calibration_lockin.ramp_distance = 3.1415927410125732
odrv0.axis1.config.calibration_lockin.accel = 20
odrv0.axis1.config.calibration_lockin.vel = 40
odrv0.save_configuration()

odrv0.axis1.controller.config.control_mode = CONTROL_MODE_TORQUE_CONTROL
odrv0.axis1.controller.config.vel_limit = 50
odrv0.axis1.controller.config.pos_gain = 30
odrv0.axis1.controller.config.vel_gain = 0.02
odrv0.axis1.controller.config.vel_integrator_gain = 0.2
odrv0.axis1.controller.config.input_mode = INPUT_MODE_PASSTHROUGH
odrv0.save_configuration()
odrv0.reboot()

odrv0.axis1.requested_state = AXIS_STATE_MOTOR_CALIBRATION
odrv0.axis1.motor.config.pre_calibrated = True
odrv0.axis1.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
odrv0.axis1.config.startup_encoder_offset_calibration = True
odrv0.axis1.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis1.config.startup_closed_loop_control = True
odrv0.save_configuration()
odrv0.reboot()

dump_errors(odrv0)

But this gives me an axis1 error:
system: not found
axis0
axis: no error
motor: no error
DRV fault: not found
sensorless_estimator: no error
encoder: no error
controller: no error
axis1
axis: Error(s):
AxisError.MOTOR_FAILED
motor: Error(s):
MotorError.MODULATION_MAGNITUDE
DRV fault: not found
sensorless_estimator: no error
encoder: no error
controller: no error

I wonder whether I’m controlling it the right way, and how to resolve this problem.

Hi! This may be due to motor miswiring, maybe the wires are slipping out of the connector. Can you post a picture?





here is my setup for the board and encoder

Solved it the problem is due to config issue, during the first time celebration M1 is not connected to a motor thus it gets a infinite inductance, I believe in the following test the config is preserved thus the M1 way has no output voltage, fix it by checking the output config.json

That makes sense!