mirror of
https://github.com/bjoernellens1/cps_rmp220_support.git
synced 2024-11-23 07:35:09 +00:00
79 lines
2.9 KiB
Python
79 lines
2.9 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
from ament_index_python.packages import get_package_share_directory
|
|
from launch import LaunchDescription
|
|
from launch.actions import DeclareLaunchArgument
|
|
from launch.actions import LogInfo
|
|
from launch.substitutions import LaunchConfiguration
|
|
from launch_ros.actions import Node
|
|
from launch.substitutions import ThisLaunchFileDir
|
|
|
|
def generate_launch_description():
|
|
channel_type = LaunchConfiguration('channel_type', default='serial')
|
|
serial_port = LaunchConfiguration('serial_port', default='/dev/ttyUSB0')
|
|
serial_baudrate = LaunchConfiguration('serial_baudrate', default='115200') #for A1/A2 is 115200
|
|
frame_id = LaunchConfiguration('frame_id', default='laser')
|
|
inverted = LaunchConfiguration('inverted', default='false')
|
|
angle_compensate = LaunchConfiguration('angle_compensate', default='true')
|
|
scan_mode = LaunchConfiguration('scan_mode', default='Sensitivity')
|
|
|
|
# scan_filter = IncludeLaunchDescription(
|
|
# PythonLaunchDescriptionSource([ThisLaunchFileDir(), 'robot_scan_filter.launch.py']),
|
|
# #launch_arguments={'my_arg': 'new_value'}.items() # You can pass arguments here
|
|
# ),
|
|
|
|
return LaunchDescription([
|
|
DeclareLaunchArgument(
|
|
'channel_type',
|
|
default_value=channel_type,
|
|
description='Specifying channel type of lidar'),
|
|
|
|
DeclareLaunchArgument(
|
|
'serial_port',
|
|
default_value=serial_port,
|
|
description='Specifying usb port to connected lidar'),
|
|
|
|
DeclareLaunchArgument(
|
|
'serial_baudrate',
|
|
default_value=serial_baudrate,
|
|
description='Specifying usb port baudrate to connected lidar'),
|
|
|
|
DeclareLaunchArgument(
|
|
'frame_id',
|
|
default_value=frame_id,
|
|
description='Specifying frame_id of lidar'),
|
|
|
|
DeclareLaunchArgument(
|
|
'inverted',
|
|
default_value=inverted,
|
|
description='Specifying whether or not to invert scan data'),
|
|
|
|
DeclareLaunchArgument(
|
|
'angle_compensate',
|
|
default_value=angle_compensate,
|
|
description='Specifying whether or not to enable angle_compensate of scan data'),
|
|
DeclareLaunchArgument(
|
|
'scan_mode',
|
|
default_value=scan_mode,
|
|
description='Specifying scan mode of lidar'),
|
|
|
|
Node(
|
|
package='sllidar_ros2',
|
|
executable='sllidar_node',
|
|
output='screen',
|
|
parameters=[{
|
|
'serial_port': serial_port,
|
|
'frame_id': 'laser_frame',
|
|
'scan_mode': 'Sensitivity',
|
|
'channel_type':channel_type,
|
|
'serial_baudrate': serial_baudrate,
|
|
'inverted': inverted,
|
|
'angle_compensate': angle_compensate
|
|
}],
|
|
#namespace = "/rmp"
|
|
),
|
|
# scan_filter()
|
|
])
|