15 #ifndef NAV2_SMAC_PLANNER__ANALYTIC_EXPANSION_HPP_
16 #define NAV2_SMAC_PLANNER__ANALYTIC_EXPANSION_HPP_
18 #include <ompl/base/ScopedState.h>
19 #include <ompl/base/spaces/DubinsStateSpace.h>
20 #include <ompl/base/spaces/ReedsSheppStateSpace.h>
21 #include <ompl/config.h>
29 #include "nav2_smac_planner/node_2d.hpp"
30 #include "nav2_smac_planner/node_hybrid.hpp"
31 #include "nav2_smac_planner/node_lattice.hpp"
32 #include "nav2_smac_planner/types.hpp"
33 #include "nav2_smac_planner/constants.hpp"
35 namespace nav2_smac_planner
38 template<
typename NodeT>
42 typedef NodeT * NodePtr;
43 typedef std::vector<NodePtr> NodeVector;
44 typedef typename NodeT::Coordinates Coordinates;
45 typedef std::function<bool (
const uint64_t &, NodeT * &)> NodeGetter;
46 typedef typename NodeT::CoordinateVector CoordinateVector;
47 using NodeContext =
typename NodeT::NodeContext;
57 Coordinates & initial_coords_in,
58 Coordinates & proposed_coords_in)
60 initial_coords(initial_coords_in),
61 proposed_coords(proposed_coords_in)
66 Coordinates initial_coords;
67 Coordinates proposed_coords;
83 Coordinates & initial_coords,
84 Coordinates & proposed_coords)
86 nodes.emplace_back(node, initial_coords, proposed_coords);
89 void setDirectionChanges(
int changes)
91 direction_changes = changes;
94 std::vector<AnalyticExpansionNode> nodes;
95 int direction_changes{0};
102 const MotionModel & motion_model,
104 const bool & traverse_unknown,
105 const unsigned int & dim_3_size);
132 const NodePtr & current_node,
133 const NodeVector & coarse_check_goals,
134 const NodeVector & fine_check_goals,
135 const CoordinateVector & goals_coords,
136 const NodeGetter & getter,
int & iterations,
137 int & closest_distance);
148 const NodePtr & node,
const NodePtr & goal,
149 const NodeGetter & getter,
const ompl::base::StateSpacePtr & state_space);
162 const NodePtr & goal_node,
163 const NodeGetter & getter,
174 const NodePtr & node,
const NodePtr & goal,
182 #if OMPL_VERSION_VALUE >= 2000000
196 MotionModel _motion_model;
198 bool _traverse_unknown;
199 unsigned int _dim_3_size;
201 std::list<std::unique_ptr<NodeT>> _detached_nodes;
202 NodeContext * _ctx =
nullptr;
207 #include "nav2_smac_planner/analytic_expansion_impl.hpp"
AnalyticExpansionNodes getAnalyticPath(const NodePtr &node, const NodePtr &goal, const NodeGetter &getter, const ompl::base::StateSpacePtr &state_space)
Perform an analytic path expansion to the goal.
NodePtr tryAnalyticExpansion(const NodePtr ¤t_node, const NodeVector &coarse_check_goals, const NodeVector &fine_check_goals, const CoordinateVector &goals_coords, const NodeGetter &getter, int &iterations, int &closest_distance)
Attempt an analytic path completion.
int countDirectionChanges(const ompl::base::ReedsSheppStateSpace::ReedsSheppPath &path)
Counts the number of direction changes in a Reeds-Shepp path.
void cleanNode(const NodePtr &nodes)
Takes an expanded nodes to clean up, if necessary, of any state information that may be polluting it ...
void setCollisionChecker(GridCollisionChecker *collision_checker)
Sets the collision checker and costmap to use in expansion validation.
AnalyticExpansion(const MotionModel &motion_model, const SearchInfo &search_info, const bool &traverse_unknown, const unsigned int &dim_3_size)
Constructor for analytic expansion object.
float refineAnalyticPath(NodePtr &node, const NodePtr &goal_node, const NodeGetter &getter, AnalyticExpansionNodes &analytic_nodes)
Refined analytic path from the current node to the goal.
void setContext(NodeContext *ctx)
Sets the shared context to use.
NodePtr setAnalyticPath(const NodePtr &node, const NodePtr &goal, const AnalyticExpansionNodes &expanded_nodes)
Takes final analytic expansion and appends to current expanded node.
A costmap grid collision checker.
Analytic expansion nodes and associated metadata.
Search properties and penalties.