Vaibhav Shende Vaibhav Shende

Catch-a-Turtle — ROS 2 Turtlesim Chase System

ROS 2 application with two-node architecture for autonomous turtle chasing. Spawner creates turtles at random positions; controller identifies nearest target and pursues autonomously.

Navigation Robotics Software
Catch-a-Turtle — ROS 2 Turtlesim Chase System

Overview

Two-node ROS 2 system where a control turtle autonomously chases and captures randomly spawned turtles using nearest-neighbor targeting and PID control.

Catch-a-Turtle gameplay demonstration

System Architecture

Node 1: Turtle Spawner

  • Spawns multiple turtles at random positions
  • Maintains list of alive turtles
  • Publishes alive_turtles (custom TurtleArray message)
  • Handles turtle removal service

Node 2: Turtle Controller

  • Subscribes to alive turtles list
  • Identifies nearest target using distance calculation
  • Publishes velocity commands to control turtle
  • Uses PID controllers for linear and angular motion
  • Calls service to remove caught turtle

Technical Implementation

  • Language: C++
  • Framework: ROS 2 (Humble)
  • Simulator: Turtlesim
  • Control Loop: 100 Hz (10 ms timer)
  • Navigation: Custom PID controllers (linear Kp=1.0, angular Kp=4.0)

Custom Interfaces

TurtleArray Message: Array of turtle poses with x, y, theta coordinates

TurtleCatch Service: Request turtle ID to catch and remove

Getting Started

git clone https://github.com/svaibhav101/Catch-a-Turtle.git
cd catch_a_turtle && colcon build
source install/setup.bash
ros2 run turtle_chaser turtle_spawner_node &
ros2 run turtle_chaser turtle_control_node

Features Demonstrated

✅ Custom ROS 2 message definition (TurtleArray)
✅ Custom service definition (TurtleCatch)
✅ Multi-node communication (pub/sub + services)
✅ PID control for robot navigation
✅ Real-time target tracking and pursuit
✅ Turtlesim integration with custom behaviors