-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathld19.launch.py
59 lines (52 loc) · 1.82 KB
/
ld19.launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python3
from launch import LaunchDescription
from launch_ros.actions import Node
'''
Parameter Description:
---
- Set laser scan directon:
1. Set counterclockwise, example: {'laser_scan_dir': True}
2. Set clockwise, example: {'laser_scan_dir': False}
- Angle crop setting, Mask data within the set angle range:
1. Enable angle crop fuction:
1.1. enable angle crop, example: {'enable_angle_crop_func': True}
1.2. disable angle crop, example: {'enable_angle_crop_func': False}
2. Angle cropping interval setting:
- The distance and intensity data within the set angle range will be set to 0.
- angle >= 'angle_crop_min' and angle <= 'angle_crop_max' which is [angle_crop_min, angle_crop_max], unit is degress.
example:
{'angle_crop_min': 135.0}
{'angle_crop_max': 225.0}
which is [135.0, 225.0], angle unit is degress.
'''
def generate_launch_description():
# LDROBOT LiDAR publisher node
ldlidar_node = Node(
package='ldlidar_stl_ros2',
executable='ldlidar_stl_ros2_node',
name='LD19',
output='screen',
parameters=[
{'product_name': 'LDLiDAR_LD19'},
{'topic_name': 'scan'},
{'frame_id': 'base_laser'},
{'port_name': '/dev/ttyUSB0'},
{'port_baudrate': 230400},
{'laser_scan_dir': True},
{'enable_angle_crop_func': False},
{'angle_crop_min': 135.0},
{'angle_crop_max': 225.0}
]
)
# base_link to base_laser tf node
base_link_to_laser_tf_node = Node(
package='tf2_ros',
executable='static_transform_publisher',
name='base_link_to_base_laser_ld19',
arguments=['0','0','0.18','0','0','0','base_link','base_laser']
)
# Define LaunchDescription variable
ld = LaunchDescription()
ld.add_action(ldlidar_node)
ld.add_action(base_link_to_laser_tf_node)
return ld