Additional tools to handle services
We’ve already used the ros2 command-line tool a lot in this book. With this tool, each core ROS 2 concept gets additional functionalities in the Terminal. This is no exception for services.
We’re now going to explore ros2 service a bit more so that we can introspect services and send a request from the Terminal. We will also learn how to change a service name at runtime (ros2 run).
To see all commands for ROS 2 services, type ros2 service -h.
Listing and introspecting services
First, rqt_graph does not support services (yet—there are plans to maybe add this in a future ROS 2 distribution), so we won’t use it here. We will only use the ros2 command-line tool.
Stop all nodes and start the number_counter node. Then, to list all services, run the following command:
$ ros2 service list /number_counter/describe_parameters /number_counter/get_parameter_types /number_counter/get_parameters /number_publisher/get_type_description...