A ROS Service is a synchronous, request-response communication mechanism where a client node sends a request to a server node and blocks execution until it receives a reply. This pattern is defined by a .srv file, which specifies the exact data structure for both the request and response messages. Unlike the continuous, many-to-many flow of ROS Topics, a service provides a direct, one-to-one procedure call abstraction, making it ideal for on-demand operations like calculations, state queries, or triggering discrete actions.
Glossary
ROS Service

What is a ROS Service?
A core communication mechanism within the Robot Operating System (ROS) framework for synchronous, request-response interactions between nodes.
Services are built on top of the same underlying transport layer as topics but implement a blocking client call. The server node advertises a service by name and type, and client nodes can then discover and call it. This mechanism is fundamental for implementing deterministic, transactional interactions in a robotic system, such as requesting a map conversion, querying sensor calibration, or initiating a specific diagnostic check. For long-running or interruptible tasks, the ROS Action interface is typically more appropriate.
Key Characteristics of ROS Services
ROS Services provide a synchronous, request-response communication mechanism, distinct from the asynchronous publish-subscribe model of ROS Topics. This section details their defining operational features.
Synchronous Request-Response
A ROS Service is a blocking, one-to-one communication pattern. A client node sends a request message to a server node and blocks its execution thread until it receives a reply. This is fundamentally different from the asynchronous, streaming nature of topics.
- Blocking Call: The client's
call()orcall_async()(followed byspin_until_future_complete) function waits for the server's response. - Defined Interface: Each service has a single, strictly typed
.srvfile defining the structure of the request and response messages. - Use Case: Ideal for remote procedure calls (RPC), performing calculations, querying a database, or triggering a discrete, non-continuous action where an immediate result is required.
Service Definition (.srv File)
The communication contract for a service is defined in a .srv file. This file specifies the exact data types for the request and the response, separated by three dashes (---).
Example (AddTwoInts.srv):
codeint64 a int64 b --- int64 sum
- Top Section (Request): Defines the message the client must send (
aandb). - Bottom Section (Response): Defines the message the server will return (
sum). - Strict Typing: Like ROS messages,
.srvdefinitions use primitive types (e.g.,int32,string,bool) or other message types, ensuring data integrity. The ROS build system generates language-specific code (e.g., C++/Python classes) from these files.
Server-Client Architecture
The service pattern enforces a clear server-client relationship, unlike the many-to-many topology of topics.
- Service Server: A node that advertises a service by name (e.g.,
/add_two_ints). It registers a callback function that is executed each time a request is received. This function processes the request data and must return a response message. - Service Client: A node that creates a client for a specific service name. It populates a request message object and calls the service. There can be multiple clients for a single server.
- Discovery: Using the underlying middleware (e.g., DDS in ROS 2), clients dynamically discover available servers. A client will fail if it attempts to call a service for which no server is currently advertising.
Comparison with Topics and Actions
ROS Services fill a specific niche between Topics and Actions in the ROS communication toolbox.
| Feature | ROS Topic | ROS Service | ROS Action |
|---|---|---|---|
| Model | Publish-Subscribe (async stream) | Request-Response (sync call) | Goal-Feedback-Result (async task) |
| Blocking? | No | Yes (client side) | No (client can poll) |
| Data Flow | One-way, continuous | Two-way, single exchange | Two-way, with intermittent feedback |
| Best For | Sensor data, state updates | RPC, quick computations | Long-running, interruptible tasks (e.g., navigation) |
Services are simpler than Actions but lack feedback and preemption capabilities, making them unsuitable for long-duration operations.
Common Use Cases & Examples
ROS Services are employed for discrete operations where a direct answer is needed.
- Configuration & Calibration: A client calls a
set_parametersservice to configure a sensor node. - Triggering Operations:
save_map,start_recording, orcalibrate_imu. - Querying State:
get_planfrom a planner,get_transformfrom TF (though TF2 uses a more efficient system). - Simple Computations: A centralized
calculate_inverse_kinematicsservice for a manipulator.
ROS 2 Python Example (Client):
pythonfrom example_interfaces.srv import AddTwoInts ... client = node.create_client(AddTwoInts, 'add_two_ints') req = AddTwoInts.Request() req.a = 5 req.b = 3 future = client.call_async(req) rclpy.spin_until_future_complete(node, future) response = future.result() node.get_logger().info(f'Sum: {response.sum}') # Output: 'Sum: 8'
ROS 2 Quality of Service (QoS) for Services
In ROS 2, service communication benefits from configurable Quality of Service (QoS) policies, inherited from the underlying DDS layer. These are set when creating the server or client.
Key QoS profiles for services include:
- Reliability: Typically set to
RELIABLE(ensure request/response delivery) versusBEST_EFFORT. - History Depth: For the request queue on the server side.
- Deadline: Optional duration within which the service call should complete.
These policies allow tuning service behavior for different network conditions, making ROS 2 services more robust and suitable for deterministic systems compared to ROS 1 services. The default QoS profile for services is generally reliable, matching the expectation of a guaranteed response.
How ROS Services Work: Mechanism & Flow
A ROS Service provides a synchronous, request-response communication pattern, enabling deterministic, blocking interactions between nodes in a robotic system.
A ROS Service is a synchronous, request-response communication mechanism where a client node sends a request to a server node and blocks until it receives a reply. This pattern is ideal for remote procedure calls (RPCs) that require a deterministic, immediate answer, such as querying a sensor's status or performing a quick calculation. Unlike the continuous data stream of a ROS Topic, a service call is a discrete, one-time transaction.
The service flow begins when a client calls the service using a defined ROS Service Message type, which specifies the structure of both the request and response. The server, which has previously advertised the service, receives the request, executes its callback function to process it, and returns the response. This blocking call ensures the client's execution thread pauses, providing straightforward error handling and guaranteed sequencing for critical operations within the robotic software architecture.
Common Use Cases for ROS Services
ROS Services provide a synchronous, request-response mechanism ideal for operations that require a direct, blocking answer. This section details the primary scenarios where this communication pattern is essential.
Configuration and Parameter Retrieval
Services are the standard mechanism for a node to dynamically request configuration data from a central parameter server or another configuration node. This is a core alternative to the parameter server's asynchronous event system.
- Example: A navigation node calls a
/get_mapservice to request the current occupancy grid from a map server before planning a path. - Key Benefit: The client node blocks until it receives the necessary configuration, ensuring it does not proceed with stale or missing data.
On-Demand Computation and Queries
Services are used to trigger a specific, often resource-intensive, computation and return a single result. This is preferred over a continuous topic stream when data is only needed occasionally.
- Example: A
/detect_objectservice where a client sends an image and blocks until the server returns the bounding boxes and classifications. - Example: A
/calculate_inverse_kinematicsservice for a robotic arm, where the client provides a desired end-effector pose and receives the corresponding joint angles.
State Machine Transitions and Control Commands
Services provide a clean interface for discrete, one-shot commands that change a system's operational mode or state. The client receives immediate confirmation of success or failure.
- Example: A
/start_recordingor/calibrate_sensorservice for a data logging node. - Example: In ROS 2 Lifecycle Nodes, the
~/change_stateservice is used to transition a node between its managed states (e.g., Unconfigured → Inactive → Active).
Database and Lookup Operations
Services are ideal for querying a static or slowly changing dataset, such as a semantic map, a knowledge base, or a task database. The request contains the query parameters, and the response contains the matched records.
- Example: A
/query_locationservice that returns the coordinates of a named landmark (e.g., 'charging_station_1') from a semantic map. - Key Benefit: The synchronous nature ensures the client has the lookup result before deciding its next action.
Error Handling and Status Checks
Services can be used for health checks and diagnostic queries where a managing node periodically requests status from subordinate nodes. The response contains detailed health information or error codes.
- Example: A
/get_diagnosticsservice that returns the internal status, error logs, and self-test results of a motor controller. - Contrast with Topics: While diagnostics can be published on a topic, a service allows for on-demand, guaranteed delivery of the latest status snapshot.
Synchronization in Multi-Node Sequences
In complex workflows, services can act as synchronization points or barriers. A coordinating node can call a series of services on different nodes in sequence, ensuring each step completes before the next begins.
- Example: A
pick_and_placesequence: 1) Call/plan_graspservice on the perception node. 2) Call/execute_trajectoryservice on the arm controller with the result. 3) Call/update_inventoryservice on the database node. - Consideration: For long-running tasks with intermediate feedback, the ROS Action protocol is more appropriate.
ROS Service vs. Topic vs. Action
A comparison of the three primary communication mechanisms in the Robot Operating System (ROS), detailing their core characteristics, use cases, and technical behaviors.
| Feature | ROS Topic | ROS Service | ROS Action |
|---|---|---|---|
Communication Model | Asynchronous Publish/Subscribe | Synchronous Request/Response | Asynchronous Goal/Feedback/Result |
Blocking Behavior | Non-blocking | Client blocks until reply | Client non-blocking; can monitor/cancel |
Connection Pattern | Many-to-many | One-to-one (per request) | One-to-one (per goal) |
Data Flow | Unidirectional stream | Bidirectional, single exchange | Bidirectional, with intermediate feedback |
Primary Use Case | Continuous sensor data, state broadcasts | On-demand computation, configuration queries | Long-running, interruptible tasks (e.g., navigation) |
Latency Profile | Low, best-effort (configurable via QoS) | Medium, bounded by server processing time | High, task duration plus feedback overhead |
Built On | Native DDS publications/subscriptions | Two paired DDS request/reply topics | Five coordinated DDS topics (Goal, Cancel, Status, Feedback, Result) |
State Management | Stateless | Stateless (per call) | Stateful (goal lifecycle: PENDING, EXECUTING, etc.) |
Frequently Asked Questions
A ROS Service is a synchronous, request-response communication mechanism where a client node sends a request to a server node and blocks until it receives a reply. This FAQ addresses common technical questions about its operation, design, and use cases.
A ROS Service is a synchronous, request-response communication mechanism where a client node sends a request to a server node and blocks until it receives a reply. It operates as a remote procedure call (RPC) within the ROS graph. A service is defined by a pair of ROS Message types: one for the request and one for the response. A server node advertises a service by name and provides a callback function to handle incoming requests. A client node creates a service client, calls the service with a request message, and waits synchronously for the server to process the request and return a response message. This blocking nature makes services ideal for transactional operations, such as performing a calculation, looking up a value, or triggering a discrete, non-continuous action.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
ROS Services are one of several core communication mechanisms within the ROS graph. Understanding the related patterns is essential for designing robust robotic systems.
ROS Topic
A ROS Topic is a named, many-to-many communication channel for asynchronous data streaming. Nodes publish messages to a topic, and any number of subscribing nodes can receive them concurrently.
- Asynchronous & Fire-and-Forget: Publishers and subscribers operate independently; a publisher does not wait for subscribers to receive data.
- Primary Use Case: Streaming sensor data (e.g., camera images, LiDAR scans, joint states), commands, and system status.
- Contrast with Service: Topics are for continuous data flow; services are for discrete, synchronous request-response transactions.
ROS Action
A ROS Action is an asynchronous interface for long-running, goal-oriented tasks. It is built on top of topics and provides a client-server model with feedback, preemption, and result reporting.
- Three-Part Communication: The client sends a goal, the server streams periodic feedback, and finally sends a result upon completion or cancellation.
- Primary Use Case: Executing tasks with duration, such as navigating to a pose, performing a complex manipulation sequence, or running a lengthy computation.
- Contrast with Service: Actions are non-blocking and provide intermediate progress updates, whereas a service client blocks until the single response is received.
ROS Parameter
A ROS Parameter is a configuration value stored on a centralized parameter server (or in a distributed system in ROS 2). Nodes can retrieve, set, and monitor these values at runtime.
- Configuration, Not Communication: Parameters are for system configuration (e.g., controller gains, timeout values, operational modes), not for inter-node data exchange.
- Dynamic Reconfiguration: Nodes can declare parameters and respond to parameter events to update their behavior without restarting.
- Contrast with Service: Parameters provide static or slowly changing configuration; services provide dynamic, on-demand procedural execution.
ROS Message (.msg)
A ROS Message is a strictly typed data structure used for serialization and deserialization in all ROS communication. Service requests and responses are defined using two message types.
- Data Contract: Defined in
.msgfiles (for topics/actions) or.srvfiles (for services), messages provide the schema for all transmitted data. - Primitive and Complex Types: Supports integers, floats, strings, arrays, and nested custom message types.
- Fundamental Dependency: Every ROS Topic, Service, and Action relies on an underlying message definition for data integrity.
ROS Node
A ROS Node is a single executable process that performs computation within the ROS graph. Nodes are the fundamental participants in all communication patterns, including services.
- Modular Unit: A robotic system is composed of many nodes, each responsible for a specific function (e.g., a sensor driver, a planner, a controller).
- Communication Endpoint: A node can be a service client, a service server, a publisher, a subscriber, or any combination thereof.
- Runtime Graph: The collection of running nodes and their connections forms the ROS computation graph, which can be inspected with tools like
rqt_graph.
ROS 2 Quality of Service (QoS)
In ROS 2, Quality of Service policies govern the behavior of all communication channels, including services. These are critical for reliable operation in real-time and unreliable networks.
- Key Policies for Services:
- Reliability:
RELIABLE(guaranteed delivery) vs.BEST_EFFORT. - Deadline: The maximum expected time between service request and response.
- Liveliness: How the system determines if a service server is still alive.
- Reliability:
- System Tuning: QoS profiles allow developers to match communication semantics to system requirements, from best-effort logging to hard real-time control.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us