Small ROS1 <-> DDS bridge framework (architecture-focused)
This repository hosts a small bridge node that converts messages between ROS (roscpp) and DDS (eProsima Fast DDS). The current work focuses on a clean architecture so additional bridge implementations (in particular DDS->ROS) can be added easily.
- Two clear bridge directions and directories:
src/ros_to_dds/— bridges that subscribe to ROS topics and publish DDS samples.src/dds_to_ros/— bridges that subscribe to DDS topics and publish ROS messages (future work / placeholder present).
- Direction-prefixed concrete bridge classes to avoid name collisions. Example:
ros_to_dds::RosToDdsPoseBridge. BridgeManagercentralizes creation of (shared) DDS resources (DomainParticipant and Publisher). It manages the lifecycle and initializes registered bridges.- Bridges accept a
set_dds_context(...)call so they can reuse a shared participant/publisher provided byBridgeManager, or create their own participant/publisher as fallback.
src/BridgeManager.hpp/.cpp— manages bridge registration and shared DDS context.src/RosDdsBridge.cpp—main()that createsBridgeManagerand registers bridges.src/ros_to_dds/— ROS->DDS bridge interfaces and implementations. Example:RosToDdsPoseBridge.src/dds_to_ros/— DDS->ROS bridge interfaces (skeleton) and place to add implementations later.CMakeLists.txt— cmake build. The node is built asRosDdsBridge.
- Decide the direction:
- ROS->DDS: create a new class deriving from
ros_to_dds::RosToDdsBridge. - DDS->ROS: create a new class deriving from
dds_to_ros::DdsToRosBridge.
- ROS->DDS: create a new class deriving from
- Implement
ros_topic()/dds_topic()andinit()plusset_dds_context(...)if you want to receive the shared participant/publisher/subscriber. - In
src/RosDdsBridge.cppregister your bridge using:mgr.register_ros_to_dds_bridge(...)ormgr.register_dds_to_ros_bridge(...).
- Rebuild the package.
- DDS->ROS implementations are intentionally left for later. Current structure supports adding them with minimal friction.
- Decide whether
BridgeManagershould create a sharedSubscriberfor DDS->ROS bridges. Right now DDS->ROS bridges can create their own Subscriber. - There are a few places where
ROBOT_IDenvironment variable is used to name participants. Keep that in mind when running multiple bridge nodes.
This is a catkin-style package (ROS1). Typical build (from workspace root):
# from containing catkin workspace
catkin_make
# or, using colcon/catkin_tools, run the appropriate build commandSet ROBOT_ID before launching (some code paths require it when creating a shared participant):
export ROBOT_ID=my_robot
rosrun ros_dds_bridge RosDdsBridgeIf you prefer to use the included ros_dds_bridge.launch, use roslaunch.