-
Notifications
You must be signed in to change notification settings - Fork 485
Description
Description
Allow users to specify the amount of threads used by individual components when using isolated component container. This would prevent the unnecessary creation and usage of threads that is not the default behaviour.
Motivation
Currently, there is no option to specify the number of threads to use on the component level like with standalone nodes:
auto executor = rclcpp::executors::MultiThreadedExecutor(rclcpp::ExecutorOptions(), 3);
This leads to the situation where the default constructor for MultiThreadedExecutor is called without without arguments ( the template parameter resolves here) and the created Executor creates the maximum amount of threads by default. Most of the uses cases I have seen do not need that many threads.
Design / Implementation Considerations
The nodes may be loaded to the container by calling the /load_node service. To my understanding, this is what the LoadComposableNodes launch action does. The service definition contains parameters and extra_parameters fields which may be filled to node options. The component manager could then see if the parameter thread_num is specified for the node and pass it to the add_node_to_executor call where it would be passed to MultiThreadedExecutor constructor.
Additional Information
I understand that this is quite a niche issue and might not be worth the implementation effort. Feel free to close this issue if it is not relevant.