Ros2 — Unveiling the Power of ROS 2: A Comprehensive Exploration of Key Features and Usage

Abhishek Malhotra
4 min readJan 24, 2024

--

The world of robotics is evolving at an unprecedented pace, and at the heart of this revolution is the Robot Operating System 2 (ROS 2). ROS 2 has emerged as the go-to platform for designing and developing complex robotic systems, offering a plethora of advanced features that cater to the diverse needs of the robotics community. In this post, we will delve into the key features of ROS 2 and provide insights into its practical usage.

The first thing from which i initiated the journey of ROS2 is turtlesim

Turtlesim- Turtlesim is a simple and interactive simulation environment in the Robot Operating System (ROS) ecosystem. Designed for educational purposes and as a beginner-friendly introduction to ROS concepts, turtlesim features a graphical interface where users can interact with a turtle robot within a simulated 2D environment.

Turtlesim- Package

When I started using turtlesim, I played around with making the turtle move using ROS2. I could make it rotate and go in different directions. What’s interesting is that when I press an arrow key, the turtle only moves a bit and then stops. This is intentional because, in real life, we wouldn’t want a robot to keep doing things if, for example, the person controlling it loses connection. It’s like a safety measure to make sure the robot doesn’t do anything unexpected.

Service- What is a service ?

In ROS 2, services are a communication mechanism that allows nodes (software components) to request specific tasks or information from other nodes. Services enable a “request-response” pattern of communication between nodes, where one node sends a request to another node, and the recipient node processes the request and sends back a response.

Nodes — They are individual software components that perform specific tasks in a robotic system. They can communicate with each other to share information and work together.

RQT

RQT is the Robot GUI Toolkit in ROS, offering a graphical interface with customizable plugins for visualizing, interacting with, and analyzing various aspects of robotic systems. It allows users to monitor services, topics, and sensor data, providing a user-friendly toolset for working with ROS-enabled robots.

RQT-Services

With the assistance of RQT, we can observe the active services and utilize those that are available. Once a single turtle is present on the screen, if we wish to introduce another one, we can make use of the “SPAWN” service.

SPAWN

This particular service, aptly named “SPAWN,” provides functionality where users can input a name for a new turtle and define its initial coordinates using x and y values. By leveraging this service, a new turtle is generated on the screen with the specified name and coordinates. It essentially allows users to dynamically introduce additional turtles into the environment, each identified by a unique name and positioned according to the provided coordinates.

TELE-OPERATION

By running a new node turtle_teleop_key we can use the arrow keys on keyboard to control the turtle. It will move around the screen, using its attached “pen” to draw the path it followed so far.

Tele-operation of turtle using Tele-operation node

Now Let’s SPAWN another Turtle

2 Turtles

Now with the help of the new service SetPen — This service, as its name implies, facilitates the alteration of the pen color on the TurtleBot. Once this service is configured, we have the flexibility to adjust the values of red, green, and blue to our preferences.

Color of the Pen is changed to green

As shown in the figure now we have changed the color of the pen to green!

Now we need a second node to run the other turtle as shown in the figure below

Tele-operation of 2nd turtle

In conclusion, this project delved into the intricacies of ROS 2, exploring the fundamental concepts of nodes, services, and teleoperation to orchestrate the movement of two turtles. Nodes served as autonomous entities, encapsulating specific functionalities, while services provided a means for dynamic communication, exemplified by the color-changing service. The teleoperation aspect enabled real-time control over the turtles, showcasing the dynamic and interactive nature of ROS 2. By navigating the nuances of these core components, we achieved a comprehensive understanding of how ROS 2 facilitates seamless communication and coordination between different elements in a robotic system. This project lays the groundwork for more sophisticated and interconnected robotic applications, emphasizing the versatility and scalability of ROS 2 in robotics development.

--

--

Abhishek Malhotra
0 Followers

An automotive engineer having interest in Smart vehicles and Advanced driveer assistance service