Im trying to calibrate a multistar 9235 100kv motor with an Odrive 3.6-24 V sensorless.
I first got got it working sensorless without problems on Raspberry pi with firmware version 0.4.12.
Now wanted to try it via my windows laptop and updated the Odrive firmware to 0.5.1. (odrivetools is also version 0.5.1)
But no I am stuck on one error that appears when I try to start calibrating. When I request state 2, it immediately goes back to state 1, and no beeping and spinning is happening. I get two errors: motor error 0x1000000 appears, and odrv0 error = 0x0008.
Im using a python script with the following parameters to set the Odrive:
#!/usr/bin/env python3
from __future__ import print_function
import odrive
from odrive.enums import *
import time
import math
print ("finding an odrive...")
od = odrive.find_any()
print("setting parameters...")
od.axis1.config.startup_motor_calibration = 1
od.axis1.config.enable_sensorless_mode = 1
od.axis1.motor.config.pole_pairs = 40 # multistar 9235 100kv
od.axis1.motor.config.torque_constant = 0.0827
od.axis1.motor.config.motor_type = 0
od.axis1.motor.config.current_lim = 50 # A
od.axis1.motor.config.calibration_current = 15
od.axis1.controller.config.vel_limit = 30
od.axis1.controller.config.vel_gain = 0.01
od.axis1.controller.config.vel_integrator_gain = 0.5
od.axis1.controller.config.inertia = 0.05 # weird unit
od.axis1.controller.config.control_mode = 2 #0 voltage control, 1 torque, 2 velocity, 3 position
od.axis1.controller.config.input_mode = 2
od.axis1.controller.input_vel = 15
od.config.brake_resistance = 0.5
od.axis1.sensorless_estimator.config.pm_flux_linkage = 0.001375
time.sleep(1)
# after this point motor error 0x1000000 appears
print("starting calibration...")
od.axis1.requested_state = 2
while od.axis1.current_state != 1:
time.sleep(0.1)
print("calibration successful")
#od.save_configuration()
#print("configuration saved")
Can someone explain to me what these errors mean? and how I can get the calibration to work?
Thank you for your help.
I think motor error 0x1000000 is bit 24 which is… A system-level error. Refer to od.error
My guess would be something like DC Bus overvoltage, or DC Bus Over Regen current.
If you also import odrive.utils.dump_errors, you can print all the errors on the drive (and reset them) just like you can in odrivetool.
ie dump_errors(od, True) will print (and clear) all of the errors.
I increased dc_max_negative_current to -0.01 and this seems to have solved the problem, the motor calibrates. Thanks a lot!
I previously have tried to use dump_errors(odrv0), but whenever I try to use dump_errors(odrv0) command in odrivetool (or importing it in python) I get the following error:
In [4]: dump_errors(odrv0)
axis0
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
c:\users\s161105\appdata\local\programs\python\python39\lib\site-packages\fibre\shell.py in <module>
----> 1 dump_errors(odrv0)
c:\users\s161105\appdata\local\programs\python\python39\lib\site-packages\odrive\utils.py in dump_errors(odrv, clear)
81 ('axis', axis, {k: v for k, v in odrive.enums.__dict__ .items() if k.startswith("AXIS_ERROR_")}),
82 ('motor', axis.motor, {k: v for k, v in odrive.enums.__dict__ .items() if k.startswith("MOTOR_ERROR_")}),
---> 83 ('fet_thermistor', axis.fet_thermistor, {k: v for k, v in odrive.enums.__dict__ .items() if k.startswith("THERMISTOR_CURRENT_LIMITER_ERROR")}),
84 ('motor_thermistor', axis.motor_thermistor, {k: v for k, v in odrive.enums.__dict__ .items() if k.startswith("THERMISTOR_CURRENT_LIMITER_ERROR")}),
85 ('encoder', axis.encoder, {k: v for k, v in odrive.enums.__dict__ .items() if k.startswith("ENCODER_ERROR_")}),
c:\users\s161105\appdata\local\programs\python\python39\lib\site-packages\fibre\remote_object.py in __getattribute__(self, name)
243 return attr
244 else:
--> 245 return object.__getattribute__(self, name)
246 #raise AttributeError("Attribute {} not found".format(name))
247
AttributeError: 'RemoteObject' object has no attribute 'fet_thermistor'
Is this also because one of the settings is not correct?