Learn ROS-ROS2 with Real Code Examples
Updated Nov 27, 2025
Installation Setup
Install ROS/ROS2 from official packages for your OS (Ubuntu recommended)
Set up workspace using `catkin` (ROS1) or `colcon` (ROS2)
Install required dependencies and build tools
Configure environment variables (`source setup.bash`)
Test installation with demo nodes and talker/listener examples
Environment Setup
Install ROS/ROS2 packages for your OS
Source setup files (`source /opt/ros/<distro>/setup.bash`)
Create and initialize workspace
Install additional dependencies via apt or pip
Test with talker/listener demo nodes
Config Files
CMakeLists.txt - build rules
package.xml - package metadata and dependencies
launch/ - launch scripts for multi-node execution
msg/ - custom message definitions
srv/ - custom service definitions
Cli Commands
ros2 run <package> <node> - Run node
ros2 launch <package> <launch_file> - Launch multiple nodes
ros2 topic list/echo/pub - Inspect and publish topics
ros2 service list/call - Inspect and call services
colcon build - Build ROS2 workspace
Internationalization
Documentation primarily in English
Community translations growing for tutorials
Code is language-agnostic with Python/C++ bindings
Simulation and visualization tools support global formats
Multi-language comments and ROS messages possible
Accessibility
ROS2 is open-source and cross-platform
Documentation, tutorials, and examples widely available
Remote debugging and visualization possible
Community forums provide support
Accessible via Docker containers for reproducible setups
Ui Styling
RViz provides 3D visualization of robots and environments
rqt offers GUI plugins for monitoring nodes and topics
Custom dashboards possible via Qt or web interfaces
Simulation provides realistic environment feedback
No standard UI for embedded-only ROS nodes
State Management
Node state maintained via internal variables
Parameters store configuration
Lifecycle nodes in ROS2 manage startup/shutdown states
Topics/actions carry transient state between nodes
Use persistent storage or databases for long-term state
Data Management
Messages and topics carry sensor and actuator data
Services return synchronous responses
Actions handle feedback and result states
Data can be logged for debugging or analytics
Integration with external databases or cloud platforms