Skip to content

Conversation

Timple
Copy link
Contributor

@Timple Timple commented May 27, 2024

No description provided.

std::vector<std::string> args = rclcpp::remove_ros_arguments(argc, argv);
for (auto & arg : args) {
if (arg == std::string("--use_multi_threaded_executor")) {
if (arg == std::string("--use_multi_threaded_executor") ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since using underscores in command flags is very uncommon. I added the new option with dashes and allowed for the same here.

Perhaps in the future we can deprecate the original flag based on discussion here.

@Timple Timple force-pushed the component-container-isolated-events-executor branch from 5deb093 to 2c75845 Compare May 27, 2024 09:32
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.

a couple of questions,

  • EventsExecutor is still experimental, do we want to bring experimental executor into ComponentManager? I am not sure about this, any thoughts?
  • Before adding EventsExecutor to ComponentManagerIsolated, probably we would want to support ComponentManager?

IMO, this feature is really nice to have. but i think EventsExecutor should support simulation time before this support, see #2480

@audrow
Copy link
Member

audrow commented Jun 6, 2024

Before we move forward with this, I think it'd be good to do @fujitatomoya's comment of adding this to the ComponentManager as well.

@audrow audrow added the more-information-needed Further information is required label Jun 6, 2024
@alsora
Copy link
Collaborator

alsora commented Jun 7, 2024

EventsExecutor is still experimental

we should have a discussion on what would be the steps necessary to bring it out of experimental, but IMO this shouldn't prevent from using it here (especially because it's not the default).

Before adding EventsExecutor to ComponentManagerIsolated, probably we would want to support ComponentManager?

I agree.
Moreover, I wonder if we really need all these separate executables (component_container_mt.cpp, component_container.cpp, component_container_isolated.cpp). IMO we could just have 1 executable with a bunch of arguments: --isolated (true if present) and --executor-type (second argument is the name of the executor)

@Timple
Copy link
Contributor Author

Timple commented Jun 7, 2024

Your last arguments (--isolated & --executor-type) did cross my mind. But I was afraid about acceptance of larger PR's and backportability to Jazzy. But they can actually easily be extended without bracking api. So I'll happy refactor to that syntax if you agree 👍

@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/the-ros-2-c-executors/38296/5

@Timple Timple force-pushed the component-container-isolated-events-executor branch 3 times, most recently from 9bcecb7 to b790207 Compare June 25, 2024 07:55
@alsora
Copy link
Collaborator

alsora commented Aug 27, 2024

@Timple the PR looks good.
Would you mind merging / rebasing your branch with rolling so that I can start the CI?

@Timple Timple force-pushed the component-container-isolated-events-executor branch from b790207 to b2c64b0 Compare August 27, 2024 05:40
@Timple
Copy link
Contributor Author

Timple commented Aug 27, 2024

Rebased

@SteveMacenski
Copy link
Collaborator

Why is this blocked?

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.

previous comments #2541 (review) and #2541 (comment), probably we can do this kind of refactoring in rolling without backporting. so i think those do not need to be addressed with this PR.

exec = std::make_shared<executor>();
node = std::make_shared<ComponentManagerIsolated>(exec);
} else {
std::cerr << "Invalid executor type: " << executor_type << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is actually behavior change compared to before. before, even if user specify the wrong option, that falls back to SingleThreadedExecutor, but now it fails and user does not really know what can be set. it would be probably nice to show what and how executor types are set? or command line helper function can be introduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is actually behavior change compared to before.

Same as before, if nothing is supplied the single-threaded is used.

Only if previously the user supplied a non-existent option with a non-existent executor this is a behavior change:

ros2 run rclcpp_components component_container --executor-type something-wrong

But that would be a great coincidence I guess. As the --executor-type never existed.

using executor = rclcpp::executors::MultiThreadedExecutor;
using ComponentManagerIsolated = rclcpp_components::ComponentManagerIsolated<executor>;
exec = std::make_shared<executor>();
node = std::make_shared<ComponentManagerIsolated>(exec);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is also behavior change compared to before. before, it creates ComponentManagerIsolated node with SingleThreadedExecutor always. but now creating ComponentManagerIsolated node with MultiThreadedExecutor, i do not think this is needed since component node is expected to do the simple task like load/unload the components. is this intentional change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the old code:

  if (use_multi_threaded_executor) {
    using ComponentManagerIsolated =
      rclcpp_components::ComponentManagerIsolated<rclcpp::executors::MultiThreadedExecutor>;

So I do not recognise this:

before, it creates ComponentManagerIsolated node with SingleThreadedExecutor always

Can you elaborate?

break;
}
} else if (args[i] == "--use_multi_threaded_executor") { // backward compatibility
executor_type = "multi-threaded";
Copy link
Collaborator

Choose a reason for hiding this comment

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

it would be probably nice to add message for user, that this option is deprecated?

@Timple
Copy link
Contributor Author

Timple commented Aug 15, 2025

So it seems that I got bypassed here: #2885

If more hardcoded nodes is the way to go, this can be closed I guess?

@fujitatomoya
Copy link
Collaborator

@Timple thanks for circling back to this.

this PR is the another enhancement to add the option to isolated container, but #2885 only adds the another executable with EventsExecutor. where i can see, these two enhancement is really different.

but that is up to you. if you are good to go with #2885 and please go ahead to close this PR. when someone finds and takes over this PR, that is when we can come back to this enhancement?

@Timple
Copy link
Contributor Author

Timple commented Aug 18, 2025

I think I never saw your review and was under the impression this was good to go.
I'll implement your requested changes!

@Timple Timple force-pushed the component-container-isolated-events-executor branch from b2c64b0 to 45898cc Compare August 18, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-information-needed Further information is required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants