diff --git a/aip_x1_launch/launch/lidar.launch.xml b/aip_x1_launch/launch/lidar.launch.xml index 679ffeb8..496e8873 100644 --- a/aip_x1_launch/launch/lidar.launch.xml +++ b/aip_x1_launch/launch/lidar.launch.xml @@ -22,6 +22,8 @@ + + diff --git a/aip_xx1_launch/launch/lidar.launch.xml b/aip_xx1_launch/launch/lidar.launch.xml index f209d743..b57f0800 100644 --- a/aip_xx1_launch/launch/lidar.launch.xml +++ b/aip_xx1_launch/launch/lidar.launch.xml @@ -20,6 +20,8 @@ + + @@ -33,6 +35,8 @@ + + @@ -46,6 +50,8 @@ + + @@ -59,6 +65,8 @@ + + diff --git a/common_sensor_launch/launch/velodyne_VLP16.launch.xml b/common_sensor_launch/launch/velodyne_VLP16.launch.xml index f6d89752..5b109c7b 100644 --- a/common_sensor_launch/launch/velodyne_VLP16.launch.xml +++ b/common_sensor_launch/launch/velodyne_VLP16.launch.xml @@ -15,6 +15,8 @@ + + @@ -32,6 +34,8 @@ + + diff --git a/common_sensor_launch/launch/velodyne_VLP32C.launch.xml b/common_sensor_launch/launch/velodyne_VLP32C.launch.xml index ba282971..8bb46ca4 100644 --- a/common_sensor_launch/launch/velodyne_VLP32C.launch.xml +++ b/common_sensor_launch/launch/velodyne_VLP32C.launch.xml @@ -15,6 +15,8 @@ + + @@ -32,6 +34,8 @@ + + diff --git a/common_sensor_launch/launch/velodyne_VLS128.launch.xml b/common_sensor_launch/launch/velodyne_VLS128.launch.xml index 07fc4659..ecb0c66b 100644 --- a/common_sensor_launch/launch/velodyne_VLS128.launch.xml +++ b/common_sensor_launch/launch/velodyne_VLS128.launch.xml @@ -15,6 +15,8 @@ + + @@ -32,6 +34,8 @@ + + diff --git a/common_sensor_launch/launch/velodyne_node_container.launch.py b/common_sensor_launch/launch/velodyne_node_container.launch.py index 0519112e..55bedf17 100644 --- a/common_sensor_launch/launch/velodyne_node_container.launch.py +++ b/common_sensor_launch/launch/velodyne_node_container.launch.py @@ -166,12 +166,19 @@ def create_parameter_dict(*args): # set container to run all required components in the same process container = ComposableNodeContainer( - # need unique name, otherwise all processes in same container and the node names then clash - name="velodyne_node_container", + name=LaunchConfiguration("container_name"), namespace="pointcloud_preprocessor", package="rclcpp_components", executable=LaunchConfiguration("container_executable"), composable_node_descriptions=nodes, + condition=UnlessCondition(LaunchConfiguration("use_pointcloud_container")), + output="screen", + ) + + component_loader = LoadComposableNodes( + composable_node_descriptions=nodes, + target_container=LaunchConfiguration("container_name"), + condition=IfCondition(LaunchConfiguration("use_pointcloud_container")), ) driver_component = ComposableNode( @@ -198,15 +205,19 @@ def create_parameter_dict(*args): ], ) - # one way to add a ComposableNode conditional on a launch argument to a - # container. The `ComposableNode` itself doesn't accept a condition - loader = LoadComposableNodes( + target_container = ( + container + if UnlessCondition(LaunchConfiguration("use_pointcloud_container")).evaluate(context) + else LaunchConfiguration("container_name") + ) + + driver_component_loader = LoadComposableNodes( composable_node_descriptions=[driver_component], - target_container=container, - condition=launch.conditions.IfCondition(LaunchConfiguration("launch_driver")), + target_container=target_container, + condition=IfCondition(LaunchConfiguration("launch_driver")), ) - return [container, loader] + return [container, component_loader, driver_component_loader] def generate_launch_description(): @@ -248,6 +259,8 @@ def add_launch_arg(name: str, default_value=None, description=None): ) add_launch_arg("use_multithread", "False", "use multithread") add_launch_arg("use_intra_process", "False", "use ROS2 component container communication") + add_launch_arg("use_pointcloud_container", "false") + add_launch_arg("container_name", "velodyne_node_container") set_container_executable = SetLaunchConfiguration( "container_executable",