A hands-on learning repository for ROS 2 Jazzy. This repository contains the exercises and projects I am building while learning ROS 2 using Python and C++.
The goal is to understand the fundamentals of ROS 2 through practical examples before moving on to larger robotics projects.
| Concept | Example | Language |
|---|---|---|
| Nodes | my_first_node |
Python / C++ |
| Publisher | robot_news_station |
Python |
| Subscriber | smartphone |
Python |
| Custom Messages | HardwareStatus.msg |
ROS 2 Interface |
| Service Server | battery_node |
Python |
| Service Client | battery_client |
Python |
| Parameters | yaml_params/robot_params.yaml |
Python |
| Launch / Bringup | my_robot_bringup |
Python |
| Custom Interfaces | my_robot_interfaces |
ROS 2 Interface |
| TurtleSim Project | turtlesim_catch_them_all |
Python |
One of the main projects in this repository is a TurtleSim project where turtle1 automatically moves toward randomly spawned turtles and catches them.
- A spawner node creates turtles at random positions.
- The spawner keeps track of the active turtles.
- Turtle information is published using a custom ROS 2 message.
- The controller node receives the turtle positions.
- The controller calculates the distance and angle to the target.
turtle1is controlled usinggeometry_msgs/Twist.- When the target is reached, a custom
CatchTurtleservice removes the turtle. - ROS 2 parameters are used to control the spawn frequency, turtle name prefix, and target selection.
turtle_spawner
│
│ alive_turtles
▼
turtle_controller
│
│ /turtle1/cmd_vel
▼
turtle1
- Ubuntu 24.04
- ROS 2 Jazzy
- Python 3
colconturtlesim
git clone https://github.com/sujan-coder/ROS2-Learning.git
cd ROS2-Learningsource /opt/ros/jazzy/setup.bash
colcon build
source install/setup.bashOpen a terminal and run:
ros2 run turtlesim turtlesim_nodeOpen another terminal:
source install/setup.bash
ros2 run turtlesim_catch_them_all spawnerOpen a third terminal:
source install/setup.bash
ros2 run turtlesim_catch_them_all controllerThe spawner will create turtles at random positions, and the controller will automatically move turtle1 toward them and catch them.
ROS2-Learning/
│
├── src/
│ ├── esp_interface/
│ ├── my_cpp_pkg/
│ ├── my_py_pkg/
│ ├── my_robot_bringup/
│ ├── my_robot_interfaces/
│ │
│ └── turtlesim_catch_them_all/
│ ├── package.xml
│ ├── setup.py
│ └── turtlesim_catch_them_all/
│ ├── turtle_controller.py
│ └── turtle_spawner.py
│
├── yaml_params/
├── LICENSE
└── README.md
- ROS 2 Jazzy
- Ubuntu 24.04
- Python
- C++
- rclpy
- colcon
- TurtleSim
- ROS 2 Nodes
- Publishers & Subscribers
- Services
- Parameters
- Custom Messages & Services
This repository is a work in progress.
I am using it to learn ROS 2 by building small working examples and gradually applying the concepts to more complex projects.
- ROS 2 Nodes
- Topics
- Publishers & Subscribers
- Services
- Custom Interfaces
- Parameters
- Launch files
- Robot bringup
- Hardware interfaces
This repository is part of my personal ROS 2 learning journey. Some examples are based on coursework, while others are modified as I learn and experiment.