Enums used in odrive not on github

Hi, I want to write a human readable error dump using the ASCII protocol.
ODrive pro, version v0.6.7

I got as far as figuring out how active_errors are masked into one. But now I lack the error codes.

I had a look at the odrivetool github, but the enums I find there do not match with the error codes in the odrivetool.

Example:
error_dump(odrv0):
active_errors: Error(s):
ODriveError. INITIALIZING
ODriveError.DC_BUS_UNDER_VOLTAGE
ODriveError.WATCHDOG_TIMER_EXPIRED

readout gives me:

In [15]: hex(odrv0.axis0.active_errors)
Out[15]: β€˜0x1000201’

as in:
In [19]: hex(ODriveError.DC_BUS_UNDER_VOLTAGE)
Out[19]: β€˜0x200’

In [20]: hex(ODriveError.INITIALIZING)
Out[20]: β€˜0x1’

In [21]: hex(ODriveError.WATCHDOG_TIMER_EXPIRED)
Out[21]: β€˜0x1000000’

The problem: I can’t find the definitions anywhere on the github page,
All enums for ODriveError I found do not contain INITIALIZING and WATCHDOG_TIMER_EXPIRED, DC_BUS_UNDER_VOLTAGE values do not mach.

Can anyone save me from writing them myself each time i update the odrives?

For Pro (or S1) you’ll want to reference the ODrive Documentation, you can find the ODriveError values here. Since you have odrivetool installed, you can also refer to the enums in Python: you can see all enum members with list(ODriveError), or you can open and browse the file at sys.modules[ODriveError.__module__].

Building a human readable error dump with the ASCII protocol sounds cool, which language do you intend to use?

Tanks for the reply, ~/.local/lib/python3.10/site-packages/odrive/enums.py is exactly what i was looking for.
The whole project is written in C++ to be used on a STM32.

1 Like

Hey Sbenkel,

You can also look at the ODriveEnums.h in the ODriveArduino package https://github.com/odriverobotics/ODriveArduino/blob/master/src/ODriveEnums.h

1 Like