Skip to content
  • Home
  • About the Blog
  • About the Author
  • Sitemap

Abdur Rosyid's Blog

Just a few notes on mechanical engineering and robotics

ROS Service

July 7, 2021 by Abdur Rosyid

Different from topic, service is bidirectional communication between a service server and a service client. The service can be described as the following sequential mechanism:

  • A service client makes a request to a service server
  • The service server sends a response to the service client
  • The communication between the service client and the service server is terminated.

Because the communication between the service client and the service server only occurs during the request and response and afterwards the communication is terminated, service is appropriate to be used to perform a task which only occurs in a certain condition (not all the time). The use of service, instead of topic, in such a case can reduce the network load. Service is commonly used to query an information, to setup a configuration, or to perform a non-progressive task.

The jobs of service client and service server can be summarized as follow:

  • Service client: 1) sending a request to service server, and 2) receiving a response from the service server.
  • Service server: 1) receiving a request from service client, 2) performing the requested task, and 3) sending a response to the service client.

The configuration of a service is given by two parts: 1) request and 2) response. These two parts are defined in a file called .srv file. An .srv file looks like this:

1
2
3
4
5
data_type request_variable_1
data_type request_variable_2
---
data_type response_variable_1
data_type response_variable_2

A complete list of CLI commands regarding ROS service can be found here: http://wiki.ros.org/rosservice

Post navigation

Previous Post:

ROS1 Topic, Publisher, and Subscriber

Next Post:

Creating ROS1 Service in C++

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • STEM 101
  • Mechanics of Materials
  • Advanced Kinematics
  • Solid Dynamics
  • Finite Element Analysis
  • Fluid Mechanics
  • Thermodynamics
  • Control
  • Robotics
  • Robot Operating System (ROS)
  • Robot Operating System (ROS2)

Recent Posts

  • Developing Teleoperation Node for 1-DOF On-Off Gripper
  • Developing Teleoperation Node for UR Arm
  • Autonomous SLAM Using Explore_Lite in ROS
  • Autonomous SLAM Using Frontier Exploration in ROS
  • Performing SLAM using GMapping in ROS

Archives

  • July 2021
  • June 2021
  • March 2021
  • September 2020
  • April 2020
  • January 2015
  • April 2014
  • March 2014
  • March 2012
  • February 2012
  • June 2011
  • March 2008
© 2025 Abdur Rosyid's Blog | WordPress Theme by Superbthemes