Skip to content

Commit ef6f81c

Browse files
author
Murilo Marinho
committed
Added some tips about ros2 pkg list.
1 parent dc5aa41 commit ef6f81c

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

docs/source/advanced.rst

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/source/create_packages.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
Create packages (:program:`ros2 pkg create`)
22
--------------------------------------------
33

4+
:program:`ROS2` packages are the most basic element in the :program:`ROS2` infrastructure. You must be able to create them correctly and consistently.
5+
Everything else that :program:`ROS2` can offer rotates about the effective use of packages.
6+
47
ROS2 has a tool to help create package templates. We can get all available options by running
58

69
.. code-block:: console
@@ -10,7 +13,7 @@ ROS2 has a tool to help create package templates. We can get all available optio
1013
which outputs a list of handy options to populate the package template with useful files. Namely, the four emphasized ones.
1114

1215
.. code-block:: console
13-
:emphasize-lines: 19,21,27, 29
16+
:emphasize-lines: 19,21,27,29
1417
1518
usage: ros2 pkg create [-h] [--package-format {2,3}] [--description DESCRIPTION] [--license LICENSE] [--destination-directory DESTINATION_DIRECTORY] [--build-type {cmake,ament_cmake,ament_python}]
1619
[--dependencies DEPENDENCIES [DEPENDENCIES ...]] [--maintainer-email MAINTAINER_EMAIL] [--maintainer-name MAINTAINER_NAME] [--node-name NODE_NAME] [--library-name LIBRARY_NAME]
@@ -41,4 +44,8 @@ which outputs a list of handy options to populate the package template with usef
4144
--node-name NODE_NAME
4245
name of the empty executable
4346
--library-name LIBRARY_NAME
44-
name of the empty library
47+
name of the empty library
48+
49+
Although it is recommended to use some of the other options as well, such as :code:`--license`, :code:`--maintainer-email`,
50+
and :code:`--maintainer-name`, they would make the commands too long for the purposes of this tutorial. Remember to choose
51+
the most suitable values for your application.

docs/source/source_after_build.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,29 @@ As the workspace grows bigger and the packages more complex, figuring out such e
2525
colcon build
2626
source install/setup.bash
2727
28+
Troubleshooting tips
29+
--------------------
30+
31+
One important tool to assist in case your package is not found is :program:`ros2 pkg list`. It can be called as follows.
32+
33+
.. code :: console
34+
35+
ros2 pkg list
36+
37+
It will output a large number of packages even for the most basic installations of :program:`ROS2`. If you are looking for
38+
a particular package, you can use :program:`grep` which is more actively used (and explained) in other parts of this tutorial. For instance,
39+
if you are looking for :file:`python_package_with_a_node` you can do as follows.
40+
41+
.. code :: console
42+
43+
ros2 pkg list | grep the_simplest_python_package
44+
45+
This will either output nothing if the package is not found or it will output the name of the package, as follows.
46+
47+
.. code :: console
48+
49+
grep the_simplest_python_package
50+
2851
.. admonition:: Hint for the future you
2952

3053
In rare cases, the workspace can be left in an unclean state in which older build artifacts cause build and runtime issues, such as failed builds and programs that do not seem to match their intended source code. These artifacts might include old files that should have been removed, issues with dependencies, and so on. In those cases, it might be good to remove the :file:`build`, :file:`install`, and :file:`log` folders before rebuilding and re-sourcing.

0 commit comments

Comments
 (0)