Skip to content

Add support for passing arguments to constructors - #291

Merged
ahcorde merged 1 commit into
ros:rollingfrom
pum1k:feat/constructor-arguments
Feb 20, 2026
Merged

Add support for passing arguments to constructors#291
ahcorde merged 1 commit into
ros:rollingfrom
pum1k:feat/constructor-arguments

Conversation

@pum1k

Copy link
Copy Markdown
Contributor

Description

This PR allows passing arguments to plugin constructors. This is done by exposing a new feature of class_loader added in ros/class_loader#223.

- updated `create*Instance` methods to forward arguments to plugin
constructors using class_loader interface traits
Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
@ahcorde

Copy link
Copy Markdown
Contributor

Pulls: #291
Gist: https://gist.githubusercontent.com/ahcorde/a60864c74e3698258ac6711f38798467/raw/f2aa7f4ba8de68858cc4a421df49836dcf859dbb/ros2.repos
BUILD args: --packages-above-and-dependencies pluginlib
TEST args: --packages-above pluginlib
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/18275

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde
ahcorde merged commit ee18deb into ros:rollingFeb 20, 2026
2 of 3 checks passed
@pum1k
pum1k deleted the feat/constructor-arguments branch February 20, 2026 18:19
@SteveMacenski

SteveMacenski commented Feb 24, 2026

Copy link
Copy Markdown
Member

@ahcorde are you aware this breaks all existing uses of pluginlib? Currently Nav2 does not build due to this, which I highly suspect means that every plugin user would need to update their use of pluginlib to work (since we don't do anything fancy).

I think there either needs to be a workaround for objects without constructor arguments or a detailed migration guide for what updates need to be specifically made. Personally I think a library like this needs a tick-tock migration pattern to give folks time and awareness, but feels to me like this could be done non-disruptively (though this is not my area of expertise)

@pum1k

pum1k commented Feb 24, 2026

Copy link
Copy Markdown
ContributorAuthor

@SteveMacenski the Nav2 test is broken, because it depends on private parts of the pluginlib. Code calling the public APIs of pluginlib requires no change.

@SteveMacenski

Copy link
Copy Markdown
Member

Huh - OK - false alarm. Still need to figure out a solution, but feel free to ignore me then 🙃

I thought I saw this show before, but turns out I'm watching a different channel

pum1k added a commit to pum1k/ros2_documentation that referenced this pull request Apr 19, 2026
ros/pluginlib#291 added the ability to pass arguments dircetly to
the constructor of the plugin. This updates the documentation to use
this new feature.
Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
ahcorde pushed a commit to ros2/ros2_documentation that referenced this pull request Apr 20, 2026
ros/pluginlib#291 added the ability to pass arguments dircetly to
the constructor of the plugin. This updates the documentation to use
this new feature.
Signed-off-by: pum1k <55055380+pum1k@users.noreply.github.com>
Sign up for freeto 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.

3 participants

@pum1k@ahcorde@SteveMacenski