Skip to content

Commit

Permalink
adding tolerance back in for smac lattice and hybrid-A* planners (ros…
Browse files Browse the repository at this point in the history
…-navigation#3734)

Signed-off-by: enricosutera <enricosutera@outlook.com>
  • Loading branch information
SteveMacenski authored and enricosutera committed May 19, 2024
1 parent e4423a9 commit cf96dbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion nav2_smac_planner/src/smac_planner_hybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ nav_msgs::msg::Path SmacPlannerHybrid::createPlan(
expansions = std::make_unique<std::vector<std::tuple<float, float>>>();
}
// Note: All exceptions thrown are handled by the planner server and returned to the action
if (!_a_star->createPath(path, num_iterations, 0, expansions.get())) {
if (!_a_star->createPath(
path, num_iterations,
_tolerance / static_cast<float>(costmap->getResolution()), expansions.get()))
{
if (num_iterations < _a_star->getMaxIterations()) {
throw nav2_core::NoValidPathCouldBeFound("no valid path found");
} else {
Expand Down
4 changes: 3 additions & 1 deletion nav2_smac_planner/src/smac_planner_lattice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ nav_msgs::msg::Path SmacPlannerLattice::createPlan(
std::string error;

// Note: All exceptions thrown are handled by the planner server and returned to the action
if (!_a_star->createPath(path, num_iterations, 0 /*no tolerance*/)) {
if (!_a_star->createPath(
path, num_iterations, _tolerance / static_cast<float>(_costmap->getResolution())))
{
if (num_iterations < _a_star->getMaxIterations()) {
throw nav2_core::NoValidPathCouldBeFound("no valid path found");
} else {
Expand Down

0 comments on commit cf96dbb

Please sign in to comment.