Skip to content

Latest commit

 

History

79 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 ROS2-Learning — ROS 2 Jazzy

ROS2 Ubuntu License

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.


Concepts Covered

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

TurtleSim — Catch Them All

One of the main projects in this repository is a TurtleSim project where turtle1 automatically moves toward randomly spawned turtles and catches them.

How it works

  • 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.
  • turtle1 is controlled using geometry_msgs/Twist.
  • When the target is reached, a custom CatchTurtle service removes the turtle.
  • ROS 2 parameters are used to control the spawn frequency, turtle name prefix, and target selection.

Nodes

turtle_spawner
      │
      │ alive_turtles
      ▼
turtle_controller
      │
      │ /turtle1/cmd_vel
      ▼
    turtle1

🛠️ Setup

Prerequisites

  • Ubuntu 24.04
  • ROS 2 Jazzy
  • Python 3
  • colcon
  • turtlesim

Clone the Repository

git clone https://github.com/sujan-coder/ROS2-Learning.git
cd ROS2-Learning

Build the Workspace

source /opt/ros/jazzy/setup.bash
colcon build
source install/setup.bash

Run TurtleSim Project

1. Start TurtleSim

Open a terminal and run:

ros2 run turtlesim turtlesim_node

2. Start the Turtle Spawner

Open another terminal:

source install/setup.bash
ros2 run turtlesim_catch_them_all spawner

3. Start the Controller

Open a third terminal:

source install/setup.bash
ros2 run turtlesim_catch_them_all controller

The spawner will create turtles at random positions, and the controller will automatically move turtle1 toward them and catch them.


Repository Structure

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

Tools & Technologies

  • ROS 2 Jazzy
  • Ubuntu 24.04
  • Python
  • C++
  • rclpy
  • colcon
  • TurtleSim
  • ROS 2 Nodes
  • Publishers & Subscribers
  • Services
  • Parameters
  • Custom Messages & Services

Learning Progress

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.

Currently Learning

  • ROS 2 Nodes
  • Topics
  • Publishers & Subscribers
  • Services
  • Custom Interfaces
  • Parameters
  • Launch files
  • Robot bringup
  • Hardware interfaces

Note:

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.

About

ROS2 learning and robotics development on Raspberry Pi with custom nodes, interfaces, and experiments

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages