-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrrtstar.h
49 lines (44 loc) · 1.1 KB
/
rrtstar.h
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
#ifndef RRTSTAR_H
#define RRTSTAR_H
#include "obstacles.h"
#include "dubins.h"
#include <stdlib.h>
#include <vector>
#include <math.h>
using namespace std;
using namespace Eigen;
struct Node {
vector<Node *> children;
Node *parent;
Vector2f position;
float orientation;
double cost;
DubinsPath path;
};
class RRTSTAR
{
public:
RRTSTAR();
void initialize();
Node* getRandomNode();
Node* nearest(Vector2f point);
void near(Vector2f point, float radius, vector<Node *>& out_nodes);
double distance(Vector2f &p, Vector2f &q);
double Cost(Node *q);
double PathCost(Node *qFrom, Node *qTo);
Vector3f newConfig(Node *q, Node *qNearest);
Vector3f newDubinConfig(Node *q, Node *qNearest, DubinsPath &path);
void add(Node *qNearest, Node *qNew);
bool reached();
void setStepSize(int step);
void setMaxIterations(int iter);
void deleteNodes(Node *root);
Obstacles *obstacles;
vector<Node *> nodes;
vector<Node *> path;
Node *root, *lastNode;
Vector2f startPos, endPos;
int max_iter;
int step_size;
};
#endif // RRTSTAR_H