ROS Create Custom Action

In this tutorial you’ll learn how to create a custom ROS action, and import it in your code (Python and Cpp). Using ROS actions is quite handy when you need an asynchronous client/server mechanism. You can of course use some of the existing Action definitions, but oftentimes you’ll need some sort of customization. Setup the … Read more

ROS Topic Remap [Example]

In this tutorial I’ll show you how to remap a ROS topic. Remapping a topic means that you’ll change the topic name at run-time. If a node publishes on “topic1”, then you can make it publish on “topic2” instead, without having to change the code of the node. First things first, let’s understand why. Why … Read more

[ROS] Include a Cpp header from another package

You want to include a Cpp header from another package in ROS, and don’t know how to do? Or you already tried and got a lot of compilation errors? Well, this tutorial is for you. I will start from scratch with a brand new custom library, build it inside a package, install it, and use … Read more

ROS AsyncSpinner Example

In this tutorial I’ll show you how to use a ROS AsyncSpinner with an example. You’ll see when using a roscpp AsyncSpinner is required, instead of the standard roscpp spinner. This tutorial could also be called: how to solve roscpp callback issues, when it seems that some callbacks are stuck or late. We’ll start by … Read more

[ROS] How To Import a Python Module From Another Package

In this tutorial I’ll show you how to import a Python module from another package. ROS allows you to do that, and as you’ll see it’s quite simple. If you have a package which contains some common tools, helper functions, utils, or other stuff like that, you may want to be able to write the … Read more

Package Organization For a ROS Stack [Best Practices]

What is the best package organization for your ROS stack? How can your better separate your code into different packages? Although there is no right answer to this question, and everyone is free to do what they think is best, I’ll try to give here some feedback from my own experience. I have analyzed what … Read more

ROS Param Command Line Tool – Practical Example (rosparam)

This tutorial is a practical guide on how to use rosparam command line tool to debug ROS Params. ROS params are really useful to launch your ROS application with different setup settings, without having to re-write and re-compile any part of your code. With the rosparam command line tool, you’ll be able to test your … Read more

Create a ROS Node Outside a Catkin Workspace

In this tutorial I’ll show you how to create a ROS node outside a catkin workspace – both for Python and Cpp. Most of the post is dedicated to linking ROS libraries to a Cpp file, because as you’ll see it’s quite simple for Python. Why would you want to create a node outside of … Read more

When to use Python vs Cpp with ROS

You’re programming with ROS, or are just getting started, and you wonder: should you use Python vs Cpp with ROS? Of course… It depends. But in this post I’ll try to go beyond this “it depends” answer, to give you some points on when to you use one language or the other. To this question, … Read more

ROS Duration (roscpy and roscpp)

In this tutorial I’ll show you how to use ROS Duration in your ROS code – for roscpp and rospy. Through several examples you’ll see some of the most common use cases where ROS Duration is useful. Also, for each example you’ll learn about the differences between the Python and Cpp implementation, which is sometimes … Read more

rqt graph – Visualize and Debug Your ROS Graph

Rqt graph is a very useful tool to see what’s going on in your ROS graph. It’s a GUI plugin from the Rqt tool suite. In this tutorial I’ll show you how to install and use it. What is rqt graph Rqt graph is a GUI plugin from the Rqt tool suite. With rqt graph … Read more

rqt plot – Easily Debug ROS topics

In this tutorial I’ll show you what is ROS rqt plot and how to use it efficiently, through some examples. What is rqt plot and what to do with it Rqt is a very useful ROS tool to help you during your ROS development. It’s based on the Qt framework and includes a lot of … Read more

ROS Rate (rospy and roscpp)

ROS Rate is a powerful ROS feature you can use for your control loops – be it for reading a sensor, controlling a motor, etc. In this tutorial I’ll explain to you what is a ROS Rate, and you’ll see the code to use a rospy Rate and a roscpp Rate. Let’s get started! ROS … Read more

ROS: Create Multiple Catkin Workspaces

In this tutorial I’ll show you how to create multiple catkin workspaces with ROS. Sometimes you want to create different projects for different robots. The easiest way to manage that is to create several catkin workspaces, one for each robot project. But it’s not as simple as that. There are a few things you need … Read more

Get and Set ROS Params with rospy and roscpp

In this tutorial you’ll learn how to set and get ROS params with code, inside your nodes. You’ll see how to handle params with both rospy and roscpp. ROS parameters are quite useful to set global settings for your application. All your nodes can get access to those settings. And the best thing is: you … Read more

ROS Param YAML Format

In this tutorial I’ll show you how to handle ROS params with a YAML file. ROS parameters are a great way to modify settings in your program without having to re-compile anything. But when you start to have many ROS params – sometimes more than a few hundreds – things  start to become quite complicated. … Read more

OOP with ROS in Cpp

In a previous tutorial I’ve shown you how to write OOP code with ROS in Python. Now, time to use OOP with ROS in Cpp! I’ll use here the same application to write an example, so you can easily compare all 4 codes: Python/Cpp with/without OOP. If you haven’t read the Python tutorial: the application … Read more

OOP with ROS in Python

You are starting to develop with ROS and come from a programming background. Maybe you’re already using OOP in many of your programs, and you wonder how you can use OOP with ROS in Python. In this post I’ll show you a complete Python example, without OOP, and then with OOP. The code will contain … Read more

What is ROS?

You want to develop robotics applications, and have discovered ROS. But you’re confused… What is ROS? ROS means Robot Operating System. It’s quite hard to understand what is ROS from the beginning. Is it an operating system? A framework? What should you do with it? When I first started a few years ago, it took … Read more

How To Use a ROS Anonymous Node

First, to understand when you should use a ROS anonymous node, let’s start with the problem. So, you’ve just created a node for your infra-red sensor, it works well, and you’re happy with it. But now, your robot has 12 infra-red sensors. Knowing that a node should have a unique name, and that you can’t … Read more

What is a ROS Launch File?

What is a ROS launch file? As we did for ROS parameters, let’s first start with the problem. This post is a part of the What is ROS? series. Your robotics application is growing Let’s say you now have an application with 6 nodes and 10 parameters. When you want to start your application, you … Read more

What is a ROS Parameter?

What is a ROS parameter ? Before diving into the explanation, let’s see the problem we have here. This post is a part of the What is ROS? series. Why do you need ROS parameters ? So, you have a nice robot application with many packages and nodes inside those packages. Great! Now, you want … Read more

What is a ROS Message?

You may already have heard about ROS topics and services using ROS messages. So… What is a ROS message ? This post is a part of the What is ROS? series. ROS messages in topics and services If you haven’t read the explanations on ROS topics and ROS services yet, please read them now and … Read more

What is a ROS Service?

After learning a little bit about ROS, you now have this question in mind: what is a ROS service ? As I did for ROS topics, let’s start with a real life analogy. I will use an analogy with a weather service online. The analogy may not be 100% accurate but the point is to … Read more

What is a ROS Topic?

You are starting with ROS and are wondering: what is a ROS topic ? To explain what is a ROS topic, I will use here a different approach from what you can already find on the Internet. Instead of giving you a bunch of code to write and run, I will use a real life … Read more

What is a ROS Node?

As you start to learn ROS, you’ve quickly discovered that everything in ROS is made with components called nodes. So, what is a ROS node ? In this post I’ll explain you the concept and the “why” behind ROS nodes. It’s important to know why you need them before you actually use them for real. … Read more