Sensorless Motor Calibration Issues


#1

Hi all, I’m having some problems getting my motor to calibrate and run with sensorless control.

I’m using a 24V v3.5 ODrive (0.4.7 firmware) with a 5900KV, 4 Pole motor.

The python script that I am using to run the calibration is as follows:

#!/usr/bin/env python3

import odrive
from odrive.enums import *
import time
import math

# Find a connected ODrive (this will block until you connect one)
print("\r\nFinding an ODrive...")
odrv0 = odrive.find_any()

# Erase Current Configuration
# my_drive.erase_configuration()

print("\r\nODrive Found")
print("Bus voltage is:" + str(odrv0.vbus_voltage) + "V")

#print("Calibration current:" + str(odrv0.axis1.motor.config.calibration_current) + "A")

odrv0.config.brake_resistance = 0.5
odrv0.axis1.motor.config.pole_pairs = 2
odrv0.axis1.motor.config.resistance_calib_max_voltage = 5.0
odrv0.axis1.sensorless_estimator.config.pm_flux_linkage = 0.000467228

print("\r\nset parameters\r\n\r\nrequesting calibration")

odrv0.axis1.requested_state = 4

print("phase resistance: ", odrv0.axis1.motor.config.phase_resistance)

time.sleep(5)
print("\r\naxis errors are:")
print(hex(odrv0.axis1.error))	
print("motor errors are:")
print(hex(odrv0.axis1.motor.error))
print("encoder errors are:")
print(hex(odrv0.axis1.encoder.error))
print("sensorless estimator errors are:")
print(hex(odrv0.axis1.sensorless_estimator.error))

print("\r\nIs calibrated? ", odrv0.axis1.motor.is_calibrated)
print("")

When I run the script it connects to the ODrive and initializes the calibration. The Odrive draws ~0.2A for a second or two and then returns to it’s idle ~0.05A current draw. It then returns the following information:

Finding an ODrive...

ODrive Found
Bus voltage is:11.972973823547363V

set parameters

requesting calibration
phase resistance:  0.0

axis errors are:
0x2
motor errors are:
0x0
encoder errors are:
0x0
sensorless estimator errors are:
0x0

Is calibrated?  False

Any help or advice in getting this motor to work would be appreciated.


#2

Not sure what is going on with your error, but try saving your configuration after setting it, and then rebooting.

odrv0.save_configuration()

try:
    odrv0.reboot()
except Exception:
    pass

Also check odrv0.axis1.current_state before and after changing the requested state, it might have some clues.