Skip to content

Service Introspection Documentation and Tutorial#2981

Closed
ihasdapie wants to merge 2 commits intorollingfrom
brianc/service_introspection
Closed

Service Introspection Documentation and Tutorial#2981
ihasdapie wants to merge 2 commits intorollingfrom
brianc/service_introspection

Conversation

@ihasdapie
Copy link
Copy Markdown
Member

Adding docs for service introspection (ros2/ros2#1285). Leaving as draft until the feature actually gets merged in.

Signed-off-by: Brian Chen brian.chen@openrobotics.org

@ihasdapie ihasdapie mentioned this pull request Aug 27, 2022
14 tasks
@jacobperron jacobperron self-assigned this Sep 1, 2022
Signed-off-by: Brian Chen <brian.chen@openrobotics.org>
Signed-off-by: Brian Chen <brian.chen@openrobotics.org>
@clalancette clalancette force-pushed the brianc/service_introspection branch from 290fe44 to 923d509 Compare February 27, 2023 22:36
@mjcarroll mjcarroll changed the title service introspection Service Introspection Documentation and Tutorial Feb 28, 2023
@jacobperron jacobperron removed their assignment May 9, 2023

Related PR: `ros2/ros2cli#749 <https://github.com/ros2/ros2cli/pull/749>`_

Service Introspection
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have this in release note.

Service introspection
^^^^^^^^^^^^^^^^^^^^^
It is now possible to enable service introspection on a per-service basis.
When enabled, this allows users to see the metadata associated with the client requesting a service, the server accepting the request, the server sending the response, and the client accepting the response.
Optionally, the contents of the client/server requests/responses can also be introspected.
All of the information is published on a hidden topic generated from the name of the service.
So if the service is called ``/myservice``, then the information will be published on ``/myservice/_service_event``.
Note that this functionality is disabled by default; to enable it, users must call ``configure_introspection`` after creating a server client or server.
There are examples showing how to do this in https://github.com/ros2/demos/tree/iron/demo_nodes_cpp/src/services (C++) and https://github.com/ros2/demos/blob/iron/demo_nodes_py/demo_nodes_py/services/introspection.py (Python).
See `REP 2012 <https://github.com/ros-infrastructure/rep/pull/360>`__ and the tracking bug at https://github.com/ros2/ros2/issues/1285 for more information.

Comment on lines +203 to +227
3.2 Recording Services
~~~~~~~~~~~~~~~~~~~~~~

Note: this feature is avaliable only from in ``rolling ridley`` and ``iron irwini`` onwards.

You can record services as well.


Run the following command:

.. code-block:: console

ros2 bag record --services <service_name>


``ros2 bag record --services`` is a layer of syntactic sugar for ``ros2 bag record`` and will record the service event messages published to ``<service_name>/_service_event``.
Note that this will only work if service introspection is currently enabled for the services you are recording.

Though one can play back and introspect the service event messages there is currently no support for replaying services i.e. mocking client requests via ``ros2 bag play``.

For more information see REP2012_.

.. _REP2012: https://github.com/ros-infrastructure/rep/pull/360


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually recording service is already implemented in rosbag2.
this will be handled after ros2/rosbag2#1481 all together.


.. image:: images/spawn.png

7 ros2 service echo
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4199 replaces this.

@fujitatomoya
Copy link
Copy Markdown
Collaborator

#4199 replaces this.

@clalancette
Copy link
Copy Markdown
Contributor

Closing since we did this in #4199.

@clalancette clalancette closed this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants