Buran Motion Planning Framework
path_node.h
1 #pragma once
2 
3 #include <memory>
4 #include <utility>
5 #include <vector>
6 
7 namespace bmpf {
11  struct PathNode {
18  PathNode(std::vector<int> coords, const std::shared_ptr<PathNode> &parent, double sum)
19  : coords(std::move(coords)), parent(parent), sum(sum) {
20 
21  if (!parent)
22  order = 0;
23  else
24  order = parent->order + 1;
25  }
26 
31  std::string toString() const {
32  std::string result = "{";
33  char buf[256];
34  sprintf(buf, "sum:%.3f", sum);
35  result += buf;
36  return result + "}";
37  }
38 
42  std::vector<int> coords;
46  std::shared_ptr<PathNode> parent;
50  double sum;
54  unsigned int order;
55  };
56 
60  struct PathNodePtr {
65  explicit PathNodePtr(std::shared_ptr<PathNode> ptr) : ptr(std::move(ptr)) {}
66 
67  std::shared_ptr<PathNode> ptr;
68 
69  bool operator<(const PathNodePtr &obj) const {
70  return (this->ptr->sum < obj.ptr->sum);
71  }
72  };
73 }
bmpf::PathNode::sum
double sum
Definition: path_node.h:50
bmpf::PathNode::order
unsigned int order
Definition: path_node.h:54
bmpf::PathNodePtr
Definition: path_node.h:60
bmpf::PathNodePtr::PathNodePtr
PathNodePtr(std::shared_ptr< PathNode > ptr)
Definition: path_node.h:65
bmpf::PathNode::coords
std::vector< int > coords
Definition: path_node.h:42
bmpf::PathNode::parent
std::shared_ptr< PathNode > parent
Definition: path_node.h:46
bmpf::PathNode::PathNode
PathNode(std::vector< int > coords, const std::shared_ptr< PathNode > &parent, double sum)
Definition: path_node.h:18
bmpf::PathNode
Definition: path_node.h:11
bmpf::PathNode::toString
std::string toString() const
Definition: path_node.h:31