_A collection of ROS2 fundamentals — hands-on nodes, services, and custom interfaces built in both C++ and Python.
This repository contains my ROS2 (Robot Operating System 2) learning projects, developed while following the ROS2 for Beginners course by Edouard Renard. It includes implementations of publishers, subscribers, services, custom messages, and launch files in both C++ and Python.
src/
├── my_cpp_pkg/ # C++ nodes
│ ├── add_two_ints_client.cpp
│ ├── add_two_ints_server.cpp
│ ├── robot_news_station.cpp
│ ├── smartphone.cpp
│ ├── number_publisher.cpp
│ ├── hardware_status_publisher.cpp
│ ├── led_panel_publisher.cpp
│ └── ...
│
├── my_py_pkg/ # Python nodes
│ ├── add_two_ints_client.py
│ ├── add_two_ints_server.py
│ ├── robot_news_station.py
│ ├── smartphone.py
│ ├── number_publisher.py
│ ├── hardware_status_publisher.py
│ ├── led_panel_publisher.py
│ └── ...
│
├── my_robot_bringup/ # Launch & config files
│ ├── config/
│ │ ├── name_robo_station.yaml
│ │ └── number_app.yaml
│ ├── launch/
│ │ ├── number_app.launch.py
│ │ ├── number_app.launch.xml
│ │ └── news_station_robo.launch.xml
│ ├── CMakeLists.txt
│ └── package.xml
│
└── my_robot_interfaces/ # Custom messages & services
├── msg/
│ ├── HardwareStatus.msg
│ └── LedPanelState.msg
├── srv/
│ └── SetLed.srv
├── CMakeLists.txt
└── package.xml
-
Publishers & Subscribers
- Number publisher/subscriber
- Robot news station & smartphone subscriber
-
Services
- Add two integers (C++ & Python)
- LED panel control with custom service
-
Custom Interfaces
HardwareStatus.msgLedPanelState.msgSetLed.srv
-
Launch Files
- XML and Python launch files for running multiple nodes
-
Clone the repo into your ROS2 workspace:
cd ~/ros2_ws/src git clone https://github.com/mohammad-alghazawi/ros2-learning-projects.git cd ~/ros2_ws colcon build source install/setup.bash
-
Run a node (example: number publisher):
ros2 run my_cpp_pkg number_publisher
-
Launch multiple nodes:
ros2 launch my_robot_bringup number_app.launch.py
-
Differences between C++ and Python node implementations in ROS2
-
How to create and use custom messages and services
-
Writing launch files in both XML and Python
-
Organizing a ROS2 workspace with multiple packages
-
Add unit tests for service and topic communication
-
Improve visualization with RViz plugins
Mohammad Alghazawi — Mechatronics engineer (MSc) passionate about robotics, simulation, and ROS2 development.