EP4 - 10 things you need to know about ROS!

Video: https://youtu.be/KAASuA3_4eg

#Robotics #Hardware #ROS #Linux

Read more here

🔙 Previous Part | Next Part 🔜

↩️ Go Back

Table of Contents:


Introduction: Exploring Core ROS Concepts

Hello everyone! Today we’re taking a bird's-eye view of ROS and exploring some of its core components and how they fit together.

As a practical example, I’ll be connecting two LiDAR sensors and showing you how to interact with them using ROS.

We’re going to move pretty quickly, so if anything is confusing, take a look at the blog post here


What is ROS? (about ROS Distributions)

Although ROS stands for Robot Operating System, it’s not actually an operating system. Instead, it’s a set of common libraries and tools for building complex robotic systems.

New versions of ROS, called distributions, are released each year in May, typically designed to run on the latest LTS version of Ubuntu.

Although ROS can run on other Linux distributions, Mac, and Windows, beginners should start with Ubuntu because it’s best supported.


ROS 2: The Latest Evolution of ROS

A few years ago, ROS went through a major upgrade, and since then, new releases have been part of ROS 2. While there’s still a lot of documentation for ROS 1, it’s no longer receiving updates. Our tutorials will focus on ROS 2, specifically the LTS releases running on Ubuntu.


Understanding ROS Nodes

A ROS system is made up of smaller programs called nodes, which are like any other command-line program on Linux but use the ROS library.

A ROS node is typically designed to perform a specific task within a larger system. These tasks can include:

Each ROS node on a single computer, or across multiple computers within the same network, all form part of a ROS network, where they can communicate with each other.

This setup provides a great deal of flexibility, as it is equally easy to develop systems that run entirely on one machine or with components distributed across several machines.

Essential ROS commands for Nodes (LiDAR Example) - "Outdated DEMO"

Two essential ROS commands when working with nodes are:

Let’s work with a practical example using an RP LiDAR connected to a Raspberry Pi.

The Pi is on the same network as my development machine.

I am using two terminals on the Raspberry Pi and one terminal from the Dev Machine for this setup.

Running and Listing ROS Nodes: I’ll show you how to do it.

In this case, we run the LiDAR driver with the command:

Copy to Terminal:

ros2 run rplidar_ros rplidar_node


ROS Topics and Messages

Nodes communicate using topics and messages.

A topic is a named location where "publisher" nodes can publish messages, and other "subscriber" nodes can subscribe to that topic and receive the messages.


Read more here

A node can act as a publisher for one message while simultaneously being a subscriber to another message, and the best part is, we don’t even need to worry about whether the publisher and subscriber are on the same computer. ROS handles all of that for us. All we need to do is specify the topic name and the type of message we're publishing or subscribing to.

The topic system is particularly useful because it allows us to create smaller, more focused nodes that excel at a single task while communicating with one another to solve larger problems.

For example, the RP LIDAR node only needs to handle communication with the laser hardware and publish a laser scan message.

To see the topics and messages:


Services in ROS

Sometimes, we need a more direct communication method than topics. ROS provides services for this purpose, where nodes can send a request and get a reply. For example, the LiDAR driver offers a stop motor service. To manually call a service:


Parameters and Remapping in ROS

Parameters let us configure how nodes behave. For instance, if you have two LiDARs, each needs to connect to a different serial port. Remapping allows us to change the names of topics, services, or other named entities. This helps avoid naming conflicts when running multiple nodes.


Namespaces and Organizing Nodes

Instead of remapping individual topics, ROS allows us to place nodes in namespaces, which keeps everything organized and prevents naming conflicts. For example, if we have two LiDARs, we can place each in its own namespace, such as scanner1 and scanner2.


Launch Files in ROS

In ROS, we often run the same nodes repeatedly with the same parameters. Launch files allow us to automate this. In ROS 2, launch files are written in Python, which provides more flexibility compared to the XML syntax used in ROS 1. To run a launch file:


Organizing ROS Projects with Packages

ROS projects are organized into packages, which group related files such as nodes, launch files, and robot models. A package also lists its dependencies, i.e., other packages it needs to function. For example:


Building ROS Workspaces with Colcon

When we work on ROS projects, we organize our code in a workspace, which keeps all our packages together. We use Colcon, the ROS build tool, to compile and organize our packages. When Colcon builds the workspace, it creates a setup.bash file that we need to source in order to use the built packages:


Underlays and Overlays in ROS

ROS distinguishes between underlays and overlays. The system-installed ROS distribution is the underlay, while the workspace we build is the overlay. When ROS looks for packages, it checks the overlay first, then the underlay.


Quality of Service (QoS) in ROS 2

Quality of Service (QoS) is a feature introduced in ROS 2 that allows nodes to agree on how they’ll use a topic. For example, some nodes may need to receive every message, while others only need the latest message. If a publisher and subscriber don’t have compatible QoS settings, they won’t communicate, which can cause confusing problems for beginners.


Conclusion: Wrapping Up ROS Concepts

Thanks for watching! If you found this helpful, please like and subscribe. If you have any questions, let us know in the comments or check out the blog post linked in the description for more details. See you next time!


🔙 Previous Part | Next Part 🔜

↩️ Go Back


Z) 🗃️ Glossary

File Definition
Uncreated files Origin Note