Skip to content

Commit

Permalink
clear start cell for planning (ros-navigation#3980)
Browse files Browse the repository at this point in the history
* clear start cell for planning

* clean up

* add headers

* added comment

* start blocked

* code review

* code review
  • Loading branch information
jwallace42 authored and Marc-Morcos committed Jul 4, 2024
1 parent cb9d126 commit a509143
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nav2_smac_planner/src/a_star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,20 @@ unsigned int & AStarAlgorithm<NodeT>::getSizeDim3()
return _dim3_size;
}

template<>
void AStarAlgorithm<Node2D>::clearStart()
{
auto coords = Node2D::getCoords(_start->getIndex());
_costmap->setCost(coords.x, coords.y, nav2_costmap_2d::FREE_SPACE);
}

template<typename NodeT>
void AStarAlgorithm<NodeT>::clearStart()
{
auto coords = NodeT::getCoords(_start->getIndex(), _costmap->getSizeInCellsX(), getSizeDim3());
_costmap->setCost(coords.x, coords.y, nav2_costmap_2d::FREE_SPACE);
}

// Instantiate algorithm for the supported template types
template class AStarAlgorithm<Node2D>;
template class AStarAlgorithm<NodeHybrid>;
Expand Down

0 comments on commit a509143

Please sign in to comment.