From 9852be991ffd5e0860de0301d76d0b96025d4b67 Mon Sep 17 00:00:00 2001 From: Rooholla-KhorramBakht Date: Thu, 22 Feb 2024 11:38:40 -0500 Subject: [PATCH] navigation workspace cleanup --- deploy/nav2_ws/{ => maps}/028.data | Bin deploy/nav2_ws/{ => maps}/028.posegraph | Bin .../nav2_ws/{ => maps}/Feb16_hallway_map.data | Bin .../nav2_ws/{ => maps}/Feb16_hallway_map.pgm | Bin .../{ => maps}/Feb16_hallway_map.posegraph | Bin .../nav2_ws/{ => maps}/Feb16_hallway_map.yaml | 0 .../{ => maps}/Feb16_map_afternoon.data | Bin .../{ => maps}/Feb16_map_afternoon.pgm | Bin .../{ => maps}/Feb16_map_afternoon.posegraph | Bin .../{ => maps}/Feb16_map_afternoon.yaml | 0 deploy/nav2_ws/{ => maps}/Feb19_Room.data | Bin deploy/nav2_ws/{ => maps}/Feb19_Room.pgm | Bin .../nav2_ws/{ => maps}/Feb19_Room.posegraph | Bin deploy/nav2_ws/{ => maps}/Feb19_Room.yaml | 0 deploy/nav2_ws/{ => maps}/Feb21_hallway.data | Bin deploy/nav2_ws/{ => maps}/Feb21_hallway.pgm | Bin .../{ => maps}/Feb21_hallway.posegraph | Bin deploy/nav2_ws/{ => maps}/Feb21_hallway.yaml | 0 .../nav2_ws/{ => maps}/lab_and_hallway.data | Bin deploy/nav2_ws/{ => maps}/lab_and_hallway.pgm | Bin .../{ => maps}/lab_and_hallway.posegraph | Bin .../nav2_ws/{ => maps}/lab_and_hallway.yaml | 0 deploy/nav2_ws/{ => maps}/map_028.pgm | Bin deploy/nav2_ws/{ => maps}/map_028.yaml | 0 deploy/nav2_ws/{ => maps}/test_map.data | Bin deploy/nav2_ws/{ => maps}/test_map.pgm | Bin deploy/nav2_ws/{ => maps}/test_map.posegraph | Bin deploy/nav2_ws/{ => maps}/test_map.yaml | 0 .../launch/localization_launch.py | 107 ------------- .../launch/nav2_bringup_launch.py | 141 ------------------ ...igation_launch.py => navigation.launch.py} | 0 .../src/sportmode_nav2/launch/slam_launch.py | 107 ------------- .../launch/slam_toolbox_localization.py | 59 -------- .../params/localization_async.yaml | 2 +- 34 files changed, 1 insertion(+), 415 deletions(-) rename deploy/nav2_ws/{ => maps}/028.data (100%) rename deploy/nav2_ws/{ => maps}/028.posegraph (100%) rename deploy/nav2_ws/{ => maps}/Feb16_hallway_map.data (100%) rename deploy/nav2_ws/{ => maps}/Feb16_hallway_map.pgm (100%) rename deploy/nav2_ws/{ => maps}/Feb16_hallway_map.posegraph (100%) rename deploy/nav2_ws/{ => maps}/Feb16_hallway_map.yaml (100%) rename deploy/nav2_ws/{ => maps}/Feb16_map_afternoon.data (100%) rename deploy/nav2_ws/{ => maps}/Feb16_map_afternoon.pgm (100%) rename deploy/nav2_ws/{ => maps}/Feb16_map_afternoon.posegraph (100%) rename deploy/nav2_ws/{ => maps}/Feb16_map_afternoon.yaml (100%) rename deploy/nav2_ws/{ => maps}/Feb19_Room.data (100%) rename deploy/nav2_ws/{ => maps}/Feb19_Room.pgm (100%) rename deploy/nav2_ws/{ => maps}/Feb19_Room.posegraph (100%) rename deploy/nav2_ws/{ => maps}/Feb19_Room.yaml (100%) rename deploy/nav2_ws/{ => maps}/Feb21_hallway.data (100%) rename deploy/nav2_ws/{ => maps}/Feb21_hallway.pgm (100%) rename deploy/nav2_ws/{ => maps}/Feb21_hallway.posegraph (100%) rename deploy/nav2_ws/{ => maps}/Feb21_hallway.yaml (100%) rename deploy/nav2_ws/{ => maps}/lab_and_hallway.data (100%) rename deploy/nav2_ws/{ => maps}/lab_and_hallway.pgm (100%) rename deploy/nav2_ws/{ => maps}/lab_and_hallway.posegraph (100%) rename deploy/nav2_ws/{ => maps}/lab_and_hallway.yaml (100%) rename deploy/nav2_ws/{ => maps}/map_028.pgm (100%) rename deploy/nav2_ws/{ => maps}/map_028.yaml (100%) rename deploy/nav2_ws/{ => maps}/test_map.data (100%) rename deploy/nav2_ws/{ => maps}/test_map.pgm (100%) rename deploy/nav2_ws/{ => maps}/test_map.posegraph (100%) rename deploy/nav2_ws/{ => maps}/test_map.yaml (100%) delete mode 100644 deploy/nav2_ws/src/sportmode_nav2/launch/localization_launch.py delete mode 100644 deploy/nav2_ws/src/sportmode_nav2/launch/nav2_bringup_launch.py rename deploy/nav2_ws/src/sportmode_nav2/launch/{navigation_launch.py => navigation.launch.py} (100%) delete mode 100644 deploy/nav2_ws/src/sportmode_nav2/launch/slam_launch.py delete mode 100644 deploy/nav2_ws/src/sportmode_nav2/launch/slam_toolbox_localization.py diff --git a/deploy/nav2_ws/028.data b/deploy/nav2_ws/maps/028.data similarity index 100% rename from deploy/nav2_ws/028.data rename to deploy/nav2_ws/maps/028.data diff --git a/deploy/nav2_ws/028.posegraph b/deploy/nav2_ws/maps/028.posegraph similarity index 100% rename from deploy/nav2_ws/028.posegraph rename to deploy/nav2_ws/maps/028.posegraph diff --git a/deploy/nav2_ws/Feb16_hallway_map.data b/deploy/nav2_ws/maps/Feb16_hallway_map.data similarity index 100% rename from deploy/nav2_ws/Feb16_hallway_map.data rename to deploy/nav2_ws/maps/Feb16_hallway_map.data diff --git a/deploy/nav2_ws/Feb16_hallway_map.pgm b/deploy/nav2_ws/maps/Feb16_hallway_map.pgm similarity index 100% rename from deploy/nav2_ws/Feb16_hallway_map.pgm rename to deploy/nav2_ws/maps/Feb16_hallway_map.pgm diff --git a/deploy/nav2_ws/Feb16_hallway_map.posegraph b/deploy/nav2_ws/maps/Feb16_hallway_map.posegraph similarity index 100% rename from deploy/nav2_ws/Feb16_hallway_map.posegraph rename to deploy/nav2_ws/maps/Feb16_hallway_map.posegraph diff --git a/deploy/nav2_ws/Feb16_hallway_map.yaml b/deploy/nav2_ws/maps/Feb16_hallway_map.yaml similarity index 100% rename from deploy/nav2_ws/Feb16_hallway_map.yaml rename to deploy/nav2_ws/maps/Feb16_hallway_map.yaml diff --git a/deploy/nav2_ws/Feb16_map_afternoon.data b/deploy/nav2_ws/maps/Feb16_map_afternoon.data similarity index 100% rename from deploy/nav2_ws/Feb16_map_afternoon.data rename to deploy/nav2_ws/maps/Feb16_map_afternoon.data diff --git a/deploy/nav2_ws/Feb16_map_afternoon.pgm b/deploy/nav2_ws/maps/Feb16_map_afternoon.pgm similarity index 100% rename from deploy/nav2_ws/Feb16_map_afternoon.pgm rename to deploy/nav2_ws/maps/Feb16_map_afternoon.pgm diff --git a/deploy/nav2_ws/Feb16_map_afternoon.posegraph b/deploy/nav2_ws/maps/Feb16_map_afternoon.posegraph similarity index 100% rename from deploy/nav2_ws/Feb16_map_afternoon.posegraph rename to deploy/nav2_ws/maps/Feb16_map_afternoon.posegraph diff --git a/deploy/nav2_ws/Feb16_map_afternoon.yaml b/deploy/nav2_ws/maps/Feb16_map_afternoon.yaml similarity index 100% rename from deploy/nav2_ws/Feb16_map_afternoon.yaml rename to deploy/nav2_ws/maps/Feb16_map_afternoon.yaml diff --git a/deploy/nav2_ws/Feb19_Room.data b/deploy/nav2_ws/maps/Feb19_Room.data similarity index 100% rename from deploy/nav2_ws/Feb19_Room.data rename to deploy/nav2_ws/maps/Feb19_Room.data diff --git a/deploy/nav2_ws/Feb19_Room.pgm b/deploy/nav2_ws/maps/Feb19_Room.pgm similarity index 100% rename from deploy/nav2_ws/Feb19_Room.pgm rename to deploy/nav2_ws/maps/Feb19_Room.pgm diff --git a/deploy/nav2_ws/Feb19_Room.posegraph b/deploy/nav2_ws/maps/Feb19_Room.posegraph similarity index 100% rename from deploy/nav2_ws/Feb19_Room.posegraph rename to deploy/nav2_ws/maps/Feb19_Room.posegraph diff --git a/deploy/nav2_ws/Feb19_Room.yaml b/deploy/nav2_ws/maps/Feb19_Room.yaml similarity index 100% rename from deploy/nav2_ws/Feb19_Room.yaml rename to deploy/nav2_ws/maps/Feb19_Room.yaml diff --git a/deploy/nav2_ws/Feb21_hallway.data b/deploy/nav2_ws/maps/Feb21_hallway.data similarity index 100% rename from deploy/nav2_ws/Feb21_hallway.data rename to deploy/nav2_ws/maps/Feb21_hallway.data diff --git a/deploy/nav2_ws/Feb21_hallway.pgm b/deploy/nav2_ws/maps/Feb21_hallway.pgm similarity index 100% rename from deploy/nav2_ws/Feb21_hallway.pgm rename to deploy/nav2_ws/maps/Feb21_hallway.pgm diff --git a/deploy/nav2_ws/Feb21_hallway.posegraph b/deploy/nav2_ws/maps/Feb21_hallway.posegraph similarity index 100% rename from deploy/nav2_ws/Feb21_hallway.posegraph rename to deploy/nav2_ws/maps/Feb21_hallway.posegraph diff --git a/deploy/nav2_ws/Feb21_hallway.yaml b/deploy/nav2_ws/maps/Feb21_hallway.yaml similarity index 100% rename from deploy/nav2_ws/Feb21_hallway.yaml rename to deploy/nav2_ws/maps/Feb21_hallway.yaml diff --git a/deploy/nav2_ws/lab_and_hallway.data b/deploy/nav2_ws/maps/lab_and_hallway.data similarity index 100% rename from deploy/nav2_ws/lab_and_hallway.data rename to deploy/nav2_ws/maps/lab_and_hallway.data diff --git a/deploy/nav2_ws/lab_and_hallway.pgm b/deploy/nav2_ws/maps/lab_and_hallway.pgm similarity index 100% rename from deploy/nav2_ws/lab_and_hallway.pgm rename to deploy/nav2_ws/maps/lab_and_hallway.pgm diff --git a/deploy/nav2_ws/lab_and_hallway.posegraph b/deploy/nav2_ws/maps/lab_and_hallway.posegraph similarity index 100% rename from deploy/nav2_ws/lab_and_hallway.posegraph rename to deploy/nav2_ws/maps/lab_and_hallway.posegraph diff --git a/deploy/nav2_ws/lab_and_hallway.yaml b/deploy/nav2_ws/maps/lab_and_hallway.yaml similarity index 100% rename from deploy/nav2_ws/lab_and_hallway.yaml rename to deploy/nav2_ws/maps/lab_and_hallway.yaml diff --git a/deploy/nav2_ws/map_028.pgm b/deploy/nav2_ws/maps/map_028.pgm similarity index 100% rename from deploy/nav2_ws/map_028.pgm rename to deploy/nav2_ws/maps/map_028.pgm diff --git a/deploy/nav2_ws/map_028.yaml b/deploy/nav2_ws/maps/map_028.yaml similarity index 100% rename from deploy/nav2_ws/map_028.yaml rename to deploy/nav2_ws/maps/map_028.yaml diff --git a/deploy/nav2_ws/test_map.data b/deploy/nav2_ws/maps/test_map.data similarity index 100% rename from deploy/nav2_ws/test_map.data rename to deploy/nav2_ws/maps/test_map.data diff --git a/deploy/nav2_ws/test_map.pgm b/deploy/nav2_ws/maps/test_map.pgm similarity index 100% rename from deploy/nav2_ws/test_map.pgm rename to deploy/nav2_ws/maps/test_map.pgm diff --git a/deploy/nav2_ws/test_map.posegraph b/deploy/nav2_ws/maps/test_map.posegraph similarity index 100% rename from deploy/nav2_ws/test_map.posegraph rename to deploy/nav2_ws/maps/test_map.posegraph diff --git a/deploy/nav2_ws/test_map.yaml b/deploy/nav2_ws/maps/test_map.yaml similarity index 100% rename from deploy/nav2_ws/test_map.yaml rename to deploy/nav2_ws/maps/test_map.yaml diff --git a/deploy/nav2_ws/src/sportmode_nav2/launch/localization_launch.py b/deploy/nav2_ws/src/sportmode_nav2/launch/localization_launch.py deleted file mode 100644 index e058bba..0000000 --- a/deploy/nav2_ws/src/sportmode_nav2/launch/localization_launch.py +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright (c) 2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import Node -from nav2_common.launch import RewrittenYaml - - -def generate_launch_description(): - # Get the launch directory - bringup_dir = get_package_share_directory('nav2_bringup') - - namespace = LaunchConfiguration('namespace') - map_yaml_file = LaunchConfiguration('map') - use_sim_time = LaunchConfiguration('use_sim_time') - autostart = LaunchConfiguration('autostart') - params_file = LaunchConfiguration('params_file') - lifecycle_nodes = ['map_server', 'amcl'] - - # Map fully qualified names to relative ones so the node's namespace can be prepended. - # In case of the transforms (tf), currently, there doesn't seem to be a better alternative - # https://github.com/ros/geometry2/issues/32 - # https://github.com/ros/robot_state_publisher/pull/30 - # TODO(orduno) Substitute with `PushNodeRemapping` - # https://github.com/ros2/launch_ros/issues/56 - remappings = [('/tf', 'tf'), - ('/tf_static', 'tf_static')] - - # Create our own temporary YAML files that include substitutions - param_substitutions = { - 'use_sim_time': use_sim_time, - 'yaml_filename': map_yaml_file} - - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites=param_substitutions, - convert_types=True) - - return LaunchDescription([ - # Set env var to print messages to stdout immediately - SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), - - DeclareLaunchArgument( - 'namespace', default_value='', - description='Top-level namespace'), - - DeclareLaunchArgument( - 'map', - default_value=os.path.join(bringup_dir, 'maps', 'turtlebot3_world.yaml'), - description='Full path to map yaml file to load'), - - DeclareLaunchArgument( - 'use_sim_time', default_value='false', - description='Use simulation (Gazebo) clock if true'), - - DeclareLaunchArgument( - 'autostart', default_value='true', - description='Automatically startup the nav2 stack'), - - DeclareLaunchArgument( - 'params_file', - default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'), - description='Full path to the ROS2 parameters file to use'), - - Node( - package='nav2_map_server', - executable='map_server', - name='map_server', - output='screen', - parameters=[configured_params], - remappings=remappings), - - Node( - package='nav2_amcl', - executable='amcl', - name='amcl', - output='screen', - parameters=[configured_params], - remappings=remappings), - - Node( - package='nav2_lifecycle_manager', - executable='lifecycle_manager', - name='lifecycle_manager_localization', - output='screen', - parameters=[{'use_sim_time': use_sim_time}, - {'autostart': autostart}, - {'node_names': lifecycle_nodes}]) - ]) diff --git a/deploy/nav2_ws/src/sportmode_nav2/launch/nav2_bringup_launch.py b/deploy/nav2_ws/src/sportmode_nav2/launch/nav2_bringup_launch.py deleted file mode 100644 index 81ee595..0000000 --- a/deploy/nav2_ws/src/sportmode_nav2/launch/nav2_bringup_launch.py +++ /dev/null @@ -1,141 +0,0 @@ -# Copyright (c) 2018 Intel Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import (DeclareLaunchArgument, GroupAction, - IncludeLaunchDescription, SetEnvironmentVariable) -from launch.conditions import IfCondition -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration, PythonExpression -from launch_ros.actions import PushRosNamespace - - -def generate_launch_description(): - # Get the launch directory - bringup_dir = get_package_share_directory('sportmode_nav2') - launch_dir = os.path.join(bringup_dir, 'launch') - - # Create the launch configuration variables - namespace = LaunchConfiguration('namespace') - use_namespace = LaunchConfiguration('use_namespace') - slam = LaunchConfiguration('slam') - map_yaml_file = LaunchConfiguration('map') - use_sim_time = LaunchConfiguration('use_sim_time') - params_file = LaunchConfiguration('params_file') - default_bt_xml_filename = LaunchConfiguration('default_bt_xml_filename') - autostart = LaunchConfiguration('autostart') - - stdout_linebuf_envvar = SetEnvironmentVariable( - 'RCUTILS_LOGGING_BUFFERED_STREAM', '1') - - declare_namespace_cmd = DeclareLaunchArgument( - 'namespace', - default_value='', - description='Top-level namespace') - - declare_use_namespace_cmd = DeclareLaunchArgument( - 'use_namespace', - default_value='false', - description='Whether to apply a namespace to the navigation stack') - - declare_slam_cmd = DeclareLaunchArgument( - 'slam', - default_value='False', - description='Whether run a SLAM') - - declare_map_yaml_cmd = DeclareLaunchArgument( - 'map', - description='Full path to map yaml file to load') - - declare_use_sim_time_cmd = DeclareLaunchArgument( - 'use_sim_time', - default_value='false', - description='Use simulation (Gazebo) clock if true') - - declare_params_file_cmd = DeclareLaunchArgument( - 'params_file', - default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'), - description='Full path to the ROS2 parameters file to use for all launched nodes') - - declare_bt_xml_cmd = DeclareLaunchArgument( - 'default_bt_xml_filename', - default_value=os.path.join( - get_package_share_directory('nav2_bt_navigator'), - 'behavior_trees', 'navigate_w_replanning_and_recovery.xml'), - description='Full path to the behavior tree xml file to use') - - declare_autostart_cmd = DeclareLaunchArgument( - 'autostart', default_value='true', - description='Automatically startup the nav2 stack') - - # Specify the actions - bringup_cmd_group = GroupAction([ - PushRosNamespace( - condition=IfCondition(use_namespace), - namespace=namespace), - - IncludeLaunchDescription( - PythonLaunchDescriptionSource(os.path.join(launch_dir, 'slam_launch.py')), - condition=IfCondition(slam), - launch_arguments={'namespace': namespace, - 'use_sim_time': use_sim_time, - 'autostart': autostart, - 'params_file': params_file}.items()), - - IncludeLaunchDescription( - PythonLaunchDescriptionSource(os.path.join(launch_dir, - 'localization_launch.py')), - condition=IfCondition(PythonExpression(['not ', slam])), - launch_arguments={'namespace': namespace, - 'map': map_yaml_file, - 'use_sim_time': use_sim_time, - 'autostart': autostart, - 'params_file': params_file, - 'use_lifecycle_mgr': 'false'}.items()), - - IncludeLaunchDescription( - PythonLaunchDescriptionSource(os.path.join(launch_dir, 'navigation_launch.py')), - launch_arguments={'namespace': namespace, - 'use_sim_time': use_sim_time, - 'autostart': autostart, - 'params_file': params_file, - 'default_bt_xml_filename': default_bt_xml_filename, - 'use_lifecycle_mgr': 'false', - 'map_subscribe_transient_local': 'true'}.items()), - ]) - - # Create the launch description and populate - ld = LaunchDescription() - - # Set environment variables - ld.add_action(stdout_linebuf_envvar) - - # Declare the launch options - ld.add_action(declare_namespace_cmd) - ld.add_action(declare_use_namespace_cmd) - ld.add_action(declare_slam_cmd) - ld.add_action(declare_map_yaml_cmd) - ld.add_action(declare_use_sim_time_cmd) - ld.add_action(declare_params_file_cmd) - ld.add_action(declare_autostart_cmd) - ld.add_action(declare_bt_xml_cmd) - - # Add the actions to launch all of the navigation nodes - ld.add_action(bringup_cmd_group) - - return ld diff --git a/deploy/nav2_ws/src/sportmode_nav2/launch/navigation_launch.py b/deploy/nav2_ws/src/sportmode_nav2/launch/navigation.launch.py similarity index 100% rename from deploy/nav2_ws/src/sportmode_nav2/launch/navigation_launch.py rename to deploy/nav2_ws/src/sportmode_nav2/launch/navigation.launch.py diff --git a/deploy/nav2_ws/src/sportmode_nav2/launch/slam_launch.py b/deploy/nav2_ws/src/sportmode_nav2/launch/slam_launch.py deleted file mode 100644 index 578b449..0000000 --- a/deploy/nav2_ws/src/sportmode_nav2/launch/slam_launch.py +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright (c) 2020 Samsung Research Russia -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration -from launch_ros.actions import Node -from nav2_common.launch import RewrittenYaml - - -def generate_launch_description(): - # Input parameters declaration - namespace = LaunchConfiguration('namespace') - params_file = LaunchConfiguration('params_file') - use_sim_time = LaunchConfiguration('use_sim_time') - autostart = LaunchConfiguration('autostart') - - # Variables - lifecycle_nodes = ['map_saver'] - - # Getting directories and launch-files - bringup_dir = get_package_share_directory('sportmode_nav2') - slam_toolbox_dir = get_package_share_directory('sportmode_nav2') - slam_launch_file = os.path.join(slam_toolbox_dir, 'launch', 'mapping.launch.py') - - # Create our own temporary YAML files that include substitutions - param_substitutions = { - 'use_sim_time': use_sim_time} - - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites=param_substitutions, - convert_types=True) - - # Declare the launch arguments - declare_namespace_cmd = DeclareLaunchArgument( - 'namespace', - default_value='', - description='Top-level namespace') - - declare_params_file_cmd = DeclareLaunchArgument( - 'params_file', - default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'), - description='Full path to the ROS2 parameters file to use for all launched nodes') - - declare_use_sim_time_cmd = DeclareLaunchArgument( - 'use_sim_time', - default_value='true', - description='Use simulation (Gazebo) clock if true') - - declare_autostart_cmd = DeclareLaunchArgument( - 'autostart', default_value='true', - description='Automatically startup the nav2 stack') - - # Nodes launching commands - start_slam_toolbox_cmd = IncludeLaunchDescription( - PythonLaunchDescriptionSource(slam_launch_file), - launch_arguments={'use_sim_time': use_sim_time}.items()) - - start_map_saver_server_cmd = Node( - package='nav2_map_server', - node_executable='map_saver_server', - output='screen', - parameters=[configured_params]) - - start_lifecycle_manager_cmd = Node( - package='nav2_lifecycle_manager', - node_executable='lifecycle_manager', - node_name='lifecycle_manager_slam', - output='screen', - parameters=[{'use_sim_time': use_sim_time}, - {'autostart': autostart}, - {'node_names': lifecycle_nodes}]) - - ld = LaunchDescription() - - # Declare the launch options - ld.add_action(declare_namespace_cmd) - ld.add_action(declare_params_file_cmd) - ld.add_action(declare_use_sim_time_cmd) - ld.add_action(declare_autostart_cmd) - - # Running SLAM Toolbox - ld.add_action(start_slam_toolbox_cmd) - - # Running Map Saver Server - ld.add_action(start_map_saver_server_cmd) - ld.add_action(start_lifecycle_manager_cmd) - - return ld diff --git a/deploy/nav2_ws/src/sportmode_nav2/launch/slam_toolbox_localization.py b/deploy/nav2_ws/src/sportmode_nav2/launch/slam_toolbox_localization.py deleted file mode 100644 index 939c31a..0000000 --- a/deploy/nav2_ws/src/sportmode_nav2/launch/slam_toolbox_localization.py +++ /dev/null @@ -1,59 +0,0 @@ -import os - -from launch import LaunchDescription -from launch.actions import DeclareLaunchArgument, LogInfo -from launch.conditions import UnlessCondition -from launch.substitutions import LaunchConfiguration, PythonExpression -from launch_ros.actions import Node -from ament_index_python.packages import get_package_share_directory -from nav2_common.launch import HasNodeParams - - -def generate_launch_description(): - use_sim_time = LaunchConfiguration('use_sim_time', default=False) - params_file = LaunchConfiguration('params_file') - default_params_file = os.path.join(get_package_share_directory("sportmode_nav2"), - 'params', 'mapping_async.yaml') - - declare_use_sim_time_argument = DeclareLaunchArgument( - 'use_sim_time', - default_value='false', - description='Use simulation/Gazebo clock') - declare_params_file_cmd = DeclareLaunchArgument( - 'params_file', - default_value=default_params_file, - description='Full path to the ROS2 parameters file to use for the slam_toolbox node') - - # If the provided param file doesn't have slam_toolbox params, we must pass the - # default_params_file instead. This could happen due to automatic propagation of - # LaunchArguments. See: - # https://github.com/ros-planning/navigation2/pull/2243#issuecomment-800479866 - has_node_params = HasNodeParams(source_file=params_file, - node_name='slam_toolbox') - - actual_params_file = PythonExpression(['"', params_file, '" if ', has_node_params, - ' else "', default_params_file, '"']) - - log_param_change = LogInfo(msg=['provided params_file ', params_file, - ' does not contain slam_toolbox parameters. Using default: ', - default_params_file], - condition=UnlessCondition(has_node_params)) - - start_async_slam_toolbox_node = Node( - parameters=[ - actual_params_file, - {'use_sim_time': use_sim_time} - ], - package='slam_toolbox', - executable='async_slam_toolbox_node', - name='slam_toolbox', - output='screen') - - ld = LaunchDescription() - - ld.add_action(declare_use_sim_time_argument) - ld.add_action(declare_params_file_cmd) - ld.add_action(log_param_change) - ld.add_action(start_async_slam_toolbox_node) - - return ld diff --git a/deploy/nav2_ws/src/sportmode_nav2/params/localization_async.yaml b/deploy/nav2_ws/src/sportmode_nav2/params/localization_async.yaml index 18ec5d1..bf37f67 100644 --- a/deploy/nav2_ws/src/sportmode_nav2/params/localization_async.yaml +++ b/deploy/nav2_ws/src/sportmode_nav2/params/localization_async.yaml @@ -19,7 +19,7 @@ slam_toolbox: # if you'd like to immediately start continuing a map at a given pose # or at the dock, but they are mutually exclusive, if pose is given # will use pose - map_file_name: /home/unitree/locomotion/Go2Py/deploy/nav2_ws/Feb21_hallway + map_file_name: /home/unitree/locomotion/Go2Py/deploy/nav2_ws/maps/Feb21_hallway #map_start_pose: [0.33, 1.49, 0.0] map_start_at_dock: true