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:
- Go the Pizza shop
- Place your order.
- Wait for the order.
- Get the Pizza.
- Order online.
- Place your order.
- Order confirmation notice.
- Possibly cancel the order.
- Check up your order status once in a while.
- Do other things.
- 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:
- Go the Pizza shop
- Place your order (request).
- Wait for the order.
- Get the Pizza (response).
- Order online
- Place your order (request).
- Order confirmation notice (feedback).
- Possibly cancel the order (cancel).
- Check up your order status once in a while (status).
- Do other things.
- 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”:
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!
0 Comments