ros_odrive icon indicating copy to clipboard operation
ros_odrive copied to clipboard

feat: multi-ODrive support with node_id + timestamp in odrive status message

Open wgtayar opened this issue 2 months ago • 1 comments

Summary

This PR extends odrive_status.msg and updates the odrive_can_node implementation 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:

  • Enable reliable use of multiple ODrives in one ROS system.
  • Improve traceability and debugging with accurate timestamps.
  • Reduce overhead by defining node_id once.

This inspiration comes from working on a system with multiple ODrives, such as a quadruped robot.

Changes

  • Message definition

    • Added std_msgs/Header header (provides stamp).
    • Added uint32 node_id field to uniquely identify each ODrive device.
  • Publisher logic (odrive_can_node.cpp)

    • header.stamp is now assigned immediately before current and voltage measurements are taken, ensuring accurate timing of values.
    • node_id is defined once at initialization, rather than being re-set in every loop iteration.

Testing

  • Verified build with colcon build.
  • Ran ros2 topic echo /odrive_axis*/odrive_status with two ODrives connected:
    • Confirmed each message contains the correct node_id.
    • Confirmed header.stamp updates consistently at each publish cycle.

Notes

  • This is a message definition change. Downstream packages depending on odrive_status.msg must be rebuilt.
  • Maintainers: please confirm if uint32 is suitable for node_id or if a smaller type is preferred.

wgtayar avatar Sep 17 '25 14:09 wgtayar

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Sep 17 '25 14:09 CLAassistant