Skip to content

Commit 6fcd892

Browse files
author
Murilo Marinho
committed
[publishers_and_subscribers.rst] Updated to Jazzy.
1 parent eecc031 commit 6fcd892

File tree

2 files changed

+60
-31
lines changed

2 files changed

+60
-31
lines changed

docs/source/publishers_and_subscribers.rst

Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,46 @@ First, let us create an :program:`ament_python` package that depends on our newl
4242
--build-type ament_python \
4343
--dependencies rclpy package_with_interfaces
4444
45+
.. dropdown:: ros2 pkg create output
46+
47+
.. code :: console
48+
49+
going to create a new package
50+
package name: python_package_that_uses_the_messages
51+
destination directory: /root/ros2_tutorial_workspace/src
52+
package format: 3
53+
version: 0.0.0
54+
description: TODO: Package description
55+
maintainer: ['root <[email protected]>']
56+
licenses: ['TODO: License declaration']
57+
build type: ament_python
58+
dependencies: ['rclpy', 'package_with_interfaces']
59+
creating folder ./python_package_that_uses_the_messages
60+
creating ./python_package_that_uses_the_messages/package.xml
61+
creating source folder
62+
creating folder ./python_package_that_uses_the_messages/python_package_that_uses_the_messages
63+
creating ./python_package_that_uses_the_messages/setup.py
64+
creating ./python_package_that_uses_the_messages/setup.cfg
65+
creating folder ./python_package_that_uses_the_messages/resource
66+
creating ./python_package_that_uses_the_messages/resource/python_package_that_uses_the_messages
67+
creating ./python_package_that_uses_the_messages/python_package_that_uses_the_messages/__init__.py
68+
creating folder ./python_package_that_uses_the_messages/test
69+
creating ./python_package_that_uses_the_messages/test/test_copyright.py
70+
creating ./python_package_that_uses_the_messages/test/test_flake8.py
71+
creating ./python_package_that_uses_the_messages/test/test_pep257.py
72+
73+
[WARNING]: Unknown license 'TODO: License declaration'. This has been set in the package.xml, but no LICENSE file has been created.
74+
It is recommended to use one of the ament license identifiers:
75+
Apache-2.0
76+
BSL-1.0
77+
BSD-2.0
78+
BSD-2-Clause
79+
BSD-3-Clause
80+
GPL-3.0-only
81+
LGPL-3.0-only
82+
MIT
83+
MIT-0
84+
4585
Overview
4686
--------
4787

@@ -147,7 +187,7 @@ For the subscriber Node, create a file in :file:`python_package_that_uses_the_me
147187
:language: python
148188
:linenos:
149189
:lines: 24-
150-
:emphasize-lines: 3, 11-15, 17-30
190+
:emphasize-lines: 3, 11-15, 17-31
151191

152192
Similarly to the publisher, in the subscriber, we start by importing the message in question
153193

@@ -168,7 +208,7 @@ where the only difference with respect to the publisher is the third argument, n
168208
.. literalinclude:: ../../ros2_tutorial_workspace/src/python_package_that_uses_the_messages/python_package_that_uses_the_messages/amazing_quote_subscriber_node.py
169209
:language: python
170210
:lines: 40-53
171-
:emphasize-lines: 7,11,13
211+
:emphasize-lines: 8,12,14
172212

173213
That callback method will be automatically called by ROS2, as one of the tasks performed by :code:`rclpy.spin(Node)`. Depending on the :code:`qos_profile`, it will not necessarily be the latest message.
174214

@@ -220,41 +260,30 @@ which outputs
220260

221261
.. code:: console
222262
223-
[INFO] [1684215672.344532584] [amazing_quote_subscriber_node]:
224-
I have received the most amazing of quotes.
225-
It says
226-
227-
'Use the force, Pikachu!'
228-
229-
And was thought by the following genius
230-
231-
-- Uncle Ben
232-
233-
This latest quote had the id=3.
263+
[INFO] [1753664072.638312553] [amazing_quote_subscriber_node]:
264+
I have received the most amazing of quotes.
265+
It says
234266
235-
[INFO] [1684215672.844618237] [amazing_quote_subscriber_node]:
236-
I have received the most amazing of quotes.
237-
It says
267+
'Use the force, Pikachu!'
238268
239-
'Use the force, Pikachu!'
269+
And was thought by the following genius
240270
241-
And was thought by the following genius
271+
-- Uncle Ben
242272
243-
-- Uncle Ben
273+
This latest quote had the id=37.
244274
245-
This latest quote had the id=4.
275+
[INFO] [1753664073.121886428] [amazing_quote_subscriber_node]:
276+
I have received the most amazing of quotes.
277+
It says
246278
247-
[INFO] [1684215673.344514856] [amazing_quote_subscriber_node]:
248-
I have received the most amazing of quotes.
249-
It says
279+
'Use the force, Pikachu!'
250280
251-
'Use the force, Pikachu!'
281+
And was thought by the following genius
252282
253-
And was thought by the following genius
283+
-- Uncle Ben
254284
255-
-- Uncle Ben
285+
This latest quote had the id=38.
256286
257-
This latest quote had the id=5.
258287
259288
260289
.. note::

ros2_tutorial_workspace/src/python_package_that_uses_the_messages/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
from setuptools import setup
1+
from setuptools import find_packages, setup
22

33
package_name = 'python_package_that_uses_the_messages'
44

55
setup(
66
name=package_name,
77
version='0.0.0',
8-
packages=[package_name],
8+
packages=find_packages(exclude=['test']),
99
data_files=[
1010
('share/ament_index/resource_index/packages',
1111
['resource/' + package_name]),
1212
('share/' + package_name, ['package.xml']),
1313
],
1414
install_requires=['setuptools'],
1515
zip_safe=True,
16-
maintainer='murilo',
17-
maintainer_email='[email protected]',
16+
maintainer='root',
17+
maintainer_email='[email protected]',
1818
description='TODO: Package description',
1919
license='TODO: License declaration',
2020
tests_require=['pytest'],

0 commit comments

Comments
 (0)