Ros action concept

HI @staff I am confused about one concept of ROS action is still not clear to me (I forgot to be honest and I need to prepare a presentation right now hehe). Is regarding this video:

I commented in the video below:

Cool explanation. Could you please let more clear in which script the “Other things” can be executed? I mean is this placed in client or server script? Because the server is programmed to execute a task, so I believe for example the guys can do your pizza and also other tasks such as washing some dishes in pizza restaurant while the pizza is inside the oven? Or the client node can do other things such making a juice at home while waits the server produces the pizza? I did not understand this concept of other things applied to a robot application…I mean with a drone, for example, “whos is who” in drone example, where is the client node and where is the server node, and which of them are performing “other things”?

Hi Marcus,

Thanks for contacting us for clarifications. The “other things” apply to the client, which is the code requesting something from the server.

If you write a program to fly a drone, for example, you can make a call to an action server that takes pictures. You just send a command to the action server and fly the drone around pending the time that the server returns the picture taken. If your call to take pictures was to a ROS service, you cannot do anything else until the picture comes back.

I hope this clarifies. Cheers.

1 Like

Thanks @bayodesegun. And the feedback, If I am not wrong, was the picture number (0,1,2,3-10) which was taking place in this drone example.

Let me please add another question, and please let me know if the way I am thinking is right or wrong in the following example. If I be wrong please correct me:

I have a camera inside the car, close to the windshield that is responsible to monitor my driver status (If he is ok or got it asleep)
So I can create a program node to this camera, that detects my driver behaviour based on time he is with his eyes opened. My service client node (a kind of security system in ADAS linked to car speed) sends a request to service server (Camera node), responsible to perform this monitoring task. So:

Client: Request - Eyes status
Server: Response - Opened or closed (0 or 1)

Then based on the response of my server the program (written in cliend node) trigger another node related to the ADAS security system which will perform the most appropriate decision to take based on highway conditions ( stop in the first gas station, or reduce the car speed, issue an alarm sound…or whatever).

If I perform the same task using action, would be:?

The action client send the same function to be performed by the camera node (monitor the eyes condition of the driver, if closed more than X seconds or opened) So in this situation I could have the following feaures:
Action client: Request = Goal = Detect if the driver eyes are closed more than X seconds
Cancel = If the odom is not changing, if the car speed is 0, if the car is powered off and more safe conditions (Meaning that the car is stopped), cancel the goal (monitoring) sent to the camera node.
Other Things = Select and play a music which is more appropriate to adjust the driver condition (Let suppose that there is another camera node which is detecting driver behaviour: angry, too calm, in a hurry, depressive, distracted, etc).

Action server: Response: Opened or closed - 0 or 1
Status: IF the node is running properly ( If I am not wrong: Warning, error, success…right?)
Feedback: The size of the pupile of the driver (how much is closed or opened, for example)

Ok, questions:
1 - In service communication, the service server can also send a feedback for the client (for example, the driver face’s eyes situation - size of the pupile, how much the eyes are opened or closed, etc?)
Can in service communication, send the status such as action?
Regarding the differences, is right to affirm that in Service communication I could not execute these other things (Switch on some specific music in radio, based on driver behaviour while the server is executing the monitoring task- eyes opened or closed more thant x seconds)…and is action communication I could perform this radio “function” while the monitoring node does not return the driver asleep status?

I don’t know if this example would be applicable, because these communications are synchronous, so need they be limited in time? Or could be used during hours of a trip such I have supposed?
And maybe the server function could be just emmit a response when the eyes are closed more than X seconds, and not monitor if they are opened, otherwise, the action or service server would finish if the driver eyes be opened, and stop monitoring. Or could I use this in a kind of continuous loop?

2 posts were split to a new topic: Clarifications on ROS Messages, Topics (Publishers & Subscribers), Services & Actions

Hi Marcus,

Let’s keep things simple. A call to a ROS Service (that is, to the service server) is synchronous (you have to wait for it and can’t move on till you get the result) while a call to a ROS Action is async (just make the call and do other things while the answer comes). If you have worked with JavaScript, you will understand the sync/async concept better.

A ROS-based car system will benefit more from action calls in most places otherwise the controlling node will be blocked waiting for service calls to complete. Perhaps there will be certain call where everything should stop until there’s an answer…a service call would be appropriate in that case.

1 Like

Hi Marcus,

Let’s keep things simple. A call to a ROS Service (that is, to the service server) is synchronous (you have to wait for it and can’t move on till you get the result) while a call to a ROS Action is async (just make the call and do other things while the answer comes). If you have worked with JavaScript, you will understand the sync/async concept better.

A ROS-based car system will benefit more from action calls in most places otherwise the controlling node will be blocked waiting for service calls to complete. Perhaps there will be certain call where everything should stop until there’s an answer…a service call would be appropriate in that case.