How scifiswapnil/ros2_ddsm115_driver works
Project Type and Purpose
• This is a robotics driver package for ROS2 Humble, comprised of two ROS2 packages:
– ddsm115_driver: a C++ library (DDSM115Communicator), a ROS2 node, a ros2_control HardwareInterface plugin, and custom ROS2 services.
– ddsm115_example: an example robot description (URDF), controller configs, launch files, and RViz configs that demonstrate how to use the driver in a ros2_control ecosystem.
File Structure
• Top-level packages:
– src/ddsm115_driver/…
– src/ddsm115_example/…
• Key sub-directories:
– config/ (YAML configurations for both driver and example)
– include/ & src/ (library headers & implementations)
– srv/ (service definitions)
– plugin_description.xml (registers the HardwareInterface plugin)
– launch/, urdf/, rviz/ (example usage)
Extract Additional Insights from README
• Core library:
– DDSM115Communicator handles serial port communication using the motor’s protocol.
– Exposes methods to switch modes, set IDs, drive motor, and read feedback.
• ROS2 node:
– Subscribes to command topics
– Calls communicator methods
– Publishes motor state
• ros2_control plugin:
– Implements the HardwareInterface for use inside a controller_manager via URDF.
Main Components
a. DDSM115Communicator Library (C++ Layer)
– Serial Port Interface
– Protocol Parser & Builder
b. Driver Node
– ROS2 Subscription (e.g. /ddsm115/command)
– ROS2 Publication (e.g. /ddsm115/state)
– ROS2 Services (ChangeMotorMode, QueryMotorId, SetMotorId)
c. ros2_control Components (Example Package)
– controller_manager
– Controllers (position, velocity controllers)
– HardwareInterface Plugin (registered via plugin_description.xml)
d. Robot Description & Visualization
– URDF XACRO with <transmission> referencing the plugin
– RViz config for TFs & joint states
e. External Hardware
– DDSM115 Motor over Serial Bus (e.g. /dev/ttyUSB0)
Relationships & Interactions
• Data flow from controllers → HardwareInterface → DDSM115Communicator → Serial Port → Motor.
• Driver Node path: topic subscription → communicator → service calls → publish feedback → topic.
Architectural Patterns & Design Principles
• Layered Architecture:
– Application Layer (controllers, nodes)
– Abstraction Layer (HardwareInterface plugin)
– Communication Layer (DDSM115Communicator)
– Physical Layer (Serial Bus & Motor)
• Plugin Pattern: ros2_control plugin dynamically loaded via XML.
• Separation of Concerns:
– Serial protocol code isolated in Communicator library
– ROS2 node logic distinct from hardware interface
Relevant Technologies & Frameworks
• ROS2 Humble (rclcpp, ros2_control, controller_manager)
• CMake / ament_cmake build system
• YAML for runtime configuration
• URDF XACRO for robot description
• RViz for visualization