Important announcement

Dear visitor,

Please note that this OpenCourseWare platform will be replaced at the end of 2026 by a new platform (under the same url ocw.tudelft.nl).

Courses and their contents that are currently available the platform will partly be migrated. URL’s for this content will change and content might be unavailable for some time. In addition, some courses will not be available anymore.

If you are linking to specific courses on this platform (for instance for your students), please take timely measures to avoid problems with access. Possible actions are:

  • Download the materials to your local platform (laptop, server)
  • For educators only (including TU Delft lecturers): Contact us at ocw@tudelft.nl and inform us what course you are using in what context (institute, program, period of use, number of students). We will research (in collaboration with the authors of the course) and decide if we will migrate the course, and if yes, can supply you with a new url.

Thank you.

1.4.1 ROS Actions client server communication

Course subject(s) Module 1. ROS Essentials

In this lecture, we will look into the desirability of (non)-blocking executions, which leads to ROS Actions. We will show you how the terminology works and give an example of implementation of a counter.

We don’t always want blocking execution. ROS Actions allow non-blocking execution. This way, multiple things can happen at the same time. They are a generalized request-response system (as for services): a client-server infrastructure. Actions are defined by three message types:

  1. A goal (request),
  2. The result (response),
  3. And feedback.

There are a few ROS commands to interact with actions:

Generate action messages manually:
$ rosrun actionlib_msgs genaction.py <path_to_action_file>
Show the contents of an action message:
$ rosmsg show <stack_name>_msgs/<ActionMessage>

ROS actions have a few functions available to process requests:

  • The goalCallback function processes a goal request.
  • Goal statuses: ACTIVE, SUCCEEDED, ABORTED.

Nomenclature:

  • Action server: A ROS node that advertises an action, so that other nodes can request action goals to be processed.
  • Action client: A ROS node that sends goal requests to the action server.

Code example

Here, we will show the general structure of an action file.

Requirement: Counter with a 1s delay between each increment.

Goal message: Number to count up to (uint32)
Result message: A status message (string)
Feedback message: The number of counts completed (uint32)

Creative Commons License
Hello (Real) World with ROS - Robot Operating System by TU Delft OpenCourseWare is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://online-learning.tudelft.nl/courses/hello-real-world-with-ros-robot-operating-systems//.
Back to top
[sg_popup id=6]