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

gradient_path: the gradx_ and grady_ can be negative, so we check the… #1207

Open
wants to merge 2 commits into
base: noetic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion global_planner/src/gradient_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ bool GradientPath::getPath(float* potential, double start_x, double start_y, dou
// calculate gradient at a cell
// positive value are to the right and down
float GradientPath::gradCell(float* potential, int n) {
if (gradx_[n] + grady_[n] > 0.0) // check this cell
if (fabs(gradx_[n]) + fabs(grady_[n]) > 0.0) // check this cell
return 1.0;

if (n < xs_ || n > xs_ * ys_ - xs_) // would be out of bounds
Expand Down
2 changes: 1 addition & 1 deletion navfn/src/navfn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ namespace navfn {
float
NavFn::gradCell(int n)
{
if (gradx[n]+grady[n] > 0.0) // check this cell
if (fabs(gradx[n])+fabs(grady[n]) > 0.0) // check this cell
return 1.0;

if (n < nx || n > ns-nx) // would be out of bounds
Expand Down