Key Engineering Takeaways
- •Topics = Continuous stream (unidirectional); Services = Fast request/response (synchronous blocking); Actions = Long-running tasks with feedback and preemption.
- •Always keep interface definitions in a dedicated `<project>_msgs` package to prevent circular dependencies.
- •Action goals allow clients to cancel mid-execution (e.g. aborting navigation when an obstacle appears).
Prerequisites
- • Basic ROS 2 nodes
When to Use Topics vs Services vs Actions
Choosing the correct communication paradigm is critical for robust system design:
- **Topic**: LiDAR scans at 10Hz, wheel odometry at 50Hz, camera images at 30Hz.
- **Service**: Trigger camera calibration snapshot, reset odometry origin, enable/disable motors.
- **Action**: Navigate to 3D waypoint coordinates, execute 5-second robotic arm pick-and-place trajectory.
Tags:#ROS 2#Interfaces#Actions#Services#CMake#colcon