Skip to content

Commit

Permalink
Added ros2 service info to documentation (#4080)
Browse files Browse the repository at this point in the history
* added ros2 service info documentation

Signed-off-by: Yaswanth <92177410+yaswanth1701@users.noreply.github.com>
  • Loading branch information
yaswanth1701 authored Dec 26, 2023
1 parent ff066c7 commit 638469c
Showing 1 changed file with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,32 @@ Which will return:
/turtle1/teleport_relative [turtlesim/srv/TeleportRelative]
...
4 ros2 service find
4 ros2 service info
^^^^^^^^^^^^^^^^^^^

To see information of a particular service, use the command:

.. code-block:: console
ros2 service info <service_name>
This returns the service type and the count of service clients and servers.

For example, you can find the count of clients and servers for the ``/clear`` service:

.. code-block:: console
ros2 service info /clear
Which will return:

.. code-block:: console
Type: std_srvs/srv/Empty
Clients count: 0
Services count: 1
5 ros2 service find
^^^^^^^^^^^^^^^^^^^

If you want to find all the services of a specific type, you can use the command:
Expand All @@ -164,7 +189,7 @@ Which will return:
/clear
/reset
5 ros2 interface show
6 ros2 interface show
^^^^^^^^^^^^^^^^^^^^^

You can call services from the command line, but first you need to know the structure of the input arguments.
Expand Down Expand Up @@ -214,7 +239,7 @@ The information above the ``---`` line tells us the arguments needed to call ``/

The information below the line isn't something you need to know in this case, but it can help you understand the data type of the response you get from the call.

6 ros2 service call
7 ros2 service call
^^^^^^^^^^^^^^^^^^^

Now that you know what a service type is, how to find a service's type, and how to find the structure of that type's arguments, you can call a service using:
Expand Down

0 comments on commit 638469c

Please sign in to comment.