ROS - Introduction

Introduction presentation for the Robot Operating System (ROS).

Newcastle Racing AI (NRAI) team

What is ROS

ROS is a set of software libraries and tools for building robot applications.

It spans from drivers to state-of-the-art algorithms, and includes powerful developer tools, including streamlined build systems and package managers.

Who is ROS

ROS started as a personal project of Keenan Wyrobek and Eric Berger while at Stanford.

See some of the people bethind the project

When is ROS

ROS development began in 2007, with an exponential growth in the following years.

Loading diagram...

Where is ROS

In the ❤️ of the many developers that made it possible.

Being open source, you can find the source code on Github.

Why is ROS

No time to reinvent the wheel!

Loading diagram...
Loading diagram...

Confusing versioning

ROS1 is the original version, now deprecated.

A lot of changes between ROS1 and ROS2; they are not compatible.

ROS1ROS2
C++03C++11/14
Python2Python3.5+
XML launchPython launch
Master nodeDistributed
catkincolcon

Confusing distributions

DistroReleaseEOLUbuntu
Kilted Kaiju2025202624.04
Jazzy Jalisco2024202924.04
Iron Irwini2023202422.04
Humble Hawksbill2022202722.04
Galactic Geochelone2021202220.04
Foxy Fitzroy2020202320.04

See all the ROS distros

ROS basics

We will follow the official Humble tutorial, focusing only on the most relevant parts.

Nodes

Nodes

Topics

Topics

Services

Services

Actions

Actions

Sourcing

ROS uses a set of utilities that may differ from the ones installed on your machine or the ones used by other ROS distro. To avoid conflicts, you need to source the version of ROS you want to use.

# Every time you open the terminal
source /opt/ros/humble/setup.bash

Alternatively, put the same comment in the ~/.bashrc file

# One time
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

Running nodes

To make sure everything is set up properly, run the turtle_sim node

ros2 run turtlesim turtlesim_node

Opening another terminal, run the controller node

ros2 run turtlesim turtle_teleop_key

Play around with the turtle and try to draw a rectangle.

ROS command line

Leaving the nodes running, open another terminal to gather some information.

ros2 node list
ros2 topic list
ros2 service list
ros2 action list

If a GUI is available, a complete overview can be achieved with

# ROS network
rqt_graph
# Log messages
ros2 run rqt_console rqt_console

Creating a Package

What makes ROS extensible is the ability to create packages.

Packages can then be shared between other users, avoiding the need to reinvent the wheel every time.

Package structure

workspace_folder/
└── src/
    ├── cpp_package_1/
   ├── CMakeLists.txt
   ├── include/cpp_package_1/
   ├── package.xml
   └── src/
    ├── py_package_1/
   ├── package.xml
   ├── resource/py_package_1
   ├── setup.cfg
   ├── setup.py
   └── py_package_1/
    ├── ...
    └── cpp_package_n/
        ├── CMakeLists.txt
        ├── include/cpp_package_n/
        ├── package.xml
        └── src/

Challenges

This is a Capture the Flag (CTF) challenge, borrowed from cybersecurity competitions.

Each challenge hides a flag somewhere. Complete the challenge and claim the flag for your team.

The first team to submit the most flags wins the challenge.

The first challenges are the simplest. Use this information to your advantage.

Challenge 1: echo

The challenge 1 node keeps spamming its topic with the flag you are looking for.

Find the right topic and read the flag.

ros2 run nrai-ctf challenge1

Challenge 2: mental math

The challenge 2 node has some math questions for you.

Answer correctly to all of them and it might give you the flag.

ros2 run nrai-ctf challenge2

Challenge 3: ping pong

The challenge 3 node just wants to play table tennis.

Reply to its services correctly 10 times in a row to obtain the flag. The node will wait for your PONG on the /challenge_3_pong topic to start sending messages.

ServerCorrect reply
PINGPONG
PONGPING
ros2 run nrai-ctf challenge3

Challenge 4: service

The challenge 4 node is very polite.

Ask for the flag with a service and you will get it.

ros2 run nrai-ctf challenge4

Challenge 5: fast mental math

There is no time to waste!

The challenge 5 node will wait for a 00 Int32 message on /challenge_5_answer. After that, it will start sending Vector3 messages on /challenge_5_question.

# Vector3 message on the `/challenge_5_question` topic
x: 4.0 # Counter of the current question
y: 10.0 # First addend
z: 29.0 # Second addend
# Expected result: 39

Sum the two addends and return the result back on /challenge_5_answer. After 100 correct and fast answers, you will get your flag on /challenge_5_topic.

ros2 run nrai-ctf challenge5