-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.cpp
More file actions
executable file
·58 lines (48 loc) · 1.36 KB
/
node.cpp
File metadata and controls
executable file
·58 lines (48 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "node.h"
#include <cmath>
#include <iostream>
#include <sstream>
std::string Node::print() {
stringstream sstm;
sstm << this->t << ',' << this->x << ',' << this->v << ',' << this->theta << ',' << this->w << ',' << this->u << ',' << this->cost << endl;
return sstm.str();
}
void Node::print_node(){
cout << this->t << '\t' << '\t' << "x:" << this->x << '\t' << '\t' << "v:" << this->v << '\t' << '\t' << "th:" << this->theta << '\t' << '\t' << "w:" << this->w << '\t' << '\t' << "cost:" << this->cost << endl;
}
void Node::add_child(Node* n){
this->children.push_back(n);
}
Node::Node() {
this->parent = NULL;
}
Node::Node(Node* n) {
this->t = n->t;
this->x = n->x;
this->v = n->v;
this->theta = n->theta;
this->w = n->w;
this->u = n->u;
this->cost = n->cost;
this->parent = n->parent;
this->times = n->times;
this->trajectory = n->trajectory;
//subnodes = n->subnodes;
}
Node::Node(double t, double x, double v, double theta, double w, double u, double cost, Node* parent, vector<double> times, vector<state_type> trajectory) {
this->t = t;
this->x = x;
this->v = v;
this->theta = theta;
this->w = w;
this->u = u;
this->cost = cost;
this->parent = parent;
this->times = times;
this->trajectory = trajectory;
}
Node::~Node() {
for (int i = 0; i < subnodes.size(); i++) {
delete subnodes[i];
}
}