Turtlesim - dhanushshettigar/Getting-Started-With-ROS2 GitHub Wiki

Turtlesim Demo in ROS 2 (Jazzy)

This demo provides an introduction to using the turtlesim package in ROS 2 (Jazzy distro). Turtlesim is a simple graphical simulator that demonstrates basic ROS 2 concepts like publishing, subscribing, and service calls.

Table of Contents

  1. Prerequisites
  2. Setup Instructions
  3. Conclusion

Prerequisites

Ensure you have the following installed:

  • ROS 2 Jazzy (Jazzy distro)
  • A terminal application
  • Install Turtlesim
sudo apt update

sudo apt install ros-jazzy-turtlesim

Setup Instructions

Step 1: Source the ROS 2 Jazzy Environment

Before running ROS 2 commands, ensure your environment is set up properly by sourcing ROS 2 Jazzy:

source /opt/ros/jazzy/setup.bash

Step 2: Start the ROS 2 Turtlesim Node

Launch the turtlesim_node using the following command:

ros2 run turtlesim turtlesim_node

A window with a turtle in the center should appear, and this turtle will respond to ROS 2 commands.

Step 3: Move the Turtle Using Teleop

To move the turtle using your keyboard, you can use the teleop package. Open a new terminal and run:

ros2 run turtlesim turtle_teleop_key

Now, you can control the turtle by pressing the following keys:

  • W - Move forward
  • A - Turn left
  • S - Move backward
  • D - Turn right

Conclusion

This is a simple demo of the turtlesim package in ROS 2 Jazzy. You can explore more by learning about ROS 2 topics, services, and actions. Check the official ROS 2 documentation for further exploration.