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

commenting out unused validPointPotential #1854

Merged
merged 2 commits into from
Jul 7, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class NavfnPlanner : public nav2_core::GlobalPlanner
// Check for a valid potential value at a given point in the world
// - must call computePotential first
// - currently unused
bool validPointPotential(const geometry_msgs::msg::Point & world_point);
bool validPointPotential(const geometry_msgs::msg::Point & world_point, double tolerance);
// bool validPointPotential(const geometry_msgs::msg::Point & world_point);
// bool validPointPotential(const geometry_msgs::msg::Point & world_point, double tolerance);

// Compute the squared distance between two points
inline double squared_distance(
Expand Down
72 changes: 36 additions & 36 deletions nav2_navfn_planner/src/navfn_planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,42 +357,42 @@ NavfnPlanner::getPointPotential(const geometry_msgs::msg::Point & world_point)
return planner_->potarr[index];
}

bool
NavfnPlanner::validPointPotential(const geometry_msgs::msg::Point & world_point)
{
return validPointPotential(world_point, tolerance_);
}

bool
NavfnPlanner::validPointPotential(
const geometry_msgs::msg::Point & world_point, double tolerance)
{
const double resolution = costmap_->getResolution();

geometry_msgs::msg::Point p = world_point;
double potential = getPointPotential(p);
if (potential < POT_HIGH) {
// world_point is reachable by itself
return true;
} else {
// world_point, is not reachable. Trying to find any
// reachable point within its tolerance region
p.y = world_point.y - tolerance;
while (p.y <= world_point.y + tolerance) {
p.x = world_point.x - tolerance;
while (p.x <= world_point.x + tolerance) {
potential = getPointPotential(p);
if (potential < POT_HIGH) {
return true;
}
p.x += resolution;
}
p.y += resolution;
}
}

return false;
}
// bool
// NavfnPlanner::validPointPotential(const geometry_msgs::msg::Point & world_point)
// {
// return validPointPotential(world_point, tolerance_);
// }

// bool
// NavfnPlanner::validPointPotential(
// const geometry_msgs::msg::Point & world_point, double tolerance)
// {
// const double resolution = costmap_->getResolution();

// geometry_msgs::msg::Point p = world_point;
// double potential = getPointPotential(p);
// if (potential < POT_HIGH) {
// // world_point is reachable by itself
// return true;
// } else {
// // world_point, is not reachable. Trying to find any
// // reachable point within its tolerance region
// p.y = world_point.y - tolerance;
// while (p.y <= world_point.y + tolerance) {
// p.x = world_point.x - tolerance;
// while (p.x <= world_point.x + tolerance) {
// potential = getPointPotential(p);
// if (potential < POT_HIGH) {
// return true;
// }
// p.x += resolution;
// }
// p.y += resolution;
// }
// }

// return false;
// }

bool
NavfnPlanner::worldToMap(double wx, double wy, unsigned int & mx, unsigned int & my)
Expand Down