66from launch .launch_description_sources import FrontendLaunchDescriptionSource , PythonLaunchDescriptionSource
77from launch_ros .actions import Node
88from launch .substitutions import LaunchConfiguration
9+ from launch .conditions import IfCondition , UnlessCondition
910
1011def generate_launch_description ():
12+ use_fastlio2 = LaunchConfiguration ('use_fastlio2' )
1113 exploration_planner_config = LaunchConfiguration ('exploration_planner_config' )
1214 world_name = LaunchConfiguration ('world_name' )
1315 sensorOffsetX = LaunchConfiguration ('sensorOffsetX' )
@@ -17,6 +19,11 @@ def generate_launch_description():
1719 vehicleY = LaunchConfiguration ('vehicleY' )
1820 checkTerrainConn = LaunchConfiguration ('checkTerrainConn' )
1921
22+ declare_use_fastlio2 = DeclareLaunchArgument (
23+ 'use_fastlio2' ,
24+ default_value = 'false' ,
25+ description = 'Use FASTLIO2 (with PGO/localizer bridge) instead of arise_slam_mid360 (true/false)'
26+ )
2027 declare_exploration_planner_config = DeclareLaunchArgument ('exploration_planner_config' , default_value = 'indoor_small' , description = '' )
2128 declare_world_name = DeclareLaunchArgument ('world_name' , default_value = 'real_world' , description = '' )
2229 declare_sensorOffsetX = DeclareLaunchArgument ('sensorOffsetX' , default_value = '0.05' , description = '' )
@@ -64,7 +71,15 @@ def generate_launch_description():
6471 start_arise_slam = IncludeLaunchDescription (
6572 PythonLaunchDescriptionSource (os .path .join (
6673 get_package_share_directory ('arise_slam_mid360' ), 'launch' , 'arize_slam.launch.py' )
67- )
74+ ),
75+ condition = UnlessCondition (use_fastlio2 )
76+ )
77+
78+ start_fastlio2 = IncludeLaunchDescription (
79+ PythonLaunchDescriptionSource (os .path .join (
80+ get_package_share_directory ('fastlio2_autonomy_bridge' ), 'launch' , 'fastlio2_autonomy.launch.py' )
81+ ),
82+ condition = IfCondition (use_fastlio2 )
6883 )
6984
7085 start_visualization_tools = IncludeLaunchDescription (
@@ -104,6 +119,7 @@ def generate_launch_description():
104119 ld = LaunchDescription ()
105120
106121 # Add the actions
122+ ld .add_action (declare_use_fastlio2 )
107123 ld .add_action (declare_exploration_planner_config )
108124 ld .add_action (declare_world_name )
109125 ld .add_action (declare_sensorOffsetX )
@@ -118,6 +134,7 @@ def generate_launch_description():
118134 ld .add_action (start_terrain_analysis_ext )
119135 ld .add_action (start_sensor_scan_generation )
120136 ld .add_action (start_arise_slam )
137+ ld .add_action (start_fastlio2 )
121138 ld .add_action (start_visualization_tools )
122139 ld .add_action (start_joy )
123140 ld .add_action (start_tare_planner )
0 commit comments