Skip to content

Commit e488756

Browse files
committed
Adding service introspection
1 parent 3a6255d commit e488756

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

docs/source/inspecting_services.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,20 @@ After proper configuration of the server and client, :program:`ros2 service echo
121121
add endless ``print`` functions throughout the code that hurt performance.
122122

123123

124+
.. tab-set::
125+
126+
.. tab-item:: add_points_service_client_introspection_node.py
127+
128+
:download:`add_points_service_client_introspection_node.py <../../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_client_introspection_node.py>`
129+
130+
.. literalinclude:: ../../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_client_introspection_node.py
131+
:language: python
132+
:linenos:
133+
134+
.. tab-item:: add_points_service_server_introspection_node.py
135+
136+
:download:`add_points_service_server_introspection_node.py <../../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_server_introspection_node.py>`
137+
138+
.. literalinclude:: ../../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_server_introspection_node.py
139+
:language: python
140+
:linenos:

docs/source/service_servers_and_clients.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ The code begins with an import to the service we created. No surprise here.
102102
.. literalinclude:: ../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_server_node.py
103103
:language: python
104104
:lines: 24-29
105-
:emphasize-lines: 6
105+
:emphasize-lines: 3
106106

107107
The Service Server must be initialised with the :code:`create_service()`, as follows, with parameters that should by now be quite obvious to us.
108108

109109
.. literalinclude:: ../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_server_node.py
110110
:language: python
111-
:lines: 38-41
111+
:lines: 35-38
112112

113113
The Service Server receives a :code:`AddPoints.Request` and returns a :code:`AddPoints.Response`.
114114

115115
.. literalinclude:: ../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_server_node.py
116116
:language: python
117-
:lines: 45-52
117+
:lines: 42-48
118118
:emphasize-lines: 2,4
119119

120120
.. warning::
@@ -132,7 +132,7 @@ At the end of the callback, we must return that :code:`AddPoints.Request`, like
132132

133133
.. literalinclude:: ../../ros2_tutorial_workspace/src/python_package_that_uses_the_services/python_package_that_uses_the_services/add_points_service_server_node.py
134134
:language: python
135-
:lines: 57
135+
:lines: 54
136136

137137
The Service Server was quite painless, but it doesn't do much. The Service Client might be a bit more on the painful side for the uninitiated.
138138

0 commit comments

Comments
 (0)