ODrive Closed Loop Control Error


#1

Hello!
I recently received my ODrive board (24V ODrive V3.5 with firmware version 0.4.7) and I was going through the initialization of the ODrive (with the AMT102-V encoder with 8192 cpr mounted on the shaft) and was able to complete the “AXIS_STATE_FULL_CALIBRATION_SEQUENCE” just fine…the motor rotated for a couple seconds in each direction (although it seemed to current spike and stall right before it began the calibration…is that normal?).

After the calibration finished, I entered the "AXIS_STATE_CLOSED_LOOP_CONTROL“ command. The current output rises slightly on the power supply and I can feel the motor (Turnigy D3536/6 1250KV with 7 poles) resist me slightly trying to spin it by hand. However, when I go to give it a setpoint command as done in the “getting started guide”, such as “odrv0.axis0.controller.pos_setpoint = 1000”, the motor turns just barely, then stops, and the current drops to its “resting” state (~0.04 amps). I checked the error codes and got the following:

odrv0.axis0.error : 0x200 which is “ERROR_CONTROLLER_FAILED”
odrv0.axis0.motor.error : 0x10 which I’m guessing is “ERROR_CONTROL_DEADLINE_MISSED”
odrv0.axis0.encoder.error : 0x0 which is no error.

Does anyone have any recommendation on a path forward?
Thank you for your help!


#2

Normal. It measures the phase resistance and inductance.

Why does nobody check odrv0.axis0.controller.error? The Axis error is “Controller failed” but nobody checks the controller! You’re like the 12th person lol. My bet is that odrv0.axis0.config.vel_limit is too low.

Where did you get the instructions to check motor and encoder errors, because it’s clearly missing “controller”


#3

Hi @Wetmelon,

I never realised odrv0.axis0.controller.error existed either, it must of slipped in under my radar!


#4

Wetmelon: It woult be nice if odrivetool monitored the error variable and showed a message when error occurs (ideally with the human-readable description). Otherwise it is hidden a I understand people miss it.


#5

@Wetmelon

Thanks for the insight! Dove a little deeper into the documentation and saw the controller error…it only lists two errors in the GitHub code; ERROR_NONE = 0 and ERROR_OVERSPEED = 0x01.

I did adjust odrv0.axis0.controller.config.vel_limit and set it to 40000 counts/sec and that did seem to correct the issue. Although i have noticed that sometimes it kicks out of the closed loop control when commanding large changes in the pos_setpoint. i.e. I went from 0 encoder count to 1,000,000 just fine, but when i went to go from encoder count 1,000,000 to encoder count 0, it faulted after about a half turn with errors:
odrv0.axis0.error : 0x200 which is “ERROR_CONTROLLER_FAILED”
odrv0.axis0.motor.error : 0x10 which I’m guessing is “ERROR_CONTROL_DEADLINE_MISSED”
odrv0.axis0.encoder.error : 0x0 which is no error.
odrv0.axis0.controller.error : 0x1 which is ERROR_OVERSPEED.

It also sometimes happens with a lot smaller changes in the encoder count position, especially when decreasing. i.e. 2000 to 0. It says a overspeed error, but the vel_limit was fine when it was counting up, but not when counting down? Maybe this is a gain issue?


#6

I don’t know if it’s in master yet, but we’ve implemented a “get Errors” function, forget exactly the name of it. It pulls ALL errors, with human-readable names. Be on the lookout for it!

@DenDen

I suspect there’s something a little bit wonky in the velocity calculation. It’s always acted pretty noisy for me. I believe you can disable the velocity limit error by setting controller_.vel_limit_tolerance to 0


#7

Thank you! Ill check out the velocity limit tolerance and see what I can