-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrrt.h
45 lines (41 loc) · 1.06 KB
/
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
42
43
44
45
#ifndef RRT_H_
#define RRT_H_
#include "geometry.h"
#include "graph.h"
#include "robot.h"
#include <vector>
#include <random>
#include <limits>
#include <climits>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
using namespace geometry;
class Rrt
{
public:
Rrt(Node* start_, Node* goal_, Graph* graph_);
Rrt(Node* start_, Node* goal_, Graph* graph_, unordered_set<Node*> obstacle_robot_nodes);
vector<Node*> searching();
Node* generateRandomNode();
Node* findNearestNode(unordered_set<Node*> vertex, Node* n);
Node* generateNewNode(Node* start, Node* end);
bool isPassObstacle(Node* start, Node* end);
vector<Node*> extractPath(Node* goal);
void setModel(int model) { this->model = model; }
private:
Node* start;
Node* goal;
Graph* graph;
int iter_max;
unordered_set<Node*> node_list;
unordered_map<Node*, Node*> parent;
double threshold;
double step_len;
double range;
unordered_set<Node*> obstacle_robot_nodes;
int model;
double obstacle_check_step;
};
#endif