Skip to content

Update Pluginlib.rst - use the method of the derived class #5778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: humble
Choose a base branch
from

Conversation

lr-sncf
Copy link

@lr-sncf lr-sncf commented Jul 15, 2025

Description

In this tutorial, a method specific to the derived class Triangle is defined but remains unused.

I add here the few lines missing to use this method.

I'm not sure whether this should replace the current script (which is the version I'm proposing here) or whether an extension should be added after the current example...

Fixes # (issue)

no fix. proposal just to enhance user knowledge.

Did you use Generative AI?

not relevant

Additional Information

tested on Humble (VM on macos with apple silicon)

In this tutorial, a method specific to the derived class Triangle is defined but remains unused.

I add here the few lines missing to use this method. 

I'm not sure whether this should replace the current script (which is the version I'm proposing here) or whether an extension should be added after the current example...

Signed-off-by: lr-sncf <61940365+lr-sncf@users.noreply.github.com>
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

@lr-sncf thanks for creating PR.

with a few comments, can you retarget the PR against rolling branch? that is the main development branch we work on, and we can backport the fix to the downstream branches.

@@ -43,7 +43,7 @@ Create a new empty package in your ``ros2_ws/src`` folder with the following com

.. code-block:: console

$ ros2 pkg create --build-type ament_cmake --license Apache-2.0 --dependencies pluginlib --node-name area_node polygon_base
$ ros2 pkg create --build-type ament_cmake --license Apache-2.0 --dependencies pluginlib polygon_base
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will fail with the following.

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 pkg create --build-type ament_cmake --license Apache-2.0 --dependencies pluginlib polygon_base
usage: ros2 pkg create [-h] [--package-format {2,3}] [--description DESCRIPTION] [--license LICENSE]
                       [--destination-directory DESTINATION_DIRECTORY] [--build-type {cmake,ament_cmake,ament_python}]
                       [--dependencies DEPENDENCIES [DEPENDENCIES ...]] [--maintainer-email MAINTAINER_EMAIL]
                       [--maintainer-name MAINTAINER_NAME] [--node-name NODE_NAME] [--library-name LIBRARY_NAME]
                       package_name
ros2 pkg create: error: the following arguments are required: package_name

@@ -167,6 +167,8 @@ Let's go through the arguments to the ``PLUGINLIB_EXPORT_CLASS`` macro:
1. The fully-qualified type of the plugin class, in this case, ``polygon_plugins::Square``.
2. The fully-qualified type of the base class, in this case, ``polygon_base::RegularPolygon``.

Note that for the Triangle class, we're implementing a method ``getHeight()`` that isn't in the base class. We'll come back to this method later, when we call it.
Copy link
Collaborator

Choose a reason for hiding this comment

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

github workflow will fail with this line against one sentence per line rule.

Comment on lines -233 to +247
// To avoid unused parameter warnings
(void) argc;
(void) argv;
// To avoid unused parameter warnings
(void) argc;
(void) argv;
Copy link
Collaborator

Choose a reason for hiding this comment

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

indent with 2 spaces are fine, i do not think we need to change those lines.

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.

2 participants