Add custom properties

How can I add my own custom propterties?

I’ve noticed that in the firmware there is a function

make_protocol_property

but this won’t work on the devel branch.

On the devel branch in the file controller.hpp (https://github.com/odriverobotics/ODrive/blob/devel/Firmware/MotorControl/controller.hpp ) the whole section at the end make_protocol_definitions() is missing, however, when I switch to the branch fw-v0.4.12 and look at the same file I can see that the make_protocol_definitions() is there: https://github.com/odriverobotics/ODrive/blob/fw-v0.4.12/Firmware/MotorControl/controller.hpp

Is it possible to add make_protocol_property on the devel branch so that I can add my custom properties?

You can still add and remove properties from the firmware for v0.5.1+, but the process has changed.

For properties to show up on odrivetool, for example, it must exist in the header file for that class and also be added to the file called odrive-interface.yaml in the Firmware directory. If you wanted to add a property called my_property of type bool to the Axis class, you would add

bool my_property_;

to axis.hpp (note the underscore) and

my_property: bool

to odrive-interface.yaml under the attributes section of ODrive.Axis (line 223).

Big thanks! @PJohnson

Take a look at my code compared to 5.1.

With help from @Wetmelon and @Samuel i’ve added a function that accepts two inputs (one position or torque per axis), and returns one position, velocity and gpio value per axis, six total.

I havent modified the odrivetool to work with this function, but it should give you an idea of what is possible.