feat(agv_pro_bringup): add multi-lidar support and drivers
This commit is contained in:
Executable
+69
@@ -0,0 +1,69 @@
|
||||
import os
|
||||
|
||||
from launch.substitutions import LaunchConfiguration
|
||||
from launch import LaunchDescription
|
||||
from launch.actions import DeclareLaunchArgument
|
||||
from launch_ros.actions import Node
|
||||
from launch.conditions import IfCondition
|
||||
from ament_index_python.packages import get_package_share_directory
|
||||
|
||||
def generate_launch_description():
|
||||
|
||||
use_rviz = LaunchConfiguration('use_rviz')
|
||||
|
||||
declare_use_rviz = DeclareLaunchArgument(
|
||||
'use_rviz',
|
||||
default_value='false',
|
||||
description='Whether to start RViz'
|
||||
)
|
||||
|
||||
pkg_share = get_package_share_directory('unitree_lidar_ros2')
|
||||
rviz_config_file = os.path.join(pkg_share,
|
||||
'rviz',
|
||||
'view.rviz')
|
||||
|
||||
# Run unitree lidar
|
||||
node1 = Node(
|
||||
package='unitree_lidar_ros2',
|
||||
executable='unitree_lidar_ros2_node',
|
||||
name='unitree_lidar_ros2_node',
|
||||
output='screen',
|
||||
parameters= [
|
||||
{'initialize_type': 1},
|
||||
{'work_mode': 8},
|
||||
{'use_system_timestamp': True},
|
||||
{'range_min': 0.0},
|
||||
{'range_max': 100.0},
|
||||
{'cloud_scan_num': 18},
|
||||
|
||||
{'serial_port': '/dev/ttyACM1'},
|
||||
{'baudrate': 4000000},
|
||||
|
||||
{'lidar_port': 6101},
|
||||
{'lidar_ip': '192.168.1.62'},
|
||||
{'local_port': 6201},
|
||||
{'local_ip': '192.168.1.2'},
|
||||
|
||||
{'cloud_frame': "unilidar_lidar"},
|
||||
{'cloud_topic': "unilidar/cloud"},
|
||||
{'imu_frame': "unilidar_imu"},
|
||||
{'imu_topic': "unilidar/imu"},
|
||||
]
|
||||
)
|
||||
|
||||
# Run Rviz
|
||||
rviz_node = Node(
|
||||
package='rviz2',
|
||||
executable='rviz2',
|
||||
name='rviz2',
|
||||
arguments=['-d', rviz_config_file],
|
||||
condition=IfCondition(use_rviz),
|
||||
output='log'
|
||||
)
|
||||
return LaunchDescription(
|
||||
[
|
||||
declare_use_rviz,
|
||||
node1,
|
||||
rviz_node,
|
||||
]
|
||||
)
|
||||
Reference in New Issue
Block a user