Skip to content

Commit

Permalink
Update nav2_navfn_planner/src/navfn_planner.cpp
Browse files Browse the repository at this point in the history
check and resize planner costmap array

clean up
  • Loading branch information
bpwilcox committed Jun 3, 2019
1 parent 12cf2d5 commit 1bf6593
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion nav2_navfn_planner/src/navfn_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,19 @@ NavfnPlanner::computePathToPose(const std::shared_ptr<GoalHandle> goal_handle)
// TODO(mjeronimo): handle or reject an attempted pre-emption

try {
// Get the current pose from the robot
// Get the current costmap
getCostmap(costmap_);
RCLCPP_DEBUG(get_logger(), "Costmap size: %d,%d",
costmap_.metadata.size_x, costmap_.metadata.size_y);

// Update planner based on the new costmap size
if (isPlannerOutOfDate()) {
current_costmap_size_[0] = costmap_.metadata.size_x;
current_costmap_size_[1] = costmap_.metadata.size_y;
planner_->setNavArr(costmap_.metadata.size_x, costmap_.metadata.size_y);
}

// Get the current pose from the robot
auto start = std::make_shared<geometry_msgs::msg::PoseWithCovarianceStamped>();

if (!robot_->getCurrentPose(start)) {
Expand Down

0 comments on commit 1bf6593

Please sign in to comment.