19 #include <unordered_map>
22 #include <geometry_msgs/msg/pose_stamped.hpp>
24 #ifndef NAV2_ROUTE__TYPES_HPP_
25 #define NAV2_ROUTE__TYPES_HPP_
40 T getValue(
const std::string & key, T & default_val)
const
42 auto it = data.find(key);
43 if (it == data.end()) {
46 return std::any_cast<T>(it->second);
51 void setValue(
const std::string & key, T & value)
56 std::unordered_map<std::string, std::any> data;
61 typedef std::vector<Node> NodeVector;
62 typedef NodeVector Graph;
63 typedef std::unordered_map<unsigned int, unsigned int> GraphToIDMap;
64 typedef std::unordered_map<unsigned int, std::vector<unsigned int>> GraphToIncomingEdgesMap;
65 typedef std::vector<NodePtr> NodePtrVector;
66 typedef std::pair<float, NodePtr> NodeElement;
67 typedef std::pair<unsigned int, unsigned int> NodeExtents;
75 bool operator()(
const NodeElement & a,
const NodeElement & b)
const
77 return a.first > b.first;
81 typedef std::priority_queue<NodeElement, std::vector<NodeElement>,
NodeComparator> NodeQueue;
90 bool overridable{
true};
97 enum class OperationTrigger
111 OperationTrigger trigger;
115 typedef std::vector<Operation> Operations;
116 typedef std::vector<Operation *> OperationPtrs;
124 std::vector<std::string> operations_triggered;
126 std::vector<unsigned int> blocked_ids;
140 Operations operations;
142 float getEdgeLength();
146 typedef std::vector<DirectionalEdge> EdgeVector;
147 typedef std::vector<EdgePtr> EdgePtrVector;
157 float integrated_cost{std::numeric_limits<float>::max()};
158 float traversal_cost{std::numeric_limits<float>::max()};
162 integrated_cost = std::numeric_limits<float>::max();
163 traversal_cost = std::numeric_limits<float>::max();
164 parent_edge =
nullptr;
174 std::string frame_id{
"map"};
175 float x{0.0}, y{0.0};
186 EdgeVector neighbors;
188 Operations operations;
193 Operations operations_data = {})
195 neighbors.push_back({edgeid,
this, node, cost, meta_data, operations_data});
199 inline float DirectionalEdge::getEdgeLength()
202 end->coords.x - start->coords.x,
203 end->coords.y - start->coords.y);
214 float route_cost{0.0};
225 unsigned int start_nodeid;
226 unsigned int goal_nodeid;
227 geometry_msgs::msg::PoseStamped start_pose;
228 geometry_msgs::msg::PoseStamped goal_pose;
236 enum class TrackerResult
249 NodePtr last_node{
nullptr}, next_node{
nullptr};
251 int route_edges_idx{-1};
252 bool within_radius{
false};
267 std::vector<unsigned int> blocked_ids;
271 bool first_time{
true};
286 unsigned int rerouting_start_id{std::numeric_limits<unsigned int>::max()};
287 geometry_msgs::msg::PoseStamped rerouting_start_pose;
291 rerouting_start_id = std::numeric_limits<unsigned int>::max();
296 rerouting_start_pose = geometry_msgs::msg::PoseStamped();
An object to store Node coordinates in different frames.
An object representing edges between nodes.
An object to store edge cost or cost metadata for scoring.
Node comparison for priority queue sorting.
An object to store the nodes in the graph file.
An object to store operations to perform on events with types and metadata.
Result information from the operations manager.
State shared to objects to communicate important rerouting data to avoid rerouting over blocked edges...
An object to store salient features of the route request including its start and goal node ids,...
Current state management of route tracking class.
An ordered set of nodes and edges corresponding to the planned route.
An object to store state related to graph searching of nodes This is an internal class users should n...