-
Notifications
You must be signed in to change notification settings - Fork 40
/
rrt.h
41 lines (36 loc) · 808 Bytes
/
rrt.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
#ifndef RRT_H
#define RRT_H
#include "obstacles.h"
#include <stdlib.h>
#include <vector>
#include <math.h>
using namespace std;
using namespace Eigen;
struct Node {
vector<Node *> children;
Node *parent;
Vector2f position;
};
class RRT
{
public:
RRT();
void initialize();
Node* getRandomNode();
Node* nearest(Vector2f point);
int distance(Vector2f &p, Vector2f &q);
Vector2f newConfig(Node *q, Node *qNearest);
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 // RRT_H