15 #ifndef NAV2_SMAC_PLANNER__NODE_BASIC_HPP_
16 #define NAV2_SMAC_PLANNER__NODE_BASIC_HPP_
18 #include <type_traits>
20 #include "nav2_smac_planner/constants.hpp"
21 #include "nav2_smac_planner/node_hybrid.hpp"
22 #include "nav2_smac_planner/node_lattice.hpp"
23 #include "nav2_smac_planner/node_2d.hpp"
24 #include "nav2_smac_planner/types.hpp"
25 #include "nav2_smac_planner/collision_checker.hpp"
27 namespace nav2_smac_planner
34 template<
typename NodeT>
43 : graph_node_ptr(nullptr),
55 if constexpr (std::is_base_of_v<NodeLattice, NodeT>) {
57 this->pose = node->pose;
58 this->graph_node_ptr = node;
59 this->prim_ptr = node->getMotionPrimitive();
60 this->backward = node->isBackward();
61 }
else if constexpr (std::is_base_of_v<NodeHybrid, NodeT>) {
63 this->pose = node->pose;
64 this->graph_node_ptr = node;
65 this->motion_index = node->getMotionPrimitiveIndex();
66 this->turn_dir = node->getTurnDirection();
67 }
else if constexpr (std::is_base_of_v<Node2D, NodeT>) {
69 this->graph_node_ptr = node;
72 this->graph_node_ptr = node;
84 if constexpr (std::is_base_of_v<NodeLattice, NodeT>) {
89 if (!this->graph_node_ptr->wasVisited()) {
90 this->graph_node_ptr->pose = this->pose;
91 this->graph_node_ptr->setMotionPrimitive(this->prim_ptr);
92 this->graph_node_ptr->backwards(this->backward);
94 }
else if constexpr (std::is_base_of_v<NodeHybrid, NodeT>) {
99 if (!this->graph_node_ptr->wasVisited()) {
100 this->graph_node_ptr->pose = this->pose;
101 this->graph_node_ptr->setMotionPrimitiveIndex(this->motion_index, this->turn_dir);
103 }
else if constexpr (std::is_base_of_v<Node2D, NodeT>) {
110 typename NodeT::Coordinates pose;
111 NodeT * graph_node_ptr;
114 unsigned int motion_index;
116 TurnDirection turn_dir;
NodeBasic implementation for priority queue insertion.
NodeBasic(const uint64_t new_index)
A constructor for nav2_smac_planner::NodeBasic.
void populateSearchNode(NodeT *&node)
Take a NodeBasic and populate it with any necessary state cached in the queue for NodeT.
void processSearchNode()
Take a NodeBasic and populate it with any necessary state cached in the queue for NodeTs.
A struct of all motion primitive data.