From 8b5f01d0ecc6a87024875df756d2955e4d378edd Mon Sep 17 00:00:00 2001 From: locker98 Date: Wed, 18 Dec 2024 22:27:23 -0500 Subject: [PATCH] update nav2 launch --- locker98_tools_bringup/CMakeLists.txt | 18 ++----- locker98_tools_bringup/launch/nav2.launch.py | 50 ++++++++++++++++++ locker98_tools_bringup/launch/nav2.launch.xml | 1 - locker98_tools_bringup/launch/slam.launch.xml | 13 ++++- locker98_tools_bringup/package.xml | 4 ++ locker98_tools_bringup/rviz/my_map.pgm | Bin 0 -> 18635 bytes locker98_tools_bringup/rviz/my_map.yaml | 7 +++ 7 files changed, 77 insertions(+), 16 deletions(-) create mode 100644 locker98_tools_bringup/launch/nav2.launch.py delete mode 100644 locker98_tools_bringup/launch/nav2.launch.xml create mode 100644 locker98_tools_bringup/rviz/my_map.pgm create mode 100644 locker98_tools_bringup/rviz/my_map.yaml diff --git a/locker98_tools_bringup/CMakeLists.txt b/locker98_tools_bringup/CMakeLists.txt index 9df360e..9b35e1b 100644 --- a/locker98_tools_bringup/CMakeLists.txt +++ b/locker98_tools_bringup/CMakeLists.txt @@ -7,20 +7,10 @@ endif() # find dependencies find_package(ament_cmake REQUIRED) -# uncomment the following section in order to fill in -# further dependencies manually. -# find_package( REQUIRED) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - # comment the line when a copyright and license is added to all source files - set(ament_cmake_copyright_FOUND TRUE) - # the following line skips cpplint (only works in a git repo) - # comment the line when this package is in a git repo and when - # a copyright and license is added to all source files - set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() -endif() +install( + DIRECTORY launch rviz worlds + DESTINATION share/${PROJECT_NAME}/ +) ament_package() diff --git a/locker98_tools_bringup/launch/nav2.launch.py b/locker98_tools_bringup/launch/nav2.launch.py new file mode 100644 index 0000000..c3f76b1 --- /dev/null +++ b/locker98_tools_bringup/launch/nav2.launch.py @@ -0,0 +1,50 @@ +from launch import LaunchDescription +import os +from ament_index_python import get_package_share_directory +from launch_ros.parameter_descriptions import ParameterValue +from launch.substitutions import LaunchConfiguration +from launch_ros.actions import Node +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription + +def generate_launch_description(): + + # Declare the arguments + use_sim_time = LaunchConfiguration('use_sim_time', default='False') + map = LaunchConfiguration('map') + + # Define RViz config path + rviz_config_path = os.path.join( + get_package_share_directory('locker98_tools_bringup'), + 'rviz', 'nav2_config.rviz' + ) + + # Include the bringup launch file + bringup_launch_file = os.path.join( + get_package_share_directory('nav2_bringup'), + 'launch', 'bringup_launch.py' + ) + + # Include the bringup launch file and pass arguments + include_bringup = IncludeLaunchDescription( + bringup_launch_file, + launch_arguments={ + 'use_sim_time': use_sim_time, + 'map': map + }.items() + ) + + # RViz node + rviz2_node = Node( + package='rviz2', + executable='rviz2', + output='screen', + arguments=['-d', rviz_config_path] + ) + + # Return LaunchDescription + return LaunchDescription([ + DeclareLaunchArgument('use_sim_time', default_value='False', description='Use simulation time'), + DeclareLaunchArgument('map', default_value='', description='Map input'), + include_bringup, + rviz2_node + ]) diff --git a/locker98_tools_bringup/launch/nav2.launch.xml b/locker98_tools_bringup/launch/nav2.launch.xml deleted file mode 100644 index 8d1c8b6..0000000 --- a/locker98_tools_bringup/launch/nav2.launch.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/locker98_tools_bringup/launch/slam.launch.xml b/locker98_tools_bringup/launch/slam.launch.xml index 8d1c8b6..67e7033 100644 --- a/locker98_tools_bringup/launch/slam.launch.xml +++ b/locker98_tools_bringup/launch/slam.launch.xml @@ -1 +1,12 @@ - + + + + + + + + + + + diff --git a/locker98_tools_bringup/package.xml b/locker98_tools_bringup/package.xml index e8a56f3..66e1713 100644 --- a/locker98_tools_bringup/package.xml +++ b/locker98_tools_bringup/package.xml @@ -8,6 +8,10 @@ GNU 3.0 ament_cmake + + + my_robot1_description + ament_lint_auto ament_lint_common diff --git a/locker98_tools_bringup/rviz/my_map.pgm b/locker98_tools_bringup/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