Skip to content

Commit bdb53bd

Browse files
Yancey2023masf7g
authored andcommitted
navfn : fix performance issue (ros-navigation#4945)
Signed-off-by: Yancey <[email protected]>
1 parent d2225c7 commit bdb53bd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

nav2_navfn_planner/src/navfn_planner.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,13 @@ NavfnPlanner::makePlan(
293293
p.position.x = goal.position.x - tolerance;
294294
while (p.position.x <= goal.position.x + tolerance) {
295295
potential = getPointPotential(p.position);
296-
double sdist = squared_distance(p, goal);
297-
if (potential < POT_HIGH && sdist < best_sdist) {
298-
best_sdist = sdist;
299-
best_pose = p;
300-
found_legal = true;
296+
if (potential < POT_HIGH) {
297+
double sdist = squared_distance(p, goal);
298+
if (sdist < best_sdist) {
299+
best_sdist = sdist;
300+
best_pose = p;
301+
found_legal = true;
302+
}
301303
}
302304
p.position.x += resolution;
303305
}

0 commit comments

Comments
 (0)