Skip to content

Commit

Permalink
precomputeDistanceHeuristic is now computed once (#4451)
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Belpois <[email protected]>
Co-authored-by: SiddharthaUpase <[email protected]>
  • Loading branch information
2 people authored and SteveMacenski committed Aug 23, 2024
1 parent b3fce7b commit 7309106
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions nav2_smac_planner/include/nav2_smac_planner/a_star.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class AStarAlgorithm
int _timing_interval = 5000;

bool _traverse_unknown;
bool _is_initialized;
int _max_iterations;
int _max_on_approach_iterations;
double _max_planning_time;
Expand Down
6 changes: 5 additions & 1 deletion nav2_smac_planner/src/a_star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ AStarAlgorithm<NodeT>::AStarAlgorithm(
const MotionModel & motion_model,
const SearchInfo & search_info)
: _traverse_unknown(true),
_is_initialized(false),
_max_iterations(0),
_max_planning_time(0),
_x_size(0),
Expand Down Expand Up @@ -67,7 +68,10 @@ void AStarAlgorithm<NodeT>::initialize(
_max_iterations = max_iterations;
_max_on_approach_iterations = max_on_approach_iterations;
_max_planning_time = max_planning_time;
NodeT::precomputeDistanceHeuristic(lookup_table_size, _motion_model, dim_3_size, _search_info);
if(!_is_initialized) {
NodeT::precomputeDistanceHeuristic(lookup_table_size, _motion_model, dim_3_size, _search_info);
}
_is_initialized = true;
_dim3_size = dim_3_size;
_expander = std::make_unique<AnalyticExpansion<NodeT>>(
_motion_model, _search_info, _traverse_unknown, _dim3_size);
Expand Down

0 comments on commit 7309106

Please sign in to comment.