Skip to content

Commit

Permalink
Added a launch argument use_localization_concat_filter to be able to …
Browse files Browse the repository at this point in the history
…choose whether to launch another concat filter for localization or not.

Signed-off-by: TaikiYamada4 <[email protected]>
  • Loading branch information
TaikiYamada4 committed Nov 15, 2023
1 parent f57251f commit d2f2ef0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions aip_x2_launch/launch/lidar.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<arg name="launch_driver" default="true" />
<arg name="use_concat_filter" default="true" />
<arg name="use_localization_concat_filter" default="false" />
<arg name="vehicle_id" default="$(env VEHICLE_ID default)" />
<arg name="vehicle_mirror_param_file" />
<arg name="use_pointcloud_container" default="false" description="launch pointcloud container"/>
Expand Down
23 changes: 18 additions & 5 deletions aip_x2_launch/launch/pointcloud_preprocessor.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from launch.actions import SetLaunchConfiguration
from launch.conditions import IfCondition
from launch.conditions import UnlessCondition
from launch.substitutions import LaunchConfiguration
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch_ros.actions import ComposableNodeContainer
from launch_ros.actions import LoadComposableNodes
from launch_ros.descriptions import ComposableNode
Expand All @@ -30,7 +30,7 @@ def launch_setup(context, *args, **kwargs):
perception_concat_component = ComposableNode(
package="pointcloud_preprocessor",
plugin="pointcloud_preprocessor::PointCloudConcatenateDataSynchronizerComponent",
name="concatenate_data_for_perception",
name="concatenate_data",
remappings=[
("~/input/twist", "/sensing/vehicle_velocity_converter/twist_with_covariance"),
("output", "concatenated/pointcloud"),
Expand Down Expand Up @@ -95,7 +95,7 @@ def launch_setup(context, *args, **kwargs):
namespace="",
package="rclcpp_components",
executable=LaunchConfiguration("container_executable"),
composable_node_descriptions=[perception_concat_component, localization_concat_component],
composable_node_descriptions=[],
condition=UnlessCondition(LaunchConfiguration("use_pointcloud_container")),
output="screen",
)
Expand All @@ -108,12 +108,25 @@ def launch_setup(context, *args, **kwargs):

# load concat or passthrough filter
concat_loader = LoadComposableNodes(
composable_node_descriptions=[perception_concat_component, localization_concat_component],
composable_node_descriptions=[perception_concat_component],
target_container=target_container,
condition=IfCondition(LaunchConfiguration("use_concat_filter")),
)

return [container, concat_loader]
# Define the condition using PythonExpression
combined_condition = IfCondition(PythonExpression([
"'", LaunchConfiguration('use_concat_filter'), "' == 'true' and ",
"'", LaunchConfiguration('use_localization_concat_filter'), "' == 'true'"
]))

# load localiation concat or passthrough filter
localization_concat_loader = LoadComposableNodes(
composable_node_descriptions=[localization_concat_component],
target_container=target_container,
condition=combined_condition
)

return [container, concat_loader, localization_concat_loader]


def generate_launch_description():
Expand Down

0 comments on commit d2f2ef0

Please sign in to comment.