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; 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;