Skip to content

Commit

Permalink
code improvement minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedanomodolor committed Mar 25, 2024
1 parent 2830f54 commit 573250b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nav2_smac_planner/src/a_star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ bool AStarAlgorithm<NodeT>::areInputsValid()
// Check if ending point is valid
if (getToleranceHeuristic() < 0.001) {
// if any goal is valid, then all goals are valid
auto first_goal = *_goalsSet.begin(); // Get the first goal from _goalsSet
if (!first_goal->isNodeValid(_traverse_unknown, _collision_checker)) {
auto goal = *_goalsSet.begin();
if (!goal->isNodeValid(_traverse_unknown, _collision_checker)) {
throw nav2_core::GoalOccupied("Goal was in lethal cost");
}
}
Expand Down Expand Up @@ -386,6 +386,7 @@ bool AStarAlgorithm<NodeT>::createPath(
current_node->visited();

// 2.1) Use an analytic expansion (if available) to generate a path
expansion_result = nullptr;
expansion_result = _expander->tryAnalyticExpansion(
current_node, getGoals(),
getInitialGoalCoordinate(), neighborGetter, analytic_iterations, closest_distance);
Expand Down Expand Up @@ -477,7 +478,7 @@ float AStarAlgorithm<NodeT>::getHeuristicCost(const NodePtr & node)
NodeT::getCoords(node->getIndex(), getSizeX(), getSizeDim3());
// Heurittic cost for more than one goal is already cotemplated in the
// precomputation stage
float heuristic = NodeT::getHeuristicCost(node_coords, _goals_coordinates[0]);
float heuristic = NodeT::getHeuristicCost(node_coords, getInitialGoalCoordinate());
if (heuristic < _best_heuristic_node.first) {
_best_heuristic_node = {heuristic, node->getIndex()};
}
Expand Down

0 comments on commit 573250b

Please sign in to comment.