Inferensys

Glossary

ROS Action

A ROS Action is an asynchronous communication interface built on topics that allows a client to request a long-running goal from a server and receive periodic feedback and a final result.
Developer reviewing multi-agent chat interface on laptop, agent conversation logs visible, casual coding session at WeWork desk.
ROBOT OPERATING SYSTEM (ROS)

What is ROS Action?

An asynchronous communication interface for managing long-running tasks in robotic systems.

A ROS Action is an asynchronous communication interface built on ROS topics that allows a client node to request a long-running goal from a server node and receive periodic feedback and a final result. It is designed for tasks like navigation or manipulation, where execution takes significant time and the client needs status updates without blocking. The protocol uses three separate topic channels: a goal, a feedback stream, and a result, managed by an Action Server and an Action Client.

The action lifecycle provides a structured way to handle task preemption, cancellation, and failure recovery, making it superior to a simple service call for non-instantaneous operations. It is formally defined by an .action file, which specifies the goal, result, and feedback message types. This pattern is a core building block in ROS 2 Navigation2 and other complex robotic behaviors, enabling robust, stateful task execution within the ROS graph.

ROBOT OPERATING SYSTEM (ROS)

Core Characteristics of ROS Actions

ROS Actions are a specialized communication interface designed for long-running, interruptible tasks. They extend the basic publish-subscribe model with a structured client-server protocol for goals, feedback, and results.

01

Asynchronous Goal-Based Protocol

A ROS Action is fundamentally an asynchronous, goal-oriented communication pattern. A client sends a goal (e.g., 'navigate to pose X, Y') to an action server. The server executes the potentially long-running task without blocking the client, which can continue other operations, preempt the goal, or cancel it. This contrasts with synchronous ROS Services, which block the client for the entire request duration. The protocol is built on three ROS topics: goal, feedback, and result.

02

Feedback for Progress Monitoring

A key advantage over services is the built-in feedback mechanism. During goal execution, the action server can publish periodic feedback messages on a dedicated topic. This allows the client to monitor progress in real-time (e.g., '60% complete', 'current position: X, Y'). Feedback is crucial for user interfaces and for higher-level planning nodes that need to make decisions based on the progress of subordinate tasks.

  • Example: A navigation action server might stream feedback containing the robot's estimated distance to the goal and current velocity.
03

Preemptable and Cancelable Execution

ROS Actions are designed to be interruptible. A client can send a new goal to the same server, which will preempt the currently executing goal. The client can also explicitly send a cancel request. The action server must handle these interrupts gracefully, typically stopping the current task, performing any necessary cleanup, and sending a canceled result status. This is essential for reactive robotic systems where priorities can change dynamically (e.g., 'stop moving and return to base').

04

Structured Result with Terminal State

Upon completion (successful, preempted, aborted, etc.), the action server sends a final result message to the client. This result is distinct from feedback and contains the outcome of the task. The action protocol defines a standard set of terminal states: SUCCEEDED, ABORTED, CANCELED, etc. This structured termination provides deterministic error handling and allows clients to programmatically react to different completion scenarios.

  • Result vs. Feedback: Feedback is for interim progress; the result is the final, conclusive output of the action (e.g., the final pose achieved, a list of objects grasped).
05

Built on ROS Topics and Services

An Action is not a primitive communication type but a convention and API layer built atop standard ROS Topics and a Service. The ActionLib library in ROS 1 and the rclpy.action/rclcpp::action client libraries in ROS 2 implement this convention. Internally, it uses:

  • A Service for goal submission and cancellation.
  • Three Topics: one for the goal, one for feedback, and one for the result. This design leverages the existing, robust ROS communication infrastructure while providing a higher-level abstraction for complex tasks.
06

Common Use Cases in Robotics

ROS Actions are ideal for any robotic task that is non-instantaneous and benefits from monitoring or interruption.

  • Autonomous Navigation: MoveBase action for sending navigation goals.
  • Manipulation: PickPlace action for complex pick-and-place sequences.
  • Perception: ObjectDetection action for a lengthy scan-and-identify routine.
  • Human-Robot Interaction: SpeechRecognition action for listening and processing audio. In these cases, the action client (e.g., a task planner) can monitor feedback, handle failures, and send new goals without managing low-level topic communication directly.
ROS ACTION PROTOCOL

How ROS Actions Work: The Three-Topic Protocol

The ROS Action protocol is an asynchronous communication interface built on three dedicated ROS topics, enabling long-running, interruptible tasks with continuous feedback.

A ROS Action is an asynchronous client-server interface for executing long-running, preemptible tasks, built on three core ROS topics. The Action Client sends a goal to the Action Server via the /goal topic. The server then publishes periodic feedback on a separate topic while processing the task, and finally sends a result message upon completion or cancellation. This three-topic architecture separates command, status updates, and outcome.

This protocol directly addresses the limitations of ROS Services for extended operations. Unlike a blocking service call, an action allows the client to monitor progress via the feedback stream and cancel the goal mid-execution. The server's state machine manages goal acceptance, execution, and final states (SUCCEEDED, ABORTED, PREEMPTED), providing a robust framework for tasks like navigation, manipulation, or any operation requiring progress tracking and safe interruption.

COMMUNICATION PATTERNS

ROS Action vs. Service vs. Topic

A comparison of the three primary communication mechanisms in the Robot Operating System (ROS), detailing their protocol, use cases, and characteristics.

FeatureTopic (Publish/Subscribe)Service (Request/Response)Action (Goal/Feedback/Result)

Communication Model

Asynchronous, one-way stream

Synchronous, blocking call

Asynchronous, long-running task

Message Direction

One-to-many / Many-to-many

One-to-one (Client/Server)

One-to-one (Action Client/Server)

Blocking Behavior

Non-blocking (fire-and-forget)

Blocking (client waits for reply)

Non-blocking (client can poll/cancel)

Feedback Mechanism

None (independent messages)

None (single result only)

Periodic feedback stream

Preemption/Cancellation

Not applicable

Not applicable

Supported (goal can be canceled)

Primary Use Case

Continuous data streams (e.g., sensor data, odometry)

Quick, deterministic operations (e.g., toggle, calculation)

Long-duration, interruptible tasks (e.g., navigation, manipulation)

Built On

Core ROS messaging

Core ROS messaging

Topics (two topics + one service)

Typical Latency

Low (best-effort or reliable QoS)

Medium (RTT of request + processing)

Variable (depends on task duration)

PRACTICAL APPLICATIONS

Common Use Cases for ROS Actions

ROS Actions are designed for long-running, interruptible tasks that require feedback. This section details the primary robotic scenarios where this asynchronous communication pattern is essential.

03

Long-Running Perception Tasks

Complex perception algorithms like 3D mapping, object recognition in a cluttered scene, or a full system calibration can take seconds. A ROS Action provides the ideal interface: a client requests a scan or analysis, receives periodic feedback (e.g., 'processing scan line 150 of 200', 'percentage of scene segmented'), and gets a final result containing the processed data (e.g., a point cloud map, a list of detected objects).

  • Feedback: percent_complete, current_processing_step
  • Result: point_cloud, detected_objects_array, calibration_transform
  • Client State: The client is not blocked and can perform other computations while waiting for the final result.
04

Autonomous Charging or Docking

Docking a mobile robot with a charging station is a precise, multi-stage process involving approach, alignment, and final connection. A ROS Action manages this sequence: the goal initiates docking, feedback provides status (e.g., 'approaching', 'aligning', 'connected'), and the result confirms success or failure. The action can be preempted if an obstacle blocks the path or if a higher-priority task emerges.

  • Sequential States: Feedback clearly communicates which phase of the docking procedure is active.
  • Error Handling: The result can specify failure modes like alignment_failed or charger_unavailable.
  • Safety: Allows for immediate cancellation if a person enters the docking zone.
05

Multi-Step Task Orchestration

ROS Actions can be composed into hierarchical state machines or behavior trees. A high-level task manager acts as an action client to lower-level skill servers. For example, a 'Deliver Item' task might sequentially call: NavigateToKitchenAction, PickUpObjectAction, NavigateToOfficeAction, PlaceObjectAction. Each sub-action provides its own feedback and result, allowing the orchestrator to monitor the overall task's progress and handle failures at the granular skill level.

  • Composability: Actions are the natural building block for complex, recoverable behaviors.
  • Fault Tolerance: Failure in a sub-action (e.g., object not found) can be reported cleanly to the orchestrator for re-planning.
  • Progress Tracking: The orchestrator can aggregate feedback from all sub-actions to estimate total task completion.
06

Software Update & System Diagnostics

Applying a firmware update or running a comprehensive system self-test are long-running operations with distinct progress stages. A management node sends an update or diagnostics goal. The server provides feedback on the current step (downloading, flashing, testing_motors, testing_sensors) and a final result with a detailed log and pass/fail status. This pattern is superior to a service call, which would block the client for the entire, potentially lengthy, duration.

  • User Feedback: Critical for providing operational status to a human operator via a UI.
  • Interruptibility: Allows an update to be canceled before the irreversible flashing phase.
  • Result Data: The final result can contain a full diagnostic report or update verification hash.
ROS ACTION

Frequently Asked Questions

ROS Action is a core communication protocol for handling long-running, interruptible tasks in robotic systems. These FAQs address its mechanics, use cases, and how it differs from other ROS communication patterns.

A ROS Action is an asynchronous communication interface built on ROS topics that allows a client to request a long-running, interruptible goal from a server and receive periodic feedback and a final result. It operates via a client-server model using three distinct communication channels: a goal topic for sending the task request, a feedback topic for streaming intermediate progress updates, and a result topic for delivering the final outcome. The server executes the task, publishing feedback at its discretion, and eventually sends a result message with a status (e.g., SUCCEEDED, PREEMPTED, ABORTED). This design is ideal for tasks like navigation, manipulation, or any process where completion is not instantaneous and the client needs visibility into progress and the ability to cancel.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.