From b945e28b300d2a0d7d62751c53f222fabb00e645 Mon Sep 17 00:00:00 2001 From: Pradheep-office Date: Fri, 5 Nov 2021 14:45:52 +0100 Subject: [PATCH 1/2] removing the has_parameter() and replacing with the get_parameter() --- .../src/navigators/navigate_to_pose.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/nav2_bt_navigator/src/navigators/navigate_to_pose.cpp b/nav2_bt_navigator/src/navigators/navigate_to_pose.cpp index 250aa45a14..de0422e103 100644 --- a/nav2_bt_navigator/src/navigators/navigate_to_pose.cpp +++ b/nav2_bt_navigator/src/navigators/navigate_to_pose.cpp @@ -53,13 +53,12 @@ NavigateToPoseNavigator::getDefaultBTFilepath( { std::string default_bt_xml_filename; auto node = parent_node.lock(); - if (!node->has_parameter("default_nav_to_pose_bt_xml")) { - std::string pkg_share_dir = - ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); - std::string tree_file = pkg_share_dir + - "/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml"; - node->declare_parameter("default_nav_to_pose_bt_xml", tree_file); - } + std::string pkg_share_dir = + ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + node->declare_parameter( + "default_nav_to_pose_bt_xml", + pkg_share_dir + + "/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml"); node->get_parameter("default_nav_to_pose_bt_xml", default_bt_xml_filename); return default_bt_xml_filename; From 07740c990ee15254e82399842d8187ac962d6389 Mon Sep 17 00:00:00 2001 From: Pradheep-office Date: Fri, 5 Nov 2021 15:12:40 +0100 Subject: [PATCH 2/2] fixing navigate_through_poses as well --- .../src/navigators/navigate_through_poses.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/nav2_bt_navigator/src/navigators/navigate_through_poses.cpp b/nav2_bt_navigator/src/navigators/navigate_through_poses.cpp index da724884ec..20e7d1b139 100644 --- a/nav2_bt_navigator/src/navigators/navigate_through_poses.cpp +++ b/nav2_bt_navigator/src/navigators/navigate_through_poses.cpp @@ -47,13 +47,12 @@ NavigateThroughPosesNavigator::getDefaultBTFilepath( { std::string default_bt_xml_filename; auto node = parent_node.lock(); - if (!node->has_parameter("default_nav_through_poses_bt_xml")) { - std::string pkg_share_dir = - ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); - std::string tree_file = pkg_share_dir + - "/behavior_trees/navigate_through_poses_w_replanning_and_recovery.xml"; - node->declare_parameter("default_nav_through_poses_bt_xml", tree_file); - } + std::string pkg_share_dir = + ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + node->declare_parameter( + "default_nav_through_poses_bt_xml", + pkg_share_dir + + "/behavior_trees/navigate_through_poses_w_replanning_and_recovery.xml"); node->get_parameter("default_nav_through_poses_bt_xml", default_bt_xml_filename); return default_bt_xml_filename;