|
| 1 | +from launch import LaunchDescription |
| 2 | +from launch_ros.actions import Node |
| 3 | +from launch.actions import DeclareLaunchArgument |
| 4 | +from launch.substitutions import LaunchConfiguration |
| 5 | +from ament_index_python.packages import get_package_share_directory |
| 6 | +from launch.conditions import IfCondition |
| 7 | +from launch.substitutions import PythonExpression |
| 8 | + |
| 9 | +def generate_launch_description(): |
| 10 | + ros_sample_dir = get_package_share_directory('luminar_driver') |
| 11 | + |
| 12 | + return LaunchDescription([ |
| 13 | + DeclareLaunchArgument( |
| 14 | + 'lidar_id', default_value='luminar_lidar_151', |
| 15 | + ), |
| 16 | + DeclareLaunchArgument( |
| 17 | + 'lidar_data_port', default_value='4370', |
| 18 | + ), |
| 19 | + DeclareLaunchArgument( |
| 20 | + 'use_rviz', default_value='false', |
| 21 | + ), |
| 22 | + DeclareLaunchArgument( |
| 23 | + 'combined_config', default_value=f'{ros_sample_dir}/rviz/combined_mode.rviz', |
| 24 | + ), |
| 25 | + Node( |
| 26 | + package='luminar_driver', |
| 27 | + executable='luminar_driver', |
| 28 | + name='luminar_driver', |
| 29 | + output='screen', |
| 30 | + parameters=[ |
| 31 | + {'lidar_data_port': LaunchConfiguration('lidar_data_port')}, |
| 32 | + ], |
| 33 | + ), |
| 34 | + Node( |
| 35 | + condition=IfCondition(PythonExpression(["'", LaunchConfiguration('use_rviz'), "'=='true'"])), |
| 36 | + package='rviz2', |
| 37 | + executable='rviz2', |
| 38 | + name='rviz2', |
| 39 | + arguments=['-d', LaunchConfiguration('combined_config')], |
| 40 | + ), |
| 41 | + ]) |
0 commit comments