diff --git a/.circleci/config.yml b/.circleci/config.yml index 5041d365ac8..c752c1fcd15 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -482,7 +482,7 @@ _environments: executors: release_exec: docker: - - image: ghcr.io/ros-navigation/navigation2:main + - image: ghcr.io/ros-navigation/navigation2:humble resource_class: large working_directory: /opt/overlay_ws environment: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 77a326648db..01731dda48c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "dockerfile": "../Dockerfile", "context": "..", "target": "dever", - "cacheFrom": "ghcr.io/ros-navigation/navigation2:main" + "cacheFrom": "ghcr.io/ros-navigation/navigation2:humble" }, "runArgs": [ "--name=nav2" diff --git a/.github/mergify.yml b/.github/mergify.yml index 9abbb04672f..f91d5df4d38 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -26,6 +26,15 @@ pull_request_rules: branches: - humble + - name: backport to humble_main at reviewers discretion + conditions: + - base=main + - "label=backport-humble-main" + actions: + backport: + branches: + - humble_main + - name: delete head branch after merge conditions: - merged diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 62645e662aa..00000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Lint -on: - pull_request: - -jobs: - ament_lint_general: - name: ament_${{ matrix.linter }} - runs-on: ubuntu-latest - container: - image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest - strategy: - fail-fast: false - matrix: - linter: [xmllint, cpplint, uncrustify, pep257, flake8, mypy] - steps: - - uses: actions/checkout@v4 - - - name: Install typeshed for mypy - if: matrix.linter == 'mypy' - run: sudo apt update && sudo apt install -y python3-typeshed - - - uses: ros-tooling/action-ros-lint@v0.1 - with: - linter: ${{ matrix.linter }} - distribution: rolling - package-name: "*" - arguments: ${{ matrix.linter == 'mypy' && '--config tools/pyproject.toml' || '' }} - - pre-commit: - name: pre-commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.1 - env: - SKIP: >- - ament_lint_cmake, - ament_cpplint, - ament_uncrustify, - ament_xmllint, - ament_flake8, - ament_pep257, - ament_mypy diff --git a/.github/workflows/update_ci_image.yaml b/.github/workflows/update_ci_image.yaml index fac69ee5737..8e914771645 100644 --- a/.github/workflows/update_ci_image.yaml +++ b/.github/workflows/update_ci_image.yaml @@ -10,6 +10,7 @@ on: - main - jazzy - humble + - humble_main paths: - '**/package.xml' - '**/*.repos' diff --git a/Dockerfile b/Dockerfile index fb3555eb8fb..0b170bf7561 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ # docker build -t nav2:latest \ # --build-arg UNDERLAY_MIXINS \ # --build-arg OVERLAY_MIXINS ./ -ARG FROM_IMAGE=ros:rolling +ARG FROM_IMAGE=ros:humble ARG UNDERLAY_WS=/opt/underlay_ws ARG OVERLAY_WS=/opt/overlay_ws diff --git a/nav2_amcl/CMakeLists.txt b/nav2_amcl/CMakeLists.txt index 3cb30254fa3..31d031aeafa 100644 --- a/nav2_amcl/CMakeLists.txt +++ b/nav2_amcl/CMakeLists.txt @@ -146,12 +146,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - set(ament_cmake_cpplint_FOUND TRUE) - - ament_lint_auto_find_test_dependencies() endif() ament_export_include_directories("include/${PROJECT_NAME}") diff --git a/nav2_behavior_tree/CMakeLists.txt b/nav2_behavior_tree/CMakeLists.txt index 2a4d3ad90cf..06523c85046 100644 --- a/nav2_behavior_tree/CMakeLists.txt +++ b/nav2_behavior_tree/CMakeLists.txt @@ -297,8 +297,6 @@ install(FILES nav2_tree_nodes.xml DESTINATION share/${PROJECT_NAME}) install(FILES ${GENERATED_DIR}/plugins_list.hpp DESTINATION include/${PROJECT_NAME}/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp index 3f43b50e9b9..4a6f43b925f 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp @@ -26,6 +26,7 @@ #include "nav2_msgs/action/navigate_to_pose.hpp" #include "nav2_behavior_tree/bt_action_server.hpp" +#include "nav2_util/copy_all_parameter_values.hpp" #include "nav2_util/node_utils.hpp" #include "rcl_action/action_server.h" #include "rclcpp_lifecycle/lifecycle_node.hpp" @@ -164,7 +165,7 @@ bool BtActionServer::on_configure() node, "robot_base_frame", rclcpp::ParameterValue(std::string("base_link"))); nav2_util::declare_parameter_if_not_declared( node, "transform_tolerance", rclcpp::ParameterValue(0.1)); - rclcpp::copy_all_parameter_values(node, client_node_); + nav2_util::copy_all_parameter_values(node, client_node_); // set the timeout in seconds for the action server to discard goal handles if not finished double action_server_result_timeout = diff --git a/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp b/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp index 54e3ab11e4b..87011ee1507 100644 --- a/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp +++ b/nav2_behavior_tree/plugins/decorator/goal_updater_node.cpp @@ -38,7 +38,7 @@ GoalUpdater::GoalUpdater( initialize(); // Spin multiple times due to rclcpp regression in Jazzy requiring a 'warm up' spin - callback_group_executor_.spin_all(std::chrono::milliseconds(1)); + callback_group_executor_.spin_some(); } void GoalUpdater::initialize() diff --git a/nav2_behaviors/CMakeLists.txt b/nav2_behaviors/CMakeLists.txt index d1085c038a8..4a89cac3a7e 100644 --- a/nav2_behaviors/CMakeLists.txt +++ b/nav2_behaviors/CMakeLists.txt @@ -201,8 +201,6 @@ install(DIRECTORY plugins/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) find_package(rclcpp_action REQUIRED) diff --git a/nav2_bringup/CMakeLists.txt b/nav2_bringup/CMakeLists.txt index 5537046d246..3ccc3b86358 100644 --- a/nav2_bringup/CMakeLists.txt +++ b/nav2_bringup/CMakeLists.txt @@ -14,8 +14,6 @@ install(DIRECTORY rviz DESTINATION share/${PROJECT_NAME}) install(DIRECTORY params DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() endif() ament_package() diff --git a/nav2_bringup/launch/bringup_launch.py b/nav2_bringup/launch/bringup_launch.py index 05f54d67d8e..858e6a9784f 100644 --- a/nav2_bringup/launch/bringup_launch.py +++ b/nav2_bringup/launch/bringup_launch.py @@ -21,7 +21,7 @@ from launch.conditions import IfCondition from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import LaunchConfiguration, PythonExpression -from launch_ros.actions import Node, PushROSNamespace +from launch_ros.actions import Node, PushRosNamespace from launch_ros.descriptions import ParameterFile from nav2_common.launch import RewrittenYaml @@ -132,7 +132,7 @@ def generate_launch_description() -> LaunchDescription: # Specify the actions bringup_cmd_group = GroupAction( [ - PushROSNamespace(namespace), + PushRosNamespace(namespace), Node( condition=IfCondition(use_composition), name='nav2_container', diff --git a/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py b/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py index 8c7d51bdfe6..669886e55c2 100644 --- a/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py +++ b/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py @@ -20,37 +20,24 @@ from ament_index_python.packages import get_package_share_directory from launch import LaunchDescription -from launch.actions import (AppendEnvironmentVariable, DeclareLaunchArgument, ExecuteProcess, - ForEach, GroupAction, IncludeLaunchDescription, LogInfo, - OpaqueFunction, RegisterEventHandler) +from launch.actions import ( + AppendEnvironmentVariable, + DeclareLaunchArgument, + ExecuteProcess, + GroupAction, + IncludeLaunchDescription, + LogInfo, + OpaqueFunction, + RegisterEventHandler, +) from launch.conditions import IfCondition from launch.event_handlers import OnShutdown -from launch.launch_context import LaunchContext from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import LaunchConfiguration, TextSubstitution -import yaml +from nav2_common.launch import ParseMultiRobotPose -def count_robots(context: LaunchContext) -> list[LogInfo]: - """Count the number of robots from the 'robots' launch argument.""" - robots_str = LaunchConfiguration('robots').perform(context).strip() - log_msg = '' - - if not robots_str: - log_msg = 'No robots provided in the launch argument.' - - try: - robots_list = [yaml.safe_load(robot.strip()) for robot in - robots_str.split(';') if robot.strip()] - log_msg = f'number_of_robots={len(robots_list)}' - except yaml.YAMLError as e: - log_msg = f'Error parsing the robots launch argument: {e}' - - return [LogInfo(msg=[log_msg])] - - -def generate_robot_actions(name: str = '', pose: dict[str, float] = {}) -> list[GroupAction]: - """Generate the actions to launch a robot with the given name and pose.""" +def generate_robot_actions(context, *args, **kwargs): bringup_dir = get_package_share_directory('nav2_bringup') launch_dir = os.path.join(bringup_dir, 'launch') use_rviz = LaunchConfiguration('use_rviz') @@ -61,11 +48,17 @@ def generate_robot_actions(name: str = '', pose: dict[str, float] = {}) -> list[ graph_filepath = LaunchConfiguration('graph') use_robot_state_pub = LaunchConfiguration('use_robot_state_pub') + robots_substitution = ParseMultiRobotPose(LaunchConfiguration('robots')) + robots_list = robots_substitution.perform(context) + # Define commands for launching the navigation instances - group = GroupAction( + bringup_cmd_group = [] + for robot_name in robots_list: + init_pose = robots_list[robot_name] + group = GroupAction( [ LogInfo( - msg=['Launching namespace=', name, ' init_pose=', str(pose),] + msg=['Launching namespace=', robot_name, ' init_pose=', str(init_pose), ] ), IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -73,7 +66,7 @@ def generate_robot_actions(name: str = '', pose: dict[str, float] = {}) -> list[ ), condition=IfCondition(use_rviz), launch_arguments={ - 'namespace': TextSubstitution(text=name), + 'namespace': TextSubstitution(text=robot_name), 'rviz_config': rviz_config_file, }.items(), ), @@ -82,7 +75,7 @@ def generate_robot_actions(name: str = '', pose: dict[str, float] = {}) -> list[ os.path.join(bringup_dir, 'launch', 'tb3_simulation_launch.py') ), launch_arguments={ - 'namespace': name, + 'namespace': robot_name, 'map': map_yaml_file, 'graph': graph_filepath, 'use_sim_time': 'True', @@ -92,33 +85,32 @@ def generate_robot_actions(name: str = '', pose: dict[str, float] = {}) -> list[ 'use_simulator': 'False', 'headless': 'False', 'use_robot_state_pub': use_robot_state_pub, - 'x_pose': TextSubstitution(text=str(pose.get('x', 0.0))), - 'y_pose': TextSubstitution(text=str(pose.get('y', 0.0))), - 'z_pose': TextSubstitution(text=str(pose.get('z', 0.0))), - 'roll': TextSubstitution(text=str(pose.get('roll', 0.0))), - 'pitch': TextSubstitution(text=str(pose.get('pitch', 0.0))), - 'yaw': TextSubstitution(text=str(pose.get('yaw', 0.0))), - 'robot_name': TextSubstitution(text=name), + 'x_pose': TextSubstitution(text=str(init_pose['x'])), + 'y_pose': TextSubstitution(text=str(init_pose['y'])), + 'z_pose': TextSubstitution(text=str(init_pose['z'])), + 'roll': TextSubstitution(text=str(init_pose['roll'])), + 'pitch': TextSubstitution(text=str(init_pose['pitch'])), + 'yaw': TextSubstitution(text=str(init_pose['yaw'])), + 'robot_name': TextSubstitution(text=robot_name), }.items(), ), ] ) - return [group] + + bringup_cmd_group.append(group) + bringup_cmd_group.append(LogInfo(msg=['number_of_robots=', str(len(robots_list))])) + return bringup_cmd_group -def generate_launch_description() -> LaunchDescription: +def generate_launch_description(): """ Bring up the multi-robots with given launch arguments. Launch arguments consist of robot name(which is namespace) and pose for initialization. Keep general yaml format for pose information. - - ex) robots:='{name: 'robot1', pose: {x: 1.0, y: 1.0, yaw: 1.5707}}; - {name: 'robot2', pose: {x: 1.0, y: 1.0, yaw: 1.5707}}' - ex) robots:='{name: 'robot3', pose: {x: 1.0, y: 1.0, z: 1.0, - roll: 0.0, pitch: 1.5707, yaw: 1.5707}}; - {name: 'robot4', pose: {x: 1.0, y: 1.0, z: 1.0, - roll: 0.0, pitch: 1.5707, yaw: 1.5707}}' + ex) robots:='robot1={x: 1.0, y: 1.0, yaw: 1.5707}; robot2={x: 1.0, y: 1.0, yaw: 1.5707}' + ex) robots:='robot3={x: 1.0, y: 1.0, z: 1.0, roll: 0.0, pitch: 1.5707, yaw: 1.5707}; + robot4={x: 1.0, y: 1.0, z: 1.0, roll: 0.0, pitch: 1.5707, yaw: 1.5707}' """ # Get the launch directory bringup_dir = get_package_share_directory('nav2_bringup') @@ -144,10 +136,8 @@ def generate_launch_description() -> LaunchDescription: declare_robots_cmd = DeclareLaunchArgument( 'robots', - default_value=( - "{name: 'robot1', pose: {x: 0.5, y: 0.5, yaw: 0}};" - "{name: 'robot2', pose: {x: -0.5, y: -0.5, z: 0, roll: 0, pitch: 0, yaw: 1.5707}}" - ), + default_value="""robot1={x: 0.5, y: 0.5, yaw: 0}; + robot2={x: -0.5, y: -0.5, z: 0, roll: 0, pitch: 0, yaw: 1.5707}""", description='Robots and their initialization poses in YAML format', ) @@ -198,7 +188,7 @@ def generate_launch_description() -> LaunchDescription: world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', 'False'], world]) start_gazebo_cmd = ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf], output='screen', ) @@ -208,9 +198,9 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models')) + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models')) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve())) # Create the launch description and populate @@ -255,8 +245,6 @@ def generate_launch_description() -> LaunchDescription: ld.add_action( LogInfo(condition=IfCondition(log_settings), msg=['autostart: ', autostart]) ) - - ld.add_action(OpaqueFunction(function=count_robots)) - ld.add_action(ForEach(LaunchConfiguration('robots'), function=generate_robot_actions)) + ld.add_action(OpaqueFunction(function=generate_robot_actions)) return ld diff --git a/nav2_bringup/launch/tb3_simulation_launch.py b/nav2_bringup/launch/tb3_simulation_launch.py index 808580af0d4..cc40ed90c56 100644 --- a/nav2_bringup/launch/tb3_simulation_launch.py +++ b/nav2_bringup/launch/tb3_simulation_launch.py @@ -206,7 +206,7 @@ def generate_launch_description() -> LaunchDescription: world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', headless], world]) gazebo_server = ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf], output='screen', condition=IfCondition(use_simulator) ) @@ -224,7 +224,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( [use_simulator, ' and not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) gz_robot = IncludeLaunchDescription( diff --git a/nav2_bringup/launch/tb4_simulation_launch.py b/nav2_bringup/launch/tb4_simulation_launch.py index ba78b556ddc..f92181332bf 100644 --- a/nav2_bringup/launch/tb4_simulation_launch.py +++ b/nav2_bringup/launch/tb4_simulation_launch.py @@ -235,7 +235,7 @@ def generate_launch_description() -> LaunchDescription: world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', headless], world]) gazebo_server = ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf], output='screen', condition=IfCondition(use_simulator) ) @@ -246,7 +246,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) gazebo_client = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -256,7 +256,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( [use_simulator, ' and not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) gz_robot = IncludeLaunchDescription( diff --git a/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py b/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py index ae5c0bb4458..4210a98f2c3 100644 --- a/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py +++ b/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py @@ -137,7 +137,7 @@ def generate_launch_description() -> LaunchDescription: world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', 'False'], world]) start_gazebo_cmd = ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf], output='screen', ) @@ -221,9 +221,9 @@ def generate_launch_description() -> LaunchDescription: nav_instances_cmds.append(group) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models')) + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models')) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve())) # Create the launch description and populate diff --git a/nav2_bt_navigator/CMakeLists.txt b/nav2_bt_navigator/CMakeLists.txt index 5ced439631c..c6c1ad670a0 100644 --- a/nav2_bt_navigator/CMakeLists.txt +++ b/nav2_bt_navigator/CMakeLists.txt @@ -122,8 +122,6 @@ install(DIRECTORY include/ install(DIRECTORY behavior_trees DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() endif() ament_export_include_directories(include/${PROJECT_NAME}) diff --git a/nav2_collision_monitor/CMakeLists.txt b/nav2_collision_monitor/CMakeLists.txt index b56fde855c8..ba483721f0b 100644 --- a/nav2_collision_monitor/CMakeLists.txt +++ b/nav2_collision_monitor/CMakeLists.txt @@ -136,12 +136,6 @@ install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) install(DIRECTORY params DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_collision_monitor/launch/collision_detector_node.launch.py b/nav2_collision_monitor/launch/collision_detector_node.launch.py index 43714ab3607..d1e22f7e236 100644 --- a/nav2_collision_monitor/launch/collision_detector_node.launch.py +++ b/nav2_collision_monitor/launch/collision_detector_node.launch.py @@ -21,7 +21,7 @@ from launch.actions import DeclareLaunchArgument, GroupAction from launch.conditions import IfCondition from launch.substitutions import LaunchConfiguration, NotEqualsSubstitution, PythonExpression -from launch_ros.actions import LoadComposableNodes, Node, PushROSNamespace, SetParameter +from launch_ros.actions import LoadComposableNodes, Node, PushRosNamespace, SetParameter from launch_ros.descriptions import ComposableNode from nav2_common.launch import RewrittenYaml @@ -87,7 +87,7 @@ def generate_launch_description() -> LaunchDescription: condition=IfCondition(PythonExpression(['not ', use_composition])), actions=[ SetParameter('use_sim_time', use_sim_time), - PushROSNamespace( + PushRosNamespace( condition=IfCondition( NotEqualsSubstitution(LaunchConfiguration('namespace'), '') ), @@ -117,7 +117,7 @@ def generate_launch_description() -> LaunchDescription: condition=IfCondition(use_composition), actions=[ SetParameter('use_sim_time', use_sim_time), - PushROSNamespace( + PushRosNamespace( condition=IfCondition( NotEqualsSubstitution(LaunchConfiguration('namespace'), '') ), diff --git a/nav2_collision_monitor/launch/collision_monitor_node.launch.py b/nav2_collision_monitor/launch/collision_monitor_node.launch.py index 5bad8f7b7d3..bdec44d921e 100644 --- a/nav2_collision_monitor/launch/collision_monitor_node.launch.py +++ b/nav2_collision_monitor/launch/collision_monitor_node.launch.py @@ -21,7 +21,7 @@ from launch.actions import DeclareLaunchArgument, GroupAction from launch.conditions import IfCondition from launch.substitutions import LaunchConfiguration, NotEqualsSubstitution, PythonExpression -from launch_ros.actions import LoadComposableNodes, Node, PushROSNamespace, SetParameter +from launch_ros.actions import LoadComposableNodes, Node, PushRosNamespace, SetParameter from launch_ros.descriptions import ComposableNode, ParameterFile from nav2_common.launch import RewrittenYaml @@ -90,7 +90,7 @@ def generate_launch_description() -> LaunchDescription: condition=IfCondition(PythonExpression(['not ', use_composition])), actions=[ SetParameter('use_sim_time', use_sim_time), - PushROSNamespace( + PushRosNamespace( condition=IfCondition( NotEqualsSubstitution(LaunchConfiguration('namespace'), '') ), @@ -120,7 +120,7 @@ def generate_launch_description() -> LaunchDescription: condition=IfCondition(use_composition), actions=[ SetParameter('use_sim_time', use_sim_time), - PushROSNamespace( + PushRosNamespace( condition=IfCondition( NotEqualsSubstitution(LaunchConfiguration('namespace'), '') ), diff --git a/nav2_collision_monitor/src/collision_detector_node.cpp b/nav2_collision_monitor/src/collision_detector_node.cpp index 7f87bc1bb92..072795c7e6f 100644 --- a/nav2_collision_monitor/src/collision_detector_node.cpp +++ b/nav2_collision_monitor/src/collision_detector_node.cpp @@ -82,7 +82,7 @@ CollisionDetector::on_activate(const rclcpp_lifecycle::State & /*state*/) } // Creating timer - timer_ = this->create_timer( + timer_ = this->create_wall_timer( std::chrono::duration{1.0 / frequency_}, std::bind(&CollisionDetector::process, this)); diff --git a/nav2_common/nav2_common/launch/__init__.py b/nav2_common/nav2_common/launch/__init__.py index b8eaaba2a9f..61ea85dd793 100644 --- a/nav2_common/nav2_common/launch/__init__.py +++ b/nav2_common/nav2_common/launch/__init__.py @@ -13,6 +13,7 @@ # limitations under the License. from .has_node_params import HasNodeParams +from .parse_multirobot_pose import ParseMultiRobotPose from .replace_string import ReplaceString from .rewritten_yaml import RewrittenYaml @@ -20,4 +21,5 @@ 'HasNodeParams', 'RewrittenYaml', 'ReplaceString', + 'ParseMultiRobotPose', ] diff --git a/nav2_common/nav2_common/launch/parse_multirobot_pose.py b/nav2_common/nav2_common/launch/parse_multirobot_pose.py new file mode 100644 index 00000000000..ced8352ac42 --- /dev/null +++ b/nav2_common/nav2_common/launch/parse_multirobot_pose.py @@ -0,0 +1,66 @@ +# Copyright (c) 2023 LG Electronics. +# +# 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. + +from typing import Dict, Text + +import launch +from launch.launch_context import LaunchContext +import yaml + + +class ParseMultiRobotPose(launch.Substitution): + """ + A custom substitution to parse the robots argument for multi-robot poses. + + Expects input in the format: + robots:="robot1={x: 1.0, y: 1.0, yaw: 0.0}; + robot2={x: 1.0, y: 1.0, z: 1.0, roll: 0.0, pitch: 1.5707, yaw: 1.5707}"` + + The individual robots are separated by a `;` and each robot consists of a name and pose object. + The name corresponds to the namespace of the robot and name of the Gazebo object. + The pose consists of X, Y, Z, Roll, Pitch, Yaw each of which can be omitted in which case it is + inferred as 0. + """ + + def __init__(self, robots_argument: launch.SomeSubstitutionsType) -> None: + super().__init__() + self.__robots_argument = robots_argument + + def describe(self) -> Text: + """Return a description of this substitution as a string.""" + return '' + + def perform(self, context: LaunchContext) -> Dict: + """Resolve and parse the robots argument string into a dictionary.""" + robots_str = self.__robots_argument.perform(context) + if not robots_str: + return {} + + multirobots = {} + for robot_entry in robots_str.split(';'): + key_val = robot_entry.strip().split('=') + if len(key_val) != 2: + continue + + robot_name, pose_str = key_val[0].strip(), key_val[1].strip() + robot_pose = yaml.safe_load(pose_str) + # Set default values if not provided + robot_pose.setdefault('x', 0.0) + robot_pose.setdefault('y', 0.0) + robot_pose.setdefault('z', 0.0) + robot_pose.setdefault('roll', 0.0) + robot_pose.setdefault('pitch', 0.0) + robot_pose.setdefault('yaw', 0.0) + multirobots[robot_name] = robot_pose + return multirobots diff --git a/nav2_constrained_smoother/CMakeLists.txt b/nav2_constrained_smoother/CMakeLists.txt index c859303edfa..cdbddac748d 100644 --- a/nav2_constrained_smoother/CMakeLists.txt +++ b/nav2_constrained_smoother/CMakeLists.txt @@ -48,10 +48,6 @@ target_link_libraries(${library_name} PRIVATE ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) find_package(angles REQUIRED) diff --git a/nav2_controller/CMakeLists.txt b/nav2_controller/CMakeLists.txt index 76725b8d47f..4919522d5b6 100644 --- a/nav2_controller/CMakeLists.txt +++ b/nav2_controller/CMakeLists.txt @@ -146,10 +146,6 @@ target_link_libraries(stopped_goal_checker PRIVATE ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) diff --git a/nav2_core/CMakeLists.txt b/nav2_core/CMakeLists.txt index 1d0e6b724f5..1f7b64bf470 100644 --- a/nav2_core/CMakeLists.txt +++ b/nav2_core/CMakeLists.txt @@ -46,10 +46,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() endif() ament_export_include_directories(include/${PROJECT_NAME}) diff --git a/nav2_costmap_2d/CMakeLists.txt b/nav2_costmap_2d/CMakeLists.txt index fc8b8071d8d..fd1755ed899 100644 --- a/nav2_costmap_2d/CMakeLists.txt +++ b/nav2_costmap_2d/CMakeLists.txt @@ -46,17 +46,17 @@ target_include_directories(nav2_costmap_2d_core "$" "$" ) -target_link_libraries(nav2_costmap_2d_core PUBLIC - ${geometry_msgs_TARGETS} - ${map_msgs_TARGETS} - ${nav_msgs_TARGETS} - ${nav2_msgs_TARGETS} - nav2_util::nav2_util_core - pluginlib::pluginlib - ${std_srvs_TARGETS} - tf2::tf2 - tf2_ros::tf2_ros - tf2_sensor_msgs::tf2_sensor_msgs +ament_target_dependencies(nav2_costmap_2d_core + geometry_msgs + map_msgs + nav_msgs + nav2_msgs + nav2_util + pluginlib + std_srvs + tf2 + tf2_ros + tf2_sensor_msgs ) add_library(layers SHARED @@ -168,11 +168,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - set(ament_cmake_cpplint_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_costmap_2d/test/integration/dyn_params_tests.cpp b/nav2_costmap_2d/test/integration/dyn_params_tests.cpp index 7376af89ecf..9bb7af22ead 100644 --- a/nav2_costmap_2d/test/integration/dyn_params_tests.cpp +++ b/nav2_costmap_2d/test/integration/dyn_params_tests.cpp @@ -76,8 +76,8 @@ TEST(DynParamTestNode, testDynParamsSet) rclcpp::Parameter("robot_base_frame", "wrong_test_frame"), }); - rclcpp::spin_all(node->get_node_base_interface(), std::chrono::milliseconds(50)); - rclcpp::spin_all(costmap->get_node_base_interface(), std::chrono::milliseconds(50)); + rclcpp::spin_some(node->get_node_base_interface()); + rclcpp::spin_some(costmap->get_node_base_interface()); EXPECT_EQ(costmap->get_parameter("robot_radius").as_double(), 1.234); EXPECT_EQ(costmap->get_parameter("footprint_padding").as_double(), 2.345); diff --git a/nav2_docking/opennav_docking/CMakeLists.txt b/nav2_docking/opennav_docking/CMakeLists.txt index 508091931b6..6e4f915adc2 100644 --- a/nav2_docking/opennav_docking/CMakeLists.txt +++ b/nav2_docking/opennav_docking/CMakeLists.txt @@ -67,7 +67,7 @@ target_link_libraries(${library_name} PUBLIC rclcpp_lifecycle::rclcpp_lifecycle ${rcl_interfaces_TARGETS} tf2_ros::tf2_ros - yaml-cpp::yaml-cpp + yaml-cpp ) target_link_libraries(${library_name} PRIVATE rclcpp_components::component @@ -174,12 +174,10 @@ install(DIRECTORY test/dock_files ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) find_package(ament_index_cpp REQUIRED) - ament_lint_auto_find_test_dependencies() ament_find_gtest() add_subdirectory(test) endif() diff --git a/nav2_docking/opennav_docking/test/test_docking_server.py b/nav2_docking/opennav_docking/test/test_docking_server.py index 06e2fa1d105..6d1a8d6db4d 100644 --- a/nav2_docking/opennav_docking/test/test_docking_server.py +++ b/nav2_docking/opennav_docking/test/test_docking_server.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import annotations from math import acos, cos, sin import os import time diff --git a/nav2_docking/opennav_docking_bt/CMakeLists.txt b/nav2_docking/opennav_docking_bt/CMakeLists.txt index a852c4124b7..01e460e587a 100644 --- a/nav2_docking/opennav_docking_bt/CMakeLists.txt +++ b/nav2_docking/opennav_docking_bt/CMakeLists.txt @@ -57,9 +57,7 @@ install(DIRECTORY include/ install(DIRECTORY behavior_trees DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) - ament_lint_auto_find_test_dependencies() add_subdirectory(test) endif() diff --git a/nav2_docking/opennav_docking_core/CMakeLists.txt b/nav2_docking/opennav_docking_core/CMakeLists.txt index 3d62476effc..702c84a8e07 100644 --- a/nav2_docking/opennav_docking_core/CMakeLists.txt +++ b/nav2_docking/opennav_docking_core/CMakeLists.txt @@ -33,10 +33,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() endif() ament_export_include_directories(include/${PROJECT_NAME}) diff --git a/nav2_dwb_controller/costmap_queue/CMakeLists.txt b/nav2_dwb_controller/costmap_queue/CMakeLists.txt index 28d47ed3dd5..f6d39eaa8e4 100644 --- a/nav2_dwb_controller/costmap_queue/CMakeLists.txt +++ b/nav2_dwb_controller/costmap_queue/CMakeLists.txt @@ -21,11 +21,6 @@ target_link_libraries(${PROJECT_NAME} PUBLIC ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) find_package(rclcpp REQUIRED) diff --git a/nav2_dwb_controller/dwb_core/CMakeLists.txt b/nav2_dwb_controller/dwb_core/CMakeLists.txt index e689b318058..5e80caf9697 100644 --- a/nav2_dwb_controller/dwb_core/CMakeLists.txt +++ b/nav2_dwb_controller/dwb_core/CMakeLists.txt @@ -63,11 +63,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_dwb_controller/dwb_critics/CMakeLists.txt b/nav2_dwb_controller/dwb_critics/CMakeLists.txt index 17833b75692..0e6f2cbeb1d 100644 --- a/nav2_dwb_controller/dwb_critics/CMakeLists.txt +++ b/nav2_dwb_controller/dwb_critics/CMakeLists.txt @@ -65,10 +65,6 @@ install(FILES default_critics.xml ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_dwb_controller/dwb_plugins/CMakeLists.txt b/nav2_dwb_controller/dwb_plugins/CMakeLists.txt index 75a00b9b7f7..142a11745b9 100644 --- a/nav2_dwb_controller/dwb_plugins/CMakeLists.txt +++ b/nav2_dwb_controller/dwb_plugins/CMakeLists.txt @@ -39,11 +39,6 @@ target_link_libraries(standard_traj_generator PRIVATE ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt b/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt index fd801fef661..4a0d05639a1 100644 --- a/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt +++ b/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt @@ -77,11 +77,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_graceful_controller/CMakeLists.txt b/nav2_graceful_controller/CMakeLists.txt index e79ea8d01fc..41536430399 100644 --- a/nav2_graceful_controller/CMakeLists.txt +++ b/nav2_graceful_controller/CMakeLists.txt @@ -81,11 +81,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_lifecycle_manager/CMakeLists.txt b/nav2_lifecycle_manager/CMakeLists.txt index 85179764ee3..432a145aad5 100644 --- a/nav2_lifecycle_manager/CMakeLists.txt +++ b/nav2_lifecycle_manager/CMakeLists.txt @@ -71,9 +71,6 @@ install(TARGETS install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) find_package(rclcpp_lifecycle REQUIRED) diff --git a/nav2_loopback_sim/nav2_loopback_sim/utils.py b/nav2_loopback_sim/nav2_loopback_sim/utils.py index be3b4e73c29..c85cefab626 100644 --- a/nav2_loopback_sim/nav2_loopback_sim/utils.py +++ b/nav2_loopback_sim/nav2_loopback_sim/utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - +from __future__ import annotations import math from geometry_msgs.msg import Quaternion, Transform diff --git a/nav2_map_server/CMakeLists.txt b/nav2_map_server/CMakeLists.txt index c193685363b..0da63fba591 100644 --- a/nav2_map_server/CMakeLists.txt +++ b/nav2_map_server/CMakeLists.txt @@ -49,7 +49,7 @@ target_link_libraries(${map_io_library_name} PUBLIC target_link_libraries(${map_io_library_name} PRIVATE ${GRAPHICSMAGICKCPP_LIBRARIES} tf2::tf2 - yaml-cpp::yaml-cpp + yaml-cpp ) add_library(${library_name} SHARED @@ -71,7 +71,7 @@ target_link_libraries(${library_name} PUBLIC target_link_libraries(${library_name} PRIVATE ${lifecycle_msgs_TARGETS} rclcpp_components::component - yaml-cpp::yaml-cpp + yaml-cpp ) add_executable(${map_server_executable} @@ -156,11 +156,6 @@ install(DIRECTORY include/ install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() add_subdirectory(test) diff --git a/nav2_mppi_controller/CMakeLists.txt b/nav2_mppi_controller/CMakeLists.txt index 3f2b40688cd..4abc1e888ef 100644 --- a/nav2_mppi_controller/CMakeLists.txt +++ b/nav2_mppi_controller/CMakeLists.txt @@ -116,10 +116,7 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() ament_find_gtest() diff --git a/nav2_mppi_controller/package.xml b/nav2_mppi_controller/package.xml index 2ca388340cf..3ed96f7abdb 100644 --- a/nav2_mppi_controller/package.xml +++ b/nav2_mppi_controller/package.xml @@ -29,6 +29,7 @@ visualization_msgs eigen3_cmake_module eigen + benchmark ament_lint_auto ament_lint_common diff --git a/nav2_navfn_planner/CMakeLists.txt b/nav2_navfn_planner/CMakeLists.txt index 478756e2871..c57faaa6bb5 100644 --- a/nav2_navfn_planner/CMakeLists.txt +++ b/nav2_navfn_planner/CMakeLists.txt @@ -61,9 +61,7 @@ install(FILES global_planner_plugin.xml ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) - ament_lint_auto_find_test_dependencies() ament_find_gtest() add_subdirectory(test) diff --git a/nav2_planner/CMakeLists.txt b/nav2_planner/CMakeLists.txt index a5bce30e77f..d6ad5b51842 100644 --- a/nav2_planner/CMakeLists.txt +++ b/nav2_planner/CMakeLists.txt @@ -72,9 +72,7 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) - ament_lint_auto_find_test_dependencies() ament_find_gtest() add_subdirectory(test) diff --git a/nav2_regulated_pure_pursuit_controller/CMakeLists.txt b/nav2_regulated_pure_pursuit_controller/CMakeLists.txt index 91364c36bca..77af38c103f 100644 --- a/nav2_regulated_pure_pursuit_controller/CMakeLists.txt +++ b/nav2_regulated_pure_pursuit_controller/CMakeLists.txt @@ -61,13 +61,10 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(tf2_geometry_msgs REQUIRED) + find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() add_subdirectory(test) endif() diff --git a/nav2_regulated_pure_pursuit_controller/include/nav2_regulated_pure_pursuit_controller/parameter_handler.hpp b/nav2_regulated_pure_pursuit_controller/include/nav2_regulated_pure_pursuit_controller/parameter_handler.hpp index 7b1be9855d2..765a0e85dc0 100644 --- a/nav2_regulated_pure_pursuit_controller/include/nav2_regulated_pure_pursuit_controller/parameter_handler.hpp +++ b/nav2_regulated_pure_pursuit_controller/include/nav2_regulated_pure_pursuit_controller/parameter_handler.hpp @@ -93,13 +93,12 @@ class ParameterHandler * @brief Callback executed when a parameter change is detected * @param event ParameterEvent message */ - void + rcl_interfaces::msg::SetParametersResult updateParametersCallback(std::vector parameters); rcl_interfaces::msg::SetParametersResult validateParameterUpdatesCallback(std::vector parameters); // Dynamic parameters handler std::mutex mutex_; - rclcpp::node_interfaces::PostSetParametersCallbackHandle::SharedPtr post_set_params_handler_; rclcpp::node_interfaces::OnSetParametersCallbackHandle::SharedPtr on_set_params_handler_; Parameters params_; std::string plugin_name_; diff --git a/nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp b/nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp index e69a21875a4..984d3f31af6 100644 --- a/nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp +++ b/nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp @@ -189,23 +189,15 @@ ParameterHandler::ParameterHandler( params_.use_cost_regulated_linear_velocity_scaling = false; } - post_set_params_handler_ = node->add_post_set_parameters_callback( - std::bind( - &ParameterHandler::updateParametersCallback, - this, std::placeholders::_1)); on_set_params_handler_ = node->add_on_set_parameters_callback( std::bind( - &ParameterHandler::validateParameterUpdatesCallback, + &ParameterHandler::updateParametersCallback, this, std::placeholders::_1)); } ParameterHandler::~ParameterHandler() { auto node = node_.lock(); - if (post_set_params_handler_ && node) { - node->remove_post_set_parameters_callback(post_set_params_handler_.get()); - } - post_set_params_handler_.reset(); if (on_set_params_handler_ && node) { node->remove_on_set_parameters_callback(on_set_params_handler_.get()); } @@ -246,18 +238,25 @@ rcl_interfaces::msg::SetParametersResult ParameterHandler::validateParameterUpda } return result; } -void +rcl_interfaces::msg::SetParametersResult ParameterHandler::updateParametersCallback( std::vector parameters) { + rcl_interfaces::msg::SetParametersResult result; std::lock_guard lock_reinit(mutex_); - for (const auto & parameter : parameters) { + for (auto parameter : parameters) { const auto & type = parameter.get_type(); const auto & name = parameter.get_name(); if (type == ParameterType::PARAMETER_DOUBLE) { if (name == plugin_name_ + ".inflation_cost_scaling_factor") { + if (parameter.as_double() <= 0.0) { + RCLCPP_WARN( + logger_, "The value inflation_cost_scaling_factor is incorrectly set, " + "it should be >0. Ignoring parameter update."); + continue; + } params_.inflation_cost_scaling_factor = parameter.as_double(); } else if (name == plugin_name_ + ".desired_linear_vel") { params_.desired_linear_vel = parameter.as_double(); @@ -313,12 +312,21 @@ ParameterHandler::updateParametersCallback( } else if (name == plugin_name_ + ".use_cancel_deceleration") { params_.use_cancel_deceleration = parameter.as_bool(); } else if (name == plugin_name_ + ".allow_reversing") { + if (params_.use_rotate_to_heading && parameter.as_bool()) { + RCLCPP_WARN( + logger_, "Both use_rotate_to_heading and allow_reversing " + "parameter cannot be set to true. Rejecting parameter update."); + continue; + } params_.allow_reversing = parameter.as_bool(); } else if (name == plugin_name_ + ".interpolate_curvature_after_goal") { params_.interpolate_curvature_after_goal = parameter.as_bool(); } } } + + result.successful = true; + return result; } } // namespace nav2_regulated_pure_pursuit_controller diff --git a/nav2_rotation_shim_controller/CMakeLists.txt b/nav2_rotation_shim_controller/CMakeLists.txt index fafa98863c1..72ef7ec2501 100644 --- a/nav2_rotation_shim_controller/CMakeLists.txt +++ b/nav2_rotation_shim_controller/CMakeLists.txt @@ -55,11 +55,8 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() + find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() add_subdirectory(test) endif() diff --git a/nav2_route/CMakeLists.txt b/nav2_route/CMakeLists.txt index db7825a0c96..be868d234c2 100644 --- a/nav2_route/CMakeLists.txt +++ b/nav2_route/CMakeLists.txt @@ -240,10 +240,6 @@ install(DIRECTORY graphs DESTINATION share/${PROJECT_NAME}) install(DIRECTORY test/test_graphs DESTINATION share/${PROJECT_NAME}/test) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) add_subdirectory(test) endif() diff --git a/nav2_route/include/nav2_route/plugins/route_operation_client.hpp b/nav2_route/include/nav2_route/plugins/route_operation_client.hpp index e0862ed81e2..dd2678dd166 100644 --- a/nav2_route/include/nav2_route/plugins/route_operation_client.hpp +++ b/nav2_route/include/nav2_route/plugins/route_operation_client.hpp @@ -121,7 +121,7 @@ class RouteOperationClient : public RouteOperation // indicate the endpoint for the particular service call. if (!main_srv_name_.empty()) { main_client_ = node->create_client( - main_srv_name_, rclcpp::SystemDefaultsQoS(), callback_group_); + main_srv_name_, rclcpp::SystemDefaultsQoS().get_rmw_qos_profile(), callback_group_); } } @@ -162,7 +162,7 @@ class RouteOperationClient : public RouteOperation } else { auto node = node_.lock(); auto client = node->create_client( - srv_name, rclcpp::SystemDefaultsQoS(), callback_group_); + srv_name, rclcpp::SystemDefaultsQoS().get_rmw_qos_profile(), callback_group_); response = callService(client, req); } diff --git a/nav2_route/test/test_graph_loader.cpp b/nav2_route/test/test_graph_loader.cpp index 145d84aea3a..b1a49340518 100644 --- a/nav2_route/test/test_graph_loader.cpp +++ b/nav2_route/test/test_graph_loader.cpp @@ -107,8 +107,8 @@ TEST(GraphLoader, test_transformation_api) tf_broadcaster->sendTransform(transform); rclcpp::Rate(1).sleep(); tf_broadcaster->sendTransform(transform); - rclcpp::spin_all(node->get_node_base_interface(), std::chrono::milliseconds(1)); - rclcpp::spin_all(node->get_node_base_interface(), std::chrono::milliseconds(50)); + rclcpp::spin_some(node->get_node_base_interface()); + rclcpp::spin_some(node->get_node_base_interface()); graph[0].coords.frame_id = "map_test"; EXPECT_EQ(graph[0].coords.frame_id, "map_test"); diff --git a/nav2_route/test/test_graph_saver.cpp b/nav2_route/test/test_graph_saver.cpp index e6a3913f51a..5be1228fa4a 100644 --- a/nav2_route/test/test_graph_saver.cpp +++ b/nav2_route/test/test_graph_saver.cpp @@ -143,8 +143,8 @@ TEST(GraphSaver, test_transformation_api) tf_broadcaster->sendTransform(transform); rclcpp::Rate(1).sleep(); tf_broadcaster->sendTransform(transform); - rclcpp::spin_all(node->get_node_base_interface(), std::chrono::milliseconds(1)); - rclcpp::spin_all(node->get_node_base_interface(), std::chrono::milliseconds(50)); + rclcpp::spin_some(node->get_node_base_interface()); + rclcpp::spin_some(node->get_node_base_interface()); GraphSaver graph_saver(node, tf, frame); std::string file_path = "test.geojson"; diff --git a/nav2_rviz_plugins/CMakeLists.txt b/nav2_rviz_plugins/CMakeLists.txt index 2b9e6c30c44..50612582dbc 100644 --- a/nav2_rviz_plugins/CMakeLists.txt +++ b/nav2_rviz_plugins/CMakeLists.txt @@ -91,7 +91,7 @@ target_link_libraries(${library_name} PUBLIC target_link_libraries(${library_name} PRIVATE ament_index_cpp::ament_index_cpp pluginlib::pluginlib - yaml-cpp::yaml-cpp + yaml-cpp ) pluginlib_export_plugin_description_file(rviz_common plugins_description.xml) @@ -117,8 +117,6 @@ install( install(DIRECTORY rviz launch DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() endif() ament_export_include_directories(include/${PROJECT_NAME}) diff --git a/nav2_simple_commander/launch/assisted_teleop_example_launch.py b/nav2_simple_commander/launch/assisted_teleop_example_launch.py index 756ad7d5946..805ea288331 100644 --- a/nav2_simple_commander/launch/assisted_teleop_example_launch.py +++ b/nav2_simple_commander/launch/assisted_teleop_example_launch.py @@ -58,7 +58,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -66,7 +66,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -76,7 +76,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -127,7 +127,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/follow_path_example_launch.py b/nav2_simple_commander/launch/follow_path_example_launch.py index fc205c27016..0d268c4f616 100644 --- a/nav2_simple_commander/launch/follow_path_example_launch.py +++ b/nav2_simple_commander/launch/follow_path_example_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/inspection_demo_launch.py b/nav2_simple_commander/launch/inspection_demo_launch.py index 01f3443cc22..8825e370b9f 100644 --- a/nav2_simple_commander/launch/inspection_demo_launch.py +++ b/nav2_simple_commander/launch/inspection_demo_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/nav_through_poses_example_launch.py b/nav2_simple_commander/launch/nav_through_poses_example_launch.py index c4a73c4887a..186577abde0 100644 --- a/nav2_simple_commander/launch/nav_through_poses_example_launch.py +++ b/nav2_simple_commander/launch/nav_through_poses_example_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/nav_to_pose_example_launch.py b/nav2_simple_commander/launch/nav_to_pose_example_launch.py index 832ed7cdce7..1eec6eb0dfb 100644 --- a/nav2_simple_commander/launch/nav_to_pose_example_launch.py +++ b/nav2_simple_commander/launch/nav_to_pose_example_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/picking_demo_launch.py b/nav2_simple_commander/launch/picking_demo_launch.py index 41f0180ad69..3abe1576cfa 100644 --- a/nav2_simple_commander/launch/picking_demo_launch.py +++ b/nav2_simple_commander/launch/picking_demo_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/recoveries_example_launch.py b/nav2_simple_commander/launch/recoveries_example_launch.py index 7c94600edfd..a655650d4c2 100644 --- a/nav2_simple_commander/launch/recoveries_example_launch.py +++ b/nav2_simple_commander/launch/recoveries_example_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/route_example_launch.py b/nav2_simple_commander/launch/route_example_launch.py index 8490f70556a..552e14ab4b3 100644 --- a/nav2_simple_commander/launch/route_example_launch.py +++ b/nav2_simple_commander/launch/route_example_launch.py @@ -61,7 +61,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -117,7 +117,7 @@ def generate_launch_description() -> LaunchDescription: output='screen') set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/security_demo_launch.py b/nav2_simple_commander/launch/security_demo_launch.py index e7ae653e0f0..4963f2f6ee9 100644 --- a/nav2_simple_commander/launch/security_demo_launch.py +++ b/nav2_simple_commander/launch/security_demo_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/launch/waypoint_follower_example_launch.py b/nav2_simple_commander/launch/waypoint_follower_example_launch.py index 22952fc6739..57b565d54ed 100644 --- a/nav2_simple_commander/launch/waypoint_follower_example_launch.py +++ b/nav2_simple_commander/launch/waypoint_follower_example_launch.py @@ -57,7 +57,7 @@ def generate_launch_description() -> LaunchDescription: PythonLaunchDescriptionSource( os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + launch_arguments={'ign_args': ['-r -s ', world_sdf]}.items()) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ @@ -65,7 +65,7 @@ def generate_launch_description() -> LaunchDescription: ])) set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'worlds')) start_gazebo_client_cmd = IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -75,7 +75,7 @@ def generate_launch_description() -> LaunchDescription: ), condition=IfCondition(PythonExpression( ['not ', headless])), - launch_arguments={'gz_args': ['-v4 -g ']}.items(), + launch_arguments={'ign_args': ['-v4 -g ']}.items(), ) spawn_robot_cmd = IncludeLaunchDescription( @@ -126,7 +126,7 @@ def generate_launch_description() -> LaunchDescription: ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(desc_dir)).parent.resolve())) ld = LaunchDescription() diff --git a/nav2_simple_commander/nav2_simple_commander/robot_navigator.py b/nav2_simple_commander/nav2_simple_commander/robot_navigator.py index 50fd706ec57..9327bd57c0e 100644 --- a/nav2_simple_commander/nav2_simple_commander/robot_navigator.py +++ b/nav2_simple_commander/nav2_simple_commander/robot_navigator.py @@ -38,8 +38,6 @@ from rclpy.duration import Duration as rclpyDuration from rclpy.node import Node from rclpy.qos import QoSDurabilityPolicy, QoSHistoryPolicy, QoSProfile, QoSReliabilityPolicy -from rclpy.task import Future -from rclpy.type_support import GetResultServiceResponse # Task Result enum for the result of the task being executed @@ -77,9 +75,8 @@ def __init__(self, node_name: str = 'basic_navigator', namespace: str = '') -> N self.initial_pose.header.frame_id = 'map' self.goal_handle: Optional[ClientGoalHandle[Any, Any, Any]] = None - self.result_future: \ - Optional[Future[GetResultServiceResponse[Any]]] = None - self.feedback: Any = None + self.result_future = None + self.feedback: str = '' self.status: Optional[int] = None # Since the route server's compute and track action server is likely @@ -87,8 +84,7 @@ def __init__(self, node_name: str = 'basic_navigator', namespace: str = '') -> N # we must track its futures and feedback separately. Additionally, the # route tracking feedback is uniquely important to be complete and ordered self.route_goal_handle: Optional[ClientGoalHandle[Any, Any, Any]] = None - self.route_result_future: \ - Optional[Future[GetResultServiceResponse[Any]]] = None + self.route_result_future = None self.route_feedback: list[Any] = [] # Error code and messages from servers diff --git a/nav2_simple_commander/nav2_simple_commander/utils.py b/nav2_simple_commander/nav2_simple_commander/utils.py index 8aed7434ec5..a04896d9990 100644 --- a/nav2_simple_commander/nav2_simple_commander/utils.py +++ b/nav2_simple_commander/nav2_simple_commander/utils.py @@ -22,7 +22,7 @@ def find_os_processes(name: str) -> list[tuple[str, str]]: - """Find all the processes that are running gz sim.""" + """Find all the processes that are running ign gazebo.""" ps_output = subprocess.check_output(['ps', 'aux'], text=True) ps_lines = ps_output.split('\n') gz_sim_processes = [] diff --git a/nav2_smac_planner/CMakeLists.txt b/nav2_smac_planner/CMakeLists.txt index 4ae1a98ad9e..5f1989fbe6b 100644 --- a/nav2_smac_planner/CMakeLists.txt +++ b/nav2_smac_planner/CMakeLists.txt @@ -171,9 +171,6 @@ install(DIRECTORY include/ install(DIRECTORY lattice_primitives/sample_primitives DESTINATION share/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - set(AMENT_LINT_AUTO_FILE_EXCLUDE include/nav2_smac_planner/thirdparty/robin_hood.h) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() add_subdirectory(test) diff --git a/nav2_smoother/CMakeLists.txt b/nav2_smoother/CMakeLists.txt index 7e93a035c08..20b1a5511a6 100644 --- a/nav2_smoother/CMakeLists.txt +++ b/nav2_smoother/CMakeLists.txt @@ -110,10 +110,6 @@ pluginlib_export_plugin_description_file(nav2_core plugins.xml) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) find_package(ament_index_cpp REQUIRED) diff --git a/nav2_system_tests/CMakeLists.txt b/nav2_system_tests/CMakeLists.txt index 14accf51e39..55ca0ddbd82 100644 --- a/nav2_system_tests/CMakeLists.txt +++ b/nav2_system_tests/CMakeLists.txt @@ -10,7 +10,6 @@ if(BUILD_TESTING) find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) find_package(ament_index_cpp REQUIRED) - find_package(ament_lint_auto REQUIRED) find_package(angles REQUIRED) find_package(behaviortree_cpp REQUIRED) find_package(geometry_msgs REQUIRED) @@ -34,8 +33,6 @@ if(BUILD_TESTING) find_package(tf2_ros REQUIRED) find_package(visualization_msgs REQUIRED) - ament_lint_auto_find_test_dependencies() - ament_find_gtest() set(local_controller_plugin_lib local_controller) @@ -114,7 +111,6 @@ if(BUILD_TESTING) add_subdirectory(src/updown) add_subdirectory(src/waypoint_follower) add_subdirectory(src/route) - add_subdirectory(src/gps_navigation) add_subdirectory(src/behaviors/wait) add_subdirectory(src/behaviors/spin) add_subdirectory(src/behaviors/backup) diff --git a/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py b/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py index 3a934d0b6eb..14e3737c710 100755 --- a/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py +++ b/nav2_system_tests/src/behaviors/assisted_teleop/test_assisted_teleop_behavior_launch.py @@ -58,14 +58,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py b/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py index 291dbb4b836..eb5b5a07e76 100755 --- a/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py +++ b/nav2_system_tests/src/behaviors/backup/test_backup_behavior.launch.py @@ -58,14 +58,14 @@ def generate_launch_description() -> LaunchDescription: ), # Simulation for odometry AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py b/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py index 016d9ef163f..d635adf9539 100755 --- a/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py +++ b/nav2_system_tests/src/behaviors/drive_on_heading/test_drive_on_heading_behavior.launch.py @@ -58,14 +58,14 @@ def generate_launch_description() -> LaunchDescription: ), # Simulation for odometry AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py b/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py index cadef8c367a..5c48acad34f 100755 --- a/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py +++ b/nav2_system_tests/src/behaviors/spin/test_spin_behavior.launch.py @@ -58,14 +58,14 @@ def generate_launch_description() -> LaunchDescription: ), # Simulation for odometry AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py b/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py index 2efe32f7662..c2956735ae3 100755 --- a/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py +++ b/nav2_system_tests/src/behaviors/wait/test_wait_behavior_launch.py @@ -61,17 +61,17 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(ros_gz_sim_dir, 'launch', 'gz_sim.launch.py') ), - launch_arguments={'gz_args': ['-r -s ', world_sdf_xacro]}.items(), + launch_arguments={'ign_args': ['-r -s ', world_sdf_xacro]}.items(), ), IncludeLaunchDescription( PythonLaunchDescriptionSource( @@ -128,7 +128,7 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] ls = LaunchService(argv=argv) ls.include_launch_description(ld) return_code = lts.run(ls) - kill_os_processes('gz sim') + kill_os_processes('ign gazebo') return return_code diff --git a/nav2_system_tests/src/costmap_filters/test_keepout_launch.py b/nav2_system_tests/src/costmap_filters/test_keepout_launch.py index b9ccee55d04..cf2eedb5623 100755 --- a/nav2_system_tests/src/costmap_filters/test_keepout_launch.py +++ b/nav2_system_tests/src/costmap_filters/test_keepout_launch.py @@ -75,14 +75,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), # Launch gazebo server for simulation AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/costmap_filters/test_speed_launch.py b/nav2_system_tests/src/costmap_filters/test_speed_launch.py index 8746c7c7266..dae001a4603 100755 --- a/nav2_system_tests/src/costmap_filters/test_speed_launch.py +++ b/nav2_system_tests/src/costmap_filters/test_speed_launch.py @@ -73,14 +73,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), # Launch gazebo server for simulation AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/gps_navigation/test_case_py.launch.py b/nav2_system_tests/src/gps_navigation/test_case_py.launch.py index d071eba1a6e..4b2766d25f9 100755 --- a/nav2_system_tests/src/gps_navigation/test_case_py.launch.py +++ b/nav2_system_tests/src/gps_navigation/test_case_py.launch.py @@ -55,14 +55,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()), ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/localization/test_localization_launch.py b/nav2_system_tests/src/localization/test_localization_launch.py index c573f39dd56..aa33e3e37ed 100755 --- a/nav2_system_tests/src/localization/test_localization_launch.py +++ b/nav2_system_tests/src/localization/test_localization_launch.py @@ -41,15 +41,15 @@ def main(argv: list[str] = sys.argv[1:]): # type: ignore[no-untyped-def] map_yaml_file = os.path.join(nav2_bringup_dir, 'maps', 'tb3_sandbox.yaml') set_env_vars_resources = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ) set_env_vars_resources2 = AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ) start_gazebo_server = ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ) diff --git a/nav2_system_tests/src/route/test_route_launch.py b/nav2_system_tests/src/route/test_route_launch.py index 81848d5c6ce..752470fb815 100755 --- a/nav2_system_tests/src/route/test_route_launch.py +++ b/nav2_system_tests/src/route/test_route_launch.py @@ -83,14 +83,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/system/test_multi_robot_launch.py b/nav2_system_tests/src/system/test_multi_robot_launch.py index e39a6993f77..f3636eb4047 100755 --- a/nav2_system_tests/src/system/test_multi_robot_launch.py +++ b/nav2_system_tests/src/system/test_multi_robot_launch.py @@ -23,7 +23,7 @@ SetEnvironmentVariable) from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import TextSubstitution -from launch_ros.actions import Node, PushROSNamespace +from launch_ros.actions import Node, PushRosNamespace from launch_testing.legacy import LaunchTestService @@ -119,7 +119,7 @@ def generate_launch_description() -> LaunchDescription: group = GroupAction( [ # Instances use the robot's name for namespace - PushROSNamespace(robot['name']), + PushRosNamespace(robot['name']), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join(bringup_dir, 'launch', 'bringup_launch.py') diff --git a/nav2_system_tests/src/system/test_system_launch.py b/nav2_system_tests/src/system/test_system_launch.py index e93efc9a646..63dcbfedea7 100755 --- a/nav2_system_tests/src/system/test_system_launch.py +++ b/nav2_system_tests/src/system/test_system_launch.py @@ -85,14 +85,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/system/test_system_with_obstacle_launch.py b/nav2_system_tests/src/system/test_system_with_obstacle_launch.py index 8413da01458..41e5c66878d 100755 --- a/nav2_system_tests/src/system/test_system_with_obstacle_launch.py +++ b/nav2_system_tests/src/system/test_system_with_obstacle_launch.py @@ -85,14 +85,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( @@ -118,7 +118,7 @@ def generate_launch_description() -> LaunchDescription: '-entity', 'cardboard_box', '-file', cardbox_sdf, '-x', '-1.0', '-y', '0.6', '-z', '0.15', - '-R', '0.0', '-P', '0.0', '-Y', '0.0',] + '-R', '0.0', '-P', '0.0', '-Y', '0.0', ] ), Node( package='robot_state_publisher', diff --git a/nav2_system_tests/src/system/test_wrong_init_pose_launch.py b/nav2_system_tests/src/system/test_wrong_init_pose_launch.py index 81ae8bd483c..76859718b7a 100755 --- a/nav2_system_tests/src/system/test_wrong_init_pose_launch.py +++ b/nav2_system_tests/src/system/test_wrong_init_pose_launch.py @@ -85,14 +85,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/system_failure/test_system_failure_launch.py b/nav2_system_tests/src/system_failure/test_system_failure_launch.py index 8b8e2542c6d..46654ffac52 100755 --- a/nav2_system_tests/src/system_failure/test_system_failure_launch.py +++ b/nav2_system_tests/src/system_failure/test_system_failure_launch.py @@ -70,14 +70,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), # Launch gazebo server for simulation AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_system_tests/src/waypoint_follower/test_case_launch.py b/nav2_system_tests/src/waypoint_follower/test_case_launch.py index 0c92849d806..9e5c8ccd3e6 100755 --- a/nav2_system_tests/src/waypoint_follower/test_case_launch.py +++ b/nav2_system_tests/src/waypoint_follower/test_case_launch.py @@ -65,14 +65,14 @@ def generate_launch_description() -> LaunchDescription: SetEnvironmentVariable('RCUTILS_LOGGING_BUFFERED_STREAM', '1'), SetEnvironmentVariable('RCUTILS_LOGGING_USE_STDOUT', '1'), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', os.path.join(sim_dir, 'models') + 'IGN_GAZEBO_RESOURCE_PATH', os.path.join(sim_dir, 'models') ), AppendEnvironmentVariable( - 'GZ_SIM_RESOURCE_PATH', + 'IGN_GAZEBO_RESOURCE_PATH', str(Path(os.path.join(sim_dir)).parent.resolve()) ), ExecuteProcess( - cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro], + cmd=['ign', 'gazebo', '-r', '-s', world_sdf_xacro], output='screen', ), IncludeLaunchDescription( diff --git a/nav2_theta_star_planner/CMakeLists.txt b/nav2_theta_star_planner/CMakeLists.txt index de6778fe2ba..e91c76894d7 100644 --- a/nav2_theta_star_planner/CMakeLists.txt +++ b/nav2_theta_star_planner/CMakeLists.txt @@ -60,9 +60,7 @@ install(FILES theta_star_planner.xml ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) set(gtest_disable_pthreads OFF) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) diff --git a/nav2_util/CMakeLists.txt b/nav2_util/CMakeLists.txt index 275873fe906..b926872ffda 100644 --- a/nav2_util/CMakeLists.txt +++ b/nav2_util/CMakeLists.txt @@ -31,11 +31,7 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_pytest REQUIRED) - # skip copyright linting - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) add_subdirectory(test) diff --git a/nav2_util/include/nav2_util/copy_all_parameter_values.hpp b/nav2_util/include/nav2_util/copy_all_parameter_values.hpp new file mode 100644 index 00000000000..95070b1b472 --- /dev/null +++ b/nav2_util/include/nav2_util/copy_all_parameter_values.hpp @@ -0,0 +1,82 @@ +// Copyright 2023 Open Navigation LLC +// +// 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. + +#ifndef NAV2_UTIL__COPY_ALL_PARAMETER_VALUES_HPP_ +#define NAV2_UTIL__COPY_ALL_PARAMETER_VALUES_HPP_ + +#include +#include + +#include "rcl_interfaces/srv/list_parameters.hpp" +#include "rcl_interfaces/msg/parameter_descriptor.hpp" +#include "rcl_interfaces/msg/set_parameters_result.hpp" + +#include "rclcpp/parameter.hpp" +#include "rclcpp/logger.hpp" +#include "rclcpp/logging.hpp" + +namespace nav2_util +{ + +/** + * Copy all parameters from one source node to another destination node. + * May throw exceptions if parameters from source are uninitialized or undeclared. + * \param source Node to copy parameters from + * \param destination Node to copy parameters to + * \param override_existing_params Default false. Whether to override existing destination params + * if both the source and destination contain the same parameter. + */ +template +void +copy_all_parameter_values( + const NodeT1 & source, const NodeT2 & destination, const bool override_existing_params = false) +{ + using Parameters = std::vector; + using Descriptions = std::vector; + auto source_params = source->get_node_parameters_interface(); + auto dest_params = destination->get_node_parameters_interface(); + rclcpp::Logger logger = destination->get_node_logging_interface()->get_logger(); + + std::vector param_names = source_params->list_parameters({}, 0).names; + Parameters params = source_params->get_parameters(param_names); + Descriptions descriptions = source_params->describe_parameters(param_names); + + for (unsigned int idx = 0; idx != params.size(); idx++) { + if (!dest_params->has_parameter(params[idx].get_name())) { + dest_params->declare_parameter( + params[idx].get_name(), params[idx].get_parameter_value(), descriptions[idx]); + } else if (override_existing_params) { + try { + rcl_interfaces::msg::SetParametersResult result = + dest_params->set_parameters_atomically({params[idx]}); + if (!result.successful) { + // Parameter update rejected or read-only + RCLCPP_WARN( + logger, + "Unable to set parameter (%s): %s!", + params[idx].get_name().c_str(), result.reason.c_str()); + } + } catch (const rclcpp::exceptions::InvalidParameterTypeException & e) { + RCLCPP_WARN( + logger, + "Unable to set parameter (%s): incompatable parameter type (%s)!", + params[idx].get_name().c_str(), e.what()); + } + } + } +} + +} // namespace nav2_util + +#endif // NAV2_UTIL__COPY_ALL_PARAMETER_VALUES_HPP_ diff --git a/nav2_util/include/nav2_util/service_client.hpp b/nav2_util/include/nav2_util/service_client.hpp index 5d8ffcbe99b..3de1b309be2 100644 --- a/nav2_util/include/nav2_util/service_client.hpp +++ b/nav2_util/include/nav2_util/service_client.hpp @@ -53,22 +53,8 @@ class ServiceClient // When a nullptr is passed, the client will use the default callback group client_ = node_->template create_client( service_name, - rclcpp::SystemDefaultsQoS(), + rclcpp::SystemDefaultsQoS().get_rmw_qos_profile(), callback_group_); - rcl_service_introspection_state_t introspection_state = RCL_SERVICE_INTROSPECTION_OFF; - if (!node_->has_parameter("service_introspection_mode")) { - node_->declare_parameter("service_introspection_mode", "disabled"); - } - std::string service_introspection_mode = - node_->get_parameter("service_introspection_mode").as_string(); - if (service_introspection_mode == "metadata") { - introspection_state = RCL_SERVICE_INTROSPECTION_METADATA; - } else if (service_introspection_mode == "contents") { - introspection_state = RCL_SERVICE_INTROSPECTION_CONTENTS; - } - - this->client_->configure_introspection( - node_->get_clock(), rclcpp::SystemDefaultsQoS(), introspection_state); } using RequestType = typename ServiceT::Request; diff --git a/nav2_util/include/nav2_util/service_server.hpp b/nav2_util/include/nav2_util/service_server.hpp index acdc374a9ea..f4c8fa3814f 100644 --- a/nav2_util/include/nav2_util/service_server.hpp +++ b/nav2_util/include/nav2_util/service_server.hpp @@ -51,23 +51,8 @@ class ServiceServer const std::shared_ptr request, std::shared_ptr response) { this->callback_(request_header, request, response); }, - qos, + qos.get_rmw_qos_profile(), callback_group); - - rcl_service_introspection_state_t introspection_state = RCL_SERVICE_INTROSPECTION_OFF; - if(!node->has_parameter("service_introspection_mode")) { - node->declare_parameter("service_introspection_mode", "disabled"); - } - std::string service_introspection_mode = - node->get_parameter("service_introspection_mode").as_string(); - if (service_introspection_mode == "metadata") { - introspection_state = RCL_SERVICE_INTROSPECTION_METADATA; - } else if (service_introspection_mode == "contents") { - introspection_state = RCL_SERVICE_INTROSPECTION_CONTENTS; - } - - this->server_->configure_introspection( - node->get_clock(), rclcpp::SystemDefaultsQoS(), introspection_state); } protected: diff --git a/nav2_util/src/CMakeLists.txt b/nav2_util/src/CMakeLists.txt index 41261f512a5..9fe31972549 100644 --- a/nav2_util/src/CMakeLists.txt +++ b/nav2_util/src/CMakeLists.txt @@ -38,10 +38,10 @@ add_executable(lifecycle_bringup ) target_link_libraries(lifecycle_bringup PRIVATE ${library_name} rclcpp::rclcpp) -add_executable(base_footprint_publisher - base_footprint_publisher.cpp -) -target_link_libraries(base_footprint_publisher PRIVATE ${library_name} rclcpp::rclcpp ${tf2_msgs_TARGETS}) +# add_executable(base_footprint_publisher +# base_footprint_publisher.cpp +# ) +# target_link_libraries(base_footprint_publisher PRIVATE ${library_name} rclcpp::rclcpp ${tf2_msgs_TARGETS}) install(TARGETS ${library_name} diff --git a/nav2_util/test/CMakeLists.txt b/nav2_util/test/CMakeLists.txt index 9ba40dfe512..cb2f161a434 100644 --- a/nav2_util/test/CMakeLists.txt +++ b/nav2_util/test/CMakeLists.txt @@ -38,10 +38,10 @@ target_link_libraries(test_odometry_utils ${library_name} ${nav_msgs_TARGETS} ${ ament_add_gtest(test_robot_utils test_robot_utils.cpp) target_link_libraries(test_robot_utils ${library_name} ${geometry_msgs_TARGETS}) -ament_add_gtest(test_base_footprint_publisher test_base_footprint_publisher.cpp) -target_include_directories(test_base_footprint_publisher PRIVATE "$") +# ament_add_gtest(test_base_footprint_publisher test_base_footprint_publisher.cpp) +# target_include_directories(test_base_footprint_publisher PRIVATE "$") -target_link_libraries(test_base_footprint_publisher ${library_name} tf2_ros::tf2_ros rclcpp::rclcpp ${geometry_msgs_TARGETS}) +# target_link_libraries(test_base_footprint_publisher ${library_name} tf2_ros::tf2_ros rclcpp::rclcpp ${geometry_msgs_TARGETS}) ament_add_gtest(test_array_parser test_array_parser.cpp) target_link_libraries(test_array_parser ${library_name}) diff --git a/nav2_util/test/test_copy_all_parameter_values.cpp b/nav2_util/test/test_copy_all_parameter_values.cpp new file mode 100644 index 00000000000..da4f92af2b9 --- /dev/null +++ b/nav2_util/test/test_copy_all_parameter_values.cpp @@ -0,0 +1,88 @@ +// Copyright 2023 Open Navigation LLC +// +// 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. + +#include +#include "nav2_util/copy_all_parameter_values.hpp" +#include "rclcpp/rclcpp.hpp" + +class TestNode : public ::testing::Test +{ +protected: + static void SetUpTestCase() + { + rclcpp::init(0, nullptr); + } + + static void TearDownTestCase() + { + rclcpp::shutdown(); + } +}; + +TEST_F(TestNode, TestParamCopying) +{ + auto node1 = std::make_shared("test_node1"); + auto node2 = std::make_shared("test_node2"); + + // Tests for (1) multiple types, (2) recursion, (3) overriding values + node1->declare_parameter("Foo1", rclcpp::ParameterValue(std::string(("bar1")))); + node1->declare_parameter("Foo2", rclcpp::ParameterValue(0.123)); + node1->declare_parameter("Foo", rclcpp::ParameterValue(std::string(("bar")))); + node1->declare_parameter("Foo.bar", rclcpp::ParameterValue(std::string(("steve")))); + node2->declare_parameter("Foo", rclcpp::ParameterValue(std::string(("barz2")))); + + // Show Node2 is empty of Node1's parameters, but contains its own + EXPECT_FALSE(node2->has_parameter("Foo1")); + EXPECT_FALSE(node2->has_parameter("Foo2")); + EXPECT_FALSE(node2->has_parameter("Foo.bar")); + EXPECT_TRUE(node2->has_parameter("Foo")); + EXPECT_EQ(node2->get_parameter("Foo").as_string(), std::string("barz2")); + + bool override = false; + nav2_util::copy_all_parameter_values(node1, node2, override); + + // Test new parameters exist, of expected value, and original param is not overridden + EXPECT_TRUE(node2->has_parameter("Foo1")); + EXPECT_EQ(node2->get_parameter("Foo1").as_string(), std::string("bar1")); + EXPECT_TRUE(node2->has_parameter("Foo2")); + EXPECT_EQ(node2->get_parameter("Foo2").as_double(), 0.123); + EXPECT_TRUE(node2->has_parameter("Foo.bar")); + EXPECT_EQ(node2->get_parameter("Foo.bar").as_string(), std::string("steve")); + EXPECT_TRUE(node2->has_parameter("Foo")); + EXPECT_EQ(node2->get_parameter("Foo").as_string(), std::string("barz2")); + + // Test if parameter overrides are permissible that Node2's value is overridden + override = true; + nav2_util::copy_all_parameter_values(node1, node2, override); + EXPECT_EQ(node2->get_parameter("Foo").as_string(), std::string("bar")); +} + +TEST_F(TestNode, TestParamCopyingExceptions) +{ + auto node1 = std::make_shared("test_node1"); + auto node2 = std::make_shared("test_node2"); + + // Tests for Parameter value conflicts handled + node1->declare_parameter("Foo", rclcpp::ParameterValue(std::string(("bar")))); + node2->declare_parameter("Foo", rclcpp::ParameterValue(0.123)); + + bool override = true; + EXPECT_NO_THROW( + nav2_util::copy_all_parameter_values(node1, node2, override)); + + // Tests for Parameter read-only handled + node1->declare_parameter("Foo1", rclcpp::ParameterValue(std::string(("bar")))); + node2->declare_parameter("Foo1", rclcpp::ParameterValue(0.123)); + EXPECT_NO_THROW(nav2_util::copy_all_parameter_values(node1, node2, override)); +} diff --git a/nav2_velocity_smoother/CMakeLists.txt b/nav2_velocity_smoother/CMakeLists.txt index 7e1e3cb6b96..1433bc85205 100644 --- a/nav2_velocity_smoother/CMakeLists.txt +++ b/nav2_velocity_smoother/CMakeLists.txt @@ -57,10 +57,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) find_package(nav_msgs REQUIRED) diff --git a/nav2_voxel_grid/CMakeLists.txt b/nav2_voxel_grid/CMakeLists.txt index e204367ada8..f1b90ce1d0f 100644 --- a/nav2_voxel_grid/CMakeLists.txt +++ b/nav2_voxel_grid/CMakeLists.txt @@ -30,11 +30,6 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - # the following line skips the linter which checks for copyrights - set(ament_cmake_copyright_FOUND TRUE) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) ament_find_gtest() diff --git a/nav2_waypoint_follower/CMakeLists.txt b/nav2_waypoint_follower/CMakeLists.txt index 7dd40fdddd8..4d4531fb40d 100644 --- a/nav2_waypoint_follower/CMakeLists.txt +++ b/nav2_waypoint_follower/CMakeLists.txt @@ -145,9 +145,7 @@ install(DIRECTORY include/ ) if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) - ament_lint_auto_find_test_dependencies() ament_find_gtest() add_subdirectory(test) diff --git a/nav2_waypoint_follower/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp b/nav2_waypoint_follower/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp index 8b5b2aaf150..3966b91fc29 100644 --- a/nav2_waypoint_follower/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp +++ b/nav2_waypoint_follower/include/nav2_waypoint_follower/plugins/photo_at_waypoint.hpp @@ -26,7 +26,7 @@ #include "nav2_core/waypoint_task_executor.hpp" #include "opencv2/core.hpp" #include "opencv2/opencv.hpp" -#include "cv_bridge/cv_bridge.hpp" +#include "cv_bridge/cv_bridge.h" #include "image_transport/image_transport.hpp" diff --git a/tools/distro.Dockerfile b/tools/distro.Dockerfile index 255d8fecfdb..eff8a616c7c 100644 --- a/tools/distro.Dockerfile +++ b/tools/distro.Dockerfile @@ -6,14 +6,14 @@ # # Example build command: # export DOCKER_BUILDKIT=1 -# export FROM_IMAGE="ros:rolling" +# export FROM_IMAGE="ros:humble" # export OVERLAY_MIXINS="release ccache lld" -# docker build -t nav2:rolling \ +# docker build -t nav2:humble \ # --build-arg FROM_IMAGE \ # --build-arg OVERLAY_MIXINS \ # -f distro.Dockerfile ../ -ARG FROM_IMAGE=ros:rolling +ARG FROM_IMAGE=ros:humble ARG OVERLAY_WS=/opt/overlay_ws # multi-stage for caching diff --git a/tools/underlay.repos b/tools/underlay.repos index 2384238ee5b..0918320f01f 100644 --- a/tools/underlay.repos +++ b/tools/underlay.repos @@ -2,7 +2,7 @@ repositories: BehaviorTree/BehaviorTree.CPP: type: git url: https://github.com/BehaviorTree/BehaviorTree.CPP.git - version: 4.6.2 + version: 4.7.0 # ros/angles: # type: git # url: https://github.com/ros/angles.git @@ -31,11 +31,15 @@ repositories: # type: git # url: https://github.com/cra-ros-pkg/robot_localization.git # version: ros2 - # ros-navigation/nav2_minimal_turtlebot_simulation: - # type: git - # url: https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation.git - # version: 091b5ff12436890a54de6325df3573ae110e912b + ros-navigation/nav2_minimal_turtlebot_simulation: + type: git + url: https://github.com/ros-navigation/nav2_minimal_turtlebot_simulation.git + version: main ros/common_interfaces: type: git url: https://github.com/ros2/common_interfaces.git - version: rolling + version: humble + ros2/launch: + type: git + url: https://github.com/ros2/launch.git + version: humble