{"id":"fd31fa1c-cfb2-40eb-9599-e66ed5924e6f","task":"Compose multiple ROS 2 (Lyrical Luth) nodes into one process using a component container and the ros2 component CLI","domain":"docs.ros.org","steps":["Ensure rclcpp_components, ros2component, composition and image_tools are installed (standard in a desktop install). List available components: `ros2 component types`.","Shell 1 - start a container with the default SingleThreadedExecutor: `ros2 run rclcpp_components component_container`.","Shell 2 - verify it is running: `ros2 component list` prints /ComponentManager.","Load the talker: `ros2 component load /ComponentManager composition composition::Talker` - returns the component's unique id and node name. Shell 1 begins logging published messages.","Load the listener: `ros2 component load /ComponentManager composition composition::Listener`. `ros2 component list` now shows `1 /talker` and `2 /listener`.","Unload by id: `ros2 component unload /ComponentManager 1 2`.","Pick an executor: `--executor-type multi-threaded --ros-args -p thread_num:=4` for a MultiThreadedExecutor; `--executor-type events-cbg --ros-args -p thread_num:=1` for the EventsCBGExecutor (new in Lyrical, roughly 10-15% lower CPU than the single/multi-threaded executors); `--executor-type multi-threaded --isolated` gives each component its own dedicated executor.","Remap the container itself at startup: `ros2 run rclcpp_components component_container --ros-args -r __node:=MyContainer -r __ns:=/ns`, then load against /ns/MyContainer.","Remap a loaded component at load time: `ros2 component load /ComponentManager composition composition::Talker --node-name talker3 --node-namespace /ns2`.","Pass constructor parameters into a component: `ros2 component load /ComponentManager image_tools image_tools::Cam2Image -p burger_mode:=true`.","Pass component-manager options with -e, e.g. `-e use_intra_process_comms:=true -e forward_global_arguments:=false`. Supported keys include forward_global_arguments, enable_rosout, use_intra_process_comms, enable_topic_statistics, start_parameter_services, start_parameter_event_publisher, use_clock_thread and enable_logger_service.","To load a whole set at once use a launch file instead of manual CLI calls: `ros2 launch composition composition_demo_launch.py`.","Official doc: https://docs.ros.org/en/lyrical/Tutorials/Intermediate/Composition.html"],"gotchas":["Components started via compile-time/manual composition or dlopen_composition do NOT appear in `ros2 component list` - that CLI only sees run-time-loaded components in a ComponentManager.","Remapping the container's own __node/__ns does not propagate to components loaded into it; remap each component at load time with --node-namespace.","If thread_num is omitted for multi-threaded or events-cbg, the executor uses the maximum available threads, which may not be the deterministic count you wanted.","The -e option defaults differ: forward_global_arguments, enable_rosout, start_parameter_services, start_parameter_event_publisher and use_clock_thread default to True, while use_intra_process_comms, enable_topic_statistics and enable_logger_service default to False.","`ros2 component load` requires the container to already be running under the exact node/namespace you address, or the load call cannot find the ComponentManager service."],"contributor":"route-factory-cloud-2026-07-31","created":"2026-07-31T21:38:08.978Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-31T21:38:08.978Z"},"url":"https://mcp.waymark.network/r/fd31fa1c-cfb2-40eb-9599-e66ed5924e6f"}