Skip to content

Commit

Permalink
[Smac] Robin hood data structure improves performance by 10-15%! (ros…
Browse files Browse the repository at this point in the history
…-navigation#3201)

* adding robin_hood unordered_map

* using robin_hood node map

* ignore robin_hood file

* linting

* linting cont. for triple pointers

* linting cont. for uncrustify
  • Loading branch information
SteveMacenski authored and Joshua Wallace committed Dec 14, 2022
1 parent 278f896 commit 5ae4b73
Show file tree
Hide file tree
Showing 5 changed files with 2,544 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _getPathImpl(self, start, goal, planner_id='', use_start=False):

def getPath(self, start, goal, planner_id='', use_start=False):
"""Send a `ComputePathToPose` action request."""
rtn = _getPathImpl(start, goal, planner_id='', use_start=False)
rtn = self._getPathImpl(start, goal, planner_id='', use_start=False)
if not rtn:
return None
else:
Expand Down
1 change: 1 addition & 0 deletions nav2_smac_planner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ install(DIRECTORY lattice_primitives/sample_primitives DESTINATION share/${PROJE

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
set(AMENT_LINT_AUTO_FILE_EXCLUDE include/nav2_smac_planner/thirdparty/robin_hood.h)
ament_lint_auto_find_test_dependencies()
find_package(ament_cmake_gtest REQUIRED)
add_subdirectory(test)
Expand Down
3 changes: 2 additions & 1 deletion nav2_smac_planner/include/nav2_smac_planner/a_star.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "nav2_costmap_2d/costmap_2d.hpp"

#include "nav2_smac_planner/thirdparty/robin_hood.h"
#include "nav2_smac_planner/analytic_expansion.hpp"
#include "nav2_smac_planner/node_2d.hpp"
#include "nav2_smac_planner/node_hybrid.hpp"
Expand All @@ -46,7 +47,7 @@ class AStarAlgorithm
{
public:
typedef NodeT * NodePtr;
typedef std::unordered_map<unsigned int, NodeT> Graph;
typedef robin_hood::unordered_node_map<unsigned int, NodeT> Graph;
typedef std::vector<NodePtr> NodeVector;
typedef std::pair<float, NodeBasic<NodeT>> NodeElement;
typedef typename NodeT::Coordinates Coordinates;
Expand Down
Loading

0 comments on commit 5ae4b73

Please sign in to comment.