Skip to content

Commit

Permalink
Update Pluginlib.rst (#3544)
Browse files Browse the repository at this point in the history
Updating section 2.3 to remove lines that already exist in CMakeLists.txt.
  • Loading branch information
marioprats authored May 8, 2023
1 parent 1e44d0e commit 14929e4
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions source/Tutorials/Beginner-Client-Libraries/Pluginlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,46 +208,17 @@ A couple things to note:

The last step is to export your plugins via ``CMakeLists.txt``.
This is a change from ROS 1, where the exporting was done via ``package.xml``.
Add the following block to your ``ros2_ws/src/polygon_plugins/CMakeLists.txt`` after the line reading ``find_package(pluginlib REQUIRED)``:
Add the following line to your ``ros2_ws/src/polygon_plugins/CMakeLists.txt`` after the line reading ``find_package(pluginlib REQUIRED)``:

.. code-block:: cmake
add_library(polygon_plugins src/polygon_plugins.cpp)
target_include_directories(polygon_plugins PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
polygon_plugins
polygon_base
pluginlib
)
pluginlib_export_plugin_description_file(polygon_base plugins.xml)
install(
TARGETS polygon_plugins
EXPORT export_${PROJECT_NAME}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
The arguments to the ``pluginlib_export_plugin_description_file`` command are:

1. The package with the base class, i.e. ``polygon_base``.
2. The relative path to the Plugin Declaration xml, i.e. ``plugins.xml``.

Lastly, before the ``ament_package`` command, add:

.. code-block:: cmake
ament_export_libraries(
polygon_plugins
)
ament_export_targets(
export_${PROJECT_NAME}
)
3 Use the Plugins
^^^^^^^^^^^^^^^^^

Expand Down

0 comments on commit 14929e4

Please sign in to comment.