Learning how to use services

Services are another way through which nodes can communicate with each other. Services allow nodes to send a request and receive a response.

The tool that we are going to use to interact with services is called rosservice. The accepted parameters for this command are as follows:

  • rosservice args /service: This prints the service arguments
  • rosservice call /service: This calls the service with the arguments provided
  • rosservice find msg-type: This finds services by their service type
  • rosservice info /service: This prints information about the service
  • rosservice list: This lists the active services
  • rosservice type /service: This prints the service type
  • rosservice uri /service: This prints the ROSRPC URI service

Get ROS Programming: Building Powerful Robots now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.