ROS2 Integration
The RoArm-M2-S has an official ROS2 workspace that provides URDF models, MoveIt2 configuration, Gazebo simulation, and topic-based control interfaces. The workspace is designed for ROS2 Humble on Ubuntu 22.04.
Overview
Section titled “Overview”The ROS2 integration provides:
- URDF/Xacro model — Accurate 3D model with joint limits and collision geometry
- MoveIt2 configuration — Motion planning with collision avoidance
- Gazebo simulation — Test control code without physical hardware
- ROS2 topics — Publish joint commands, subscribe to feedback
- Launch files — Pre-configured launch configurations for common setups
Workspace Setup
Section titled “Workspace Setup”The workspace source code is available from Waveshare:
# Clone the workspacegit clone https://github.com/waveshareteam/roarm_m2.gitcd roarm_m2
# Install dependenciesrosdep install --from-paths src --ignore-src -r -y
# Buildcolcon build --symlink-install
# Sourcesource install/setup.bashTutorials
Section titled “Tutorials”Waveshare provides nine detailed ROS2 tutorials. Each covers a specific aspect of the ROS2 integration:
1. ROS2 Introduction Basic ROS2 concepts and workspace structure
2. URDF Model Arm model, joint definitions, and visualization in RViz
3. MoveIt2 Setup Motion planning configuration and setup assistant
4. Gazebo Simulation Physics simulation and virtual testing
5. Hardware Interface Connecting ROS2 to the physical arm via serial/WiFi
6. Topic Control Publishing joint commands and subscribing to feedback
7. Action Server MoveIt2 action-based trajectory execution
8. Camera Integration Adding vision to the arm for visual servoing
9. Custom Applications Building your own ROS2 nodes for arm control
Quick Start
Section titled “Quick Start”Launch RViz Visualization
Section titled “Launch RViz Visualization”ros2 launch roarm_description display.launch.pyLaunch MoveIt2 Planner
Section titled “Launch MoveIt2 Planner”ros2 launch roarm_moveit_config demo.launch.pyLaunch Gazebo Simulation
Section titled “Launch Gazebo Simulation”ros2 launch roarm_gazebo gazebo.launch.pyConnect to Physical Arm
Section titled “Connect to Physical Arm”ros2 launch roarm_driver roarm_driver.launch.py port:=/dev/ttyUSB0ROS2 Topics
Section titled “ROS2 Topics”| Topic | Type | Direction | Description |
|---|---|---|---|
/joint_states | sensor_msgs/JointState | Published | Current joint positions |
/joint_commands | std_msgs/String | Subscribed | JSON command strings |
/arm_feedback | std_msgs/String | Published | Position and torque feedback |
Architecture
Section titled “Architecture”graph TD
A[MoveIt2 Planner] --> B[Trajectory Controller]
B --> C[ROS2 Driver Node]
C --> D{Transport}
D -->|Serial| E[ESP32]
D -->|WiFi/HTTP| E
E --> F[Servo Bus]
F --> G[Joint Actuators]
G --> H[Encoder Feedback]
H --> E
E --> C
C --> I[/joint_states Topic]
ROS2 integration maintained by Waveshare. Tutorial links point to the Waveshare wiki — these are out of scope for this documentation site but are included as reference.