Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: set the BT Navigator "default_nav_to_pose_bt_xml" and "default_nav_through_pose_bt_xml" from the yaml file #2664

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions nav2_bt_navigator/src/navigators/navigate_through_poses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>(
"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;
Expand Down
13 changes: 6 additions & 7 deletions nav2_bt_navigator/src/navigators/navigate_to_pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>(
"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;
Expand Down