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

[NavFn] Make the 3 parameters changeable at runtime #2181

Merged
merged 5 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class NavfnPlanner : public nav2_core::GlobalPlanner

// Whether to use the astar planner or default dijkstras
bool use_astar_;

rclcpp_lifecycle::LifecycleNode::WeakPtr node_;
};

} // namespace nav2_navfn_planner
Expand Down
9 changes: 8 additions & 1 deletion nav2_navfn_planner/src/navfn_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ NavfnPlanner::configure(
costmap_ = costmap_ros->getCostmap();
global_frame_ = costmap_ros->getGlobalFrameID();

auto node = parent.lock();
node_ = parent;
auto node = node_.lock();
clock_ = node->get_clock();
logger_ = node->get_logger();

Expand Down Expand Up @@ -123,6 +124,12 @@ nav_msgs::msg::Path NavfnPlanner::createPlan(
steady_clock::time_point a = steady_clock::now();
#endif

// Refresh parameter
doisyg marked this conversation as resolved.
Show resolved Hide resolved
auto node = node_.lock();
node->get_parameter(name_ + ".tolerance", tolerance_);
node->get_parameter(name_ + ".use_astar", use_astar_);
node->get_parameter(name_ + ".allow_unknown", allow_unknown_);

// Update planner based on the new costmap size
if (isPlannerOutOfDate()) {
planner_->setNavArr(
Expand Down