ROS Programming: Building Powerful Robots
by Anil Mahtani, Luis Sanchez, Enrique Fernandez, Aaron Martinez, Lentin Joseph
Services
When you need to communicate with nodes and receive a reply in an RPC fashion, you cannot do it with topics; you need to do it with services.
Services are developed by the user and standard services don't exist for nodes. The files with the source code of the services are stored in the srv folder.
Similar to topics, services have an associated service type that is the package resource name of the .srv file. As with other ROS filesystem-based types, the service type is the package name and the name of the .srv file. For example, the chapter2_tutorials/srv/chapter2_srv1.srv file has the chapter2_tutorials/chapter2_srv1 service type.
ROS has two command-line tools to work with services: rossrv and rosservice. With rossrv, we can see ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access