error
Network Error...
Check your network connection and reload or refresh this page.

Service in ROS

Followed by previous post covering message in ROS, this one introduce service in ROS.

Service is another information exchange mechanism provided in ROS which provides RPC (remote procedure call) style request-response pattern. The service is defined by .srv file, which can be treated as a combination of two message representing service request and service reply, respectively.

Most of information in this post is refer to Services page in ROS wiki, srv page in ROS wiki and source code for ROS core module.

.srv file

.srv file declares an exposed service of a package. Service files are declared within srv folder, and following the same composing rule as the message file, with an extra seperator for separation of request and response.

For example

1
2
3
4
5
6
# request
int64 a
int64 b
---
# response
int64 sum

utilize service

To utilize service, add corresponding declaration to build files. Then catkin will generate source code in all supported languages. Import the generated code into your code base to provide service.

CC-BY-SA 4.0
The content of this post is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
END
Message in ROS
vector of bool in C++
Disqus is loading...