The ROS services
The ROS services are a type request/response communication between ROS nodes. One node will send a request and wait until it gets a response from the other. The request/response communication is also using the ROS message description.
Similar to the message definitions using the ".msg" file, we have to define the service definition in another file called ".srv", which has to be kept inside the srv subdirectory of the package. Similar to the message definition, a service description language is used to define the ROS service types.
An example service description format is as follows:
#Request message type string str --- #Response message type string str
The first section is the message type of the request that is separated by --- and in the next section is the message type of the response. In these examples, both Request and Response are strings.
In the upcoming sections, we will look at how to work with ROS services.