Expose driver enumerations in messages #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was doing some testing commanding ODrive's via ROS 2 with this package, and noticed that it was hard to figure out what to put in some of the uint fields in the control messages or service.
So I pulled the enum values from the docs and put them directly in the message files. This way everybody who compiles the messages will have the enum values come along with the messages themselves (but note that msg constants are not serialized, so this adds no overhead when passing messages).
Obviously, this changes the structure of the original messages, which will break the code of anybody currently using this package. I thought of a few other ways to make these changes without changing the messages, but did not like them as much:
The changes only really effect the format of the input to the node, but I did test them on hardware anyway and everything looks to be working.
Note: this change would also need to be reflected in the tutorial page. Specifically, the service call near the bottom changes to:
ros2 service call /odrive_axis0/request_axis_state /odrive_can/srv/RequestAxisState '{axis_requested_state: {state: 1}}'