[ROS in 5 mins] 034 – What is ROS Action?

[ROS in 5 mins] 034 - What is ROS Action?

Written by Bayode Aderinola

03/09/2018

In this post, we will see what a ROS Action is. We’ll also see the difference between a ROS Service and a ROS Action.

Let’s go!

Step 1: Understand blocking and non-blocking activities: two possible ways to buy Pizza

Let’s assume you wish to order some pizza. There are two possible ways you could go about it:

  1. Go the Pizza shop
    1. Place your order.
    2. Wait for the order.
    3. Get the Pizza.
  2. Order online.
    1. Place your order.
    2. Order confirmation notice.
    3. Possibly cancel the order.
    4. Check up your order status once in a while.
    5. Do other things.
    6. Pizza is delivered.

Option 1 is a blocking activity because you have to wait (in theory not able to do anything else) for the pizza, while option 2 is non-blocking because you can do some other things while your order is being processed.

Step 2: Apply blocking and non-blocking concept to ROS

Option 1 (Going to Pizza shop) is similar to a ROS Service, while option 2 is similar to a ROS Action. Not 100% the same, but I suppose you get the point. But what is a ROS Action specifically, in ROS terminology?

An action is an asynchronous call to another node’s functionality. “Asynchronous” means you don’t have to wait for the result. You can do other things pending the result.

The node that provides the functionality has to implement an Action Server (Pizza shop). The node that uses the functionality has to use an Action Client (online ordering system).

Step 3: Dive a bit deeper – ROSified pizza ordering

Now, let’s see what ROS calls each of the steps for buying pizza:

  1. Go the Pizza shop
    1. Place your order (request).
    2. Wait for the order.
    3. Get the Pizza (response).
  2. Order online
    1. Place your order (request).
    2. Order confirmation notice (feedback).
    3. Possibly cancel the order (cancel).
    4. Check up your order status once in a while (status).
    5. Do other things.
    6. Pizza is delivered (response).

To wrap up, consider the image below, saying roughly saying the same thing we have been saying, only in a “thousand words”:

ros_action

 

Extra: Video

Prefer to listen to the “sights and sounds” version of this post? We have one for you below; happy watching!

Further Learning

If you are a ROS beginner and want to learn ROS basics fast, we recommend you take any of the following courses on Robot Ignite Academy:

Feedback

Did you like this post? Whatever the case, please leave a comment in the comments section below, so we can interact and learn from each other.

If you want to learn about other ROS topics, please let us know on the comments area and we will do a post or video about it.

Thank you!

You May Also Like…

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share This