feat: multi-ODrive support with node_id + timestamp in odrive status message#40
Open
wgtayar wants to merge 3 commits into
Open
feat: multi-ODrive support with node_id + timestamp in odrive status message#40wgtayar wants to merge 3 commits into
wgtayar wants to merge 3 commits into
Conversation
samuelsadok
reviewed
Sep 22, 2025
| @@ -1,3 +1,5 @@ | |||
| std_msgs/Header header | |||
Member
There was a problem hiding this comment.
Since we're not using any of the other fields in Header, is there any downside to just using time timestamp directly?
| @@ -1,3 +1,5 @@ | |||
| std_msgs/Header header | |||
| uint32 node_id | |||
Member
There was a problem hiding this comment.
Your PR description states that this node_id should serve to distinguish two or more ODrive sources. But the typical way to do this that I know of is via the topic path on which they are published:
ros2 topic echo /odrive_axis0/odrive_status
ros2 topic echo /odrive_axis1/odrive_status
...Is there a scenario where this does not work?
| pkg: "odrive_can" | ||
| exec: "odrive_can_node" | ||
| name: "can_node7" | ||
| namespace: "odrive_axis0" |
Member
There was a problem hiding this comment.
these names should be different for each instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR extends
odrive_status.msgand updates theodrive_can_nodeimplementation to support multi-ODrive setups by disambiguating messages and adding temporal context.Motivation
The existing implementation works for a single ODrive but makes it impossible to distinguish messages when multiple ODrives are connected. Additionally, messages lacked a timestamp, complicating debugging, logging, and synchronization with other ROS data streams.
These changes:
node_idonce.This inspiration comes from working on a system with multiple ODrives, such as a quadruped robot.
Changes
Message definition
std_msgs/Header header(providesstamp).uint32 node_idfield to uniquely identify each ODrive device.Publisher logic (
odrive_can_node.cpp)header.stampis now assigned immediately before current and voltage measurements are taken, ensuring accurate timing of values.node_idis defined once at initialization, rather than being re-set in every loop iteration.Testing
colcon build.ros2 topic echo /odrive_axis*/odrive_statuswith two ODrives connected:node_id.header.stampupdates consistently at each publish cycle.Notes
odrive_status.msgmust be rebuilt.uint32is suitable fornode_idor if a smaller type is preferred.