Hello world! Thanks for taking time to help solve an tricky issue. I get stuck trying to spin BLDC wheel after
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION followed by the cursory .save and .reboot. Encoding revs w Halls worked ok but now I’m hungry for some better resolution with $10 rotary encoder used in Getting Started example and seen below. Now I can only get as far as being able to read encoder counts on both wheel from rotary. A and B are working well as values go up and down in position counts as wheel is hand turned.
In [41]: odrv0.axis0.encoder.pos_estimate
Out[41]: 9577.0166015625
No Z available for rev INDEX. New encoders ordered for INDEX option. Am I missing something in this upgrade? If you have experience with this issue please do drop a line. Thanks a mint!
Hardware
2 - 350 W 10" hooverboard Outrunner style BLDC motors
2 - 400 p/r encoders (as seen in Odrive Doc example)
2 - planetary gear sets 32:8 (Inner wheel:encoder shaft)
Odrive 45V v3.5 w 36 V Li-ion. The motor Current level set a default 10 A.
Odrive Doc was followed on hooverboard cal and test with one change for encoder types: hall(90 cpr) to rotary (9600 cpr) cpr = 400 p/r * 4 quad. * 4 from gear set (32:8)
I tried this below and all the other modes I could find in Doc but no spin up like with Hall sensors from before upgrade. I have also tried to set up motor with
odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT then
odrv0.erase_configuration() only to start try hooverboard with rotary encoder. Below is another attempt with said configuration. Fun stuff! I can’t wait to get back up and Odrivin’ again with the added cpr. Thank you kindly for any and all feedback :0)
In [17]: odrv0.axis0.controller.config.control_mode = CTRL_MODE_VELOCITY_CONTROL
In [18]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
In [19]: odrv0.axis0.controller.vel_setpoint = 20
In [20]: odrv0.axis0.motor.current_control.Iq_measured
Out[20]: -0.18101319670677185
In [21]: odrv0.axis0.motor.current_control.Iq_setpoint
Out[21]: 0.2471545934677124
Hi Jalbob,
Thanks for your questions. We are running odrivetool 0.4.7 so the dump_errors(odrv0) is not an option yet. How does one uprade to odrivetool 0.4.8? Here is what dump_errors(odrv0) returned.
NameError Traceback (most recent call last)
/usr/local/lib/python3.5/dist-packages/fibre/shell.py in <mod
Also I am concerned that .pos_estimate and .pos_cpr are different by a large margin. Is this normal?
odrv0.axis0.encoder.pos_estimate
Out[9]: -1843.98291015625
In [10]: odrv0.axis0.encoder.pos_cpr
Out[10]: 7756.0244140625
This worked for me as im running pip3.5
$pip3.5 install odrive --upgrade
In [1]: dump_errors(odrv0)
Axis0:
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
Axis1:
axis: no error
motor: no error
encoder: no error
controller: no error
Hi thanks for your response. Hope you had a nice weekend. We tried:
odrv0.erase_configuration()
then followed getting started hooverboard method changing only .mode from HALL to INCREMENTAL and cpr value. Still no spin up…
In [10]: odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
In [11]: odrv0.axis0.encoder.config.cpr = 9600
In [27]: dump_errors(odrv0)
Axis0:
axis: no error
motor: no error
encoder: no error
controller: no error
Axis1:
axis: no error
motor: no error
encoder: no error
controller: no error
In [28]: odrv0.axis0.controller.config.control_mode = CTRL_MODE_VELOCITY_CONTROL
…:
In [29]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
…:
In [30]: odrv0.axis0.controller.vel_setpoint = 120
…:
In [31]: odrv0.axis0.controller.vel_setpoint = 0
In [32]: dump_errors(odrv0)
Axis0:
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
Axis1:
axis: no error
motor: no error
encoder: no error
controller: no error
/usr/local/lib/python3.5/dist-packages/fibre/remote_object.py in call(self, *args)
160 for i in range(len(args)):
161 self._inputs[i].set_value(args[i])
–> 162 self._parent.channel.remote_endpoint_operation(self._trigger_id, None, True, 0)
163 if len(self._outputs) > 0:
164 return self._outputs[0].get_value()
/usr/local/lib/python3.5/dist-packages/fibre/remote_object.py in call(self, *args)
160 for i in range(len(args)):
161 self._inputs[i].set_value(args[i])
–> 162 self._parent.channel.remote_endpoint_operation(self._trigger_id, None, True, 0)
163 if len(self._outputs) > 0:
164 return self._outputs[0].get_value()
/usr/local/lib/python3.5/dist-packages/fibre/remote_object.py in call(self, *args)
160 for i in range(len(args)):
161 self._inputs[i].set_value(args[i])
–> 162 self._parent.channel.remote_endpoint_operation(self._trigger_id, None, True, 0)
163 if len(self._outputs) > 0:
164 return self._outputs[0].get_value()
/usr/local/lib/python3.5/dist-packages/fibre/remote_object.py in call(self, *args)
160 for i in range(len(args)):
161 self._inputs[i].set_value(args[i])
–> 162 self._parent.channel.remote_endpoint_operation(self._trigger_id, None, True, 0)
163 if len(self._outputs) > 0:
164 return self._outputs[0].get_value()
Reconnected to ODrive 207D37943548 as odrv0
In [71]: dump_errors(odrv0)
Axis0:
axis: no error
motor: no error
encoder: no error
controller: no error
Axis1:
axis: no error
motor: no error
encoder: no error
controller: no error
In [72]: odrv0.axis0.controller.config.control_mode = CTRL_MODE_VELOCITY_CONTROL
…:
In [73]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
…:
In [74]: odrv0.axis0.controller.vel_setpoint = 120
…:
In [75]: dump_errors(odrv0)
Axis0:
axis: Error(s):
ERROR_INVALID_STATE
motor: no error
encoder: no error
controller: no error
Axis1:
axis: no error
motor: no error
encoder: no error
controller: no error
SOLVED -
The gains needed to scaled back due to new encoder resolution. Before with Halls - 90 cpr as seen in Odrive hooverboard Doc. After with rotary encoders - 9600 cpr
.pos_gain = 0.5, .vel_gain = 0.0005 and .vel_intergrator_gain = 0.0025. The current increase from 10 A to 20 A and we are back on the road. Special thanks to all!
I have a doubt which arose while calibrating the Encoder, the command prompt kept showing name error. The command used was:
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
The error was name error. Can anyone assist in this??