-
Notifications
You must be signed in to change notification settings - Fork 68
feat: multi-ODrive support with node_id + timestamp in odrive status message #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| @@ -1,3 +1,5 @@ | |||
| std_msgs/Header header | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these names should be different for each instance
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.