Odrive firmware version 0.5.5
Odrive library required
pip install odrive
odrivetool
ODrive control utility v0.5.4
Website: https://odriverobotics.com/
Docs: https://docs.odriverobotics.com/
Forums: https://discourse.odriverobotics.com/
Discord: https://discord.gg/k3ZZ3mS
Github: https://github.com/odriverobotics/ODrive/
Please connect your ODrive.
You can also type help() or quit().
Connected to ODrive 207C39705841 as odrv0
odrv0.config.enable_brake_resistor = True # If there is brake resistor
odrv0.config.brake_resistance = 2 #default resistor value [Ohm]
odrv0.axis0.motor.config.pole_pairs = 15 #Number of pole pairs of motor (Number of permanent magnet poles / 2)
odrv0.axis0.motor.config.resistance_calib_max_voltage = 4 #Hub motors need higher voltage
odrv0.axis0.motor.config.requested_current_range = 25 #Requires config save and reboot
odrv0.axis0.motor.config.current_control_bandwidth = 100
odrv0.axis0.motor.config.torque_constant = 8.27 / <measured KV> #typical value of KV is 16
odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL #Encoder type
odrv0.axis0.encoder.config.cpr = 4096 # 4 * ppr
odrv0.axis0.encoder.config.calib_scan_distance = 10 # can be higher 150
odrv0.axis0.encoder.config.bandwidth = 100
odrv0.axis0.controller.config.pos_gain = 1
odrv0.axis0.controller.config.vel_gain = 5
odrv0.axis0.controller.config.vel_integrator_gain = 10
odrv0.axis0.controller.config.vel_limit = 4.3 # max limit in Turns/s
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.axis0.controller.config.vel_ramp_rate = 3 # acceleration measured in turns/s^2
odrv0.axis0.controller.config.input_mode = INPUT_MODE_VEL_RAMP
odrv0.save_configuration()
odrv0.reboot()
odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION # beep signal must be within 3 seconds. Wait 5 seconds
odrv0.axis0.motor # Check to see that there is no error and that the phase resistance and inductance are reasonable.
odrv0.axis0.motor.config.pre_calibrated = True # If everything is OK
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
odrv0.axis0.encoder.config # To verify everything went well, check the errors
odrv0.axis0.encoder.config.pre_calibrated = True # If everything is OK
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION # Closed loop starts
dump_errors(odrv0) # Check errors
odrv0.axis0.controller.input_vel = 2 # velocity commend in turns/s
odrv0.axis0.requested_state = AXIS_STATE_IDLE
odrv0.axis0.config.startup_encoder_offset_calibration = True
odrv0.axis0.config.startup_closed_loop_control = True
odrv0.save_configuration()
odrv0.reboot()