From 2ffaebbc1ce56a26476e5d69630f9cd86355c672 Mon Sep 17 00:00:00 2001 From: Robot Date: Tue, 21 Nov 2023 19:11:31 +0800 Subject: [PATCH] update demo_8 --- demo_launch/8_waypoint_nav.launch.py | 61 ++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 demo_launch/8_waypoint_nav.launch.py diff --git a/demo_launch/8_waypoint_nav.launch.py b/demo_launch/8_waypoint_nav.launch.py new file mode 100644 index 0000000..bdc74a9 --- /dev/null +++ b/demo_launch/8_waypoint_nav.launch.py @@ -0,0 +1,61 @@ +import os +from launch import LaunchDescription +from launch_ros.actions import Node +from ament_index_python.packages import get_package_share_directory +from launch.actions import IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource + +def generate_launch_description(): + + map_file = os.path.join( + get_package_share_directory('wpr_simulation2'), + 'maps', + 'map.yaml' + ) + + nav_param_file = os.path.join( + get_package_share_directory('wpr_simulation2'), + 'config', + 'nav2_params.yaml' + ) + + nav2_launch_dir = os.path.join( + get_package_share_directory('nav2_bringup'), + 'launch' + ) + + navigation_cmd = IncludeLaunchDescription( + PythonLaunchDescriptionSource([nav2_launch_dir, '/bringup_launch.py']), + launch_arguments={ + 'map': map_file, + 'use_sim_time': 'True', + 'params_file': nav_param_file}.items(), + ) + + rviz_file = os.path.join(get_package_share_directory('wp_map_tools'), 'rviz', 'navi.rviz') + rviz_cmd = Node( + package='rviz2', + executable='rviz2', + name='rviz2', + arguments=['-d', rviz_file] + ) + + wp_edit_cmd = Node( + package='wp_map_tools', + executable='wp_edit_node', + name='wp_edit_node' + ) + + wp_navi_server_cmd = Node( + package='wp_map_tools', + executable='wp_navi_server', + name='wp_navi_server' + ) + + ld = LaunchDescription() + ld.add_action(navigation_cmd) + ld.add_action(rviz_cmd) + ld.add_action(wp_edit_cmd) + ld.add_action(wp_navi_server_cmd) + + return ld \ No newline at end of file