Learn ROS-ROS2 with Real Code Examples
Updated Nov 27, 2025
Architecture
Nodes communicate through topics, services, and actions
ROS Master (ROS1) or DDS (ROS2) manages discovery and communication
Messages define data exchanged between nodes
Supports distributed deployment across multiple machines
Hardware interfaces abstract sensors and actuators
Rendering Model
Nodes communicate via DDS (ROS2) or ROS Master (ROS1)
Messages carry data asynchronously between nodes
Services handle synchronous calls
Actions support long-running preemptable tasks
Visualization through RViz, simulation via Gazebo
Architectural Patterns
Node-based modular software design
Publisher-Subscriber for decoupled communication
Client-Server via services
Event-driven actions for long tasks
Hardware abstraction via drivers and interfaces
Real World Architectures
Autonomous mobile robots with LIDAR and cameras
Warehouse automation with multiple ROS2 robots
Self-driving car perception and control stacks
Industrial robotic arms integrated with ROS2 drivers
Drone swarms coordinated via ROS2 topics and actions
Design Principles
Modular, node-based architecture
Hardware abstraction and OS independence
Communication via topics, services, and actions
Scalable from single robots to distributed multi-robot systems
Open-source, community-driven development
Scalability Guide
Use multiple nodes and topics to decouple logic
Leverage ROS2 DDS for distributed robots
Use launch files to manage complex systems
Containerize nodes for deployment
Optimize performance using QoS and node composition
Migration Guide
ROS1 -> ROS2 migration requires adapting topics, services, and parameters
Update node lifecycle handling and QoS policies
Use ROS1 bridge for compatibility
Test simulation and visualization integration
Validate hardware driver compatibility