liveBook · Manning

Remote procedure call

As explained in Robotics for Programmers

A remote procedure call is a communication mechanism in which a program invokes a procedure executed in another process or on another computer over a network.

A remote procedure call (RPC) lets a program invoke a procedure in another process or computer over a network. The client sends parameters, the server executes the procedure, and the server returns a value. Unlike an ordinary function call, the operation depends on network communication and can block while processing completes. section 4.6 section 4.2

In ROS, RPCs are called services. A service has one server and may have multiple clients, with each client request handled separately. Services suit sporadic requests, especially when the client needs confirmation that the server received and acted on the request. Streaming data such as camera images, joint positions, or pose updates is better suited to topics. section 4.6

Treat a networked procedure as a distributed operation rather than a local function:

  • Allow for latency, unavailable receivers, delivery failure, changing topology, and network overhead. section 4.2
  • Choose services for request-and-response interactions; choose topics for decoupled, ongoing streams. section 4.6
  • Evaluate throughput, scalability, overhead, and temporal behavior in addition to communication functionality. section 4.2

A ROS 2 boolean service

A server can expose a std_srvs/srv/SetBool service, receive a request, set response.success and response.message, and return the response. A client constructs SetBool.Request(), assigns request.data, calls the service asynchronously, and processes the response in a callback. The same request can be tested from the command line with ros2 service call or through the RQt Service Caller plugin.

How Robotics for Programmers covers it

How deep it goes
Explains client-server flow, blocking behavior, pattern selection, and distributed failure modes, but does not derive transport internals.
Examples
Demonstrates a ROS 2 SetBool service with Python server and client code, ros2 service call, and the RQt Service Caller.
What it assumes
Assumes basic programming and networked-component concepts while explaining ROS nodes, services, clients, and request-response behavior.
What you can do after
Build and operate a ROS 2 service, invoke it asynchronously from Python, and test it through the ROS 2 CLI or RQt.
How it connects
Connects remote procedure calls with ROS services, client-server architecture, topics, middleware, nodes, and distributed systems.

Also explained in

Compare how 8 books explain remote procedure call →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Robotics for Programmers. The section links point to the parts of the book it draws on.