Robot Planning and its Applications Project
rrtstar.h
Go to the documentation of this file.
1 
7 #ifndef RRTSTAR_H
8 #define RRTSTAR_H
9 #include "obstacles.h"
10 #include <stdlib.h>
11 #include <vector>
12 #include <math.h>
13 #include<iostream>
14 using namespace std;
15 using namespace std;
16 using namespace Eigen;
17 
21 struct Node {
22  vector<Node *> children;
24  Vector2f position;
25  float orientation;
26  double cost;
27 };
28 
32 class RRTSTAR
33 {
34 public:
35  RRTSTAR();
36  void initialize();
37  Node* getRandomNode();
38  Node* nearest(Vector2f point);
39  void near(Vector2f point, float radius, vector<Node *>& out_nodes);
40  double distance(Vector2f &p, Vector2f &q);
41  double Cost(Node *q);
42  double PathCost(Node *qFrom, Node *qTo);
43  Vector3f newConfig(Node *q, Node *qNearest);
44 
45  void add(Node *qNearest, Node *qNew);
46  bool reached();
47  void setStepSize(double step);
48  void setMaxIterations(int iter);
49  void deleteNodes(Node *root);
50 
51  /*Functions to set the parameters*/
52  void setStartPose(double x,double y,double theta);
53  void setGoalPose(double x, double y);
54  void setWorldInfo(double width,double height);
55  void set_max_iter(int x);
56  void set_step_size(double x);
57  void set_bot_radius(double x);
58  void set_goalBias(double x);
59  void set_turn_radius(double x);
60  void set_rrt_star_neighbour_factor(double x);
61  void set_bot_follow_dubin(bool x);
62 
64  vector<Node *> nodes;
65  vector<Node *> path;
69  /* Parameters to be set before using RRT*/
70  Vector2f startPos;
71  Vector2f endPos;
72  double start_orient;
73  int max_iter;
74  double step_size;
75  double world_width;
76  double world_height;
77  double bot_radius;
78  double goalBias;
79  double turn_radius;
83 };
84 
85 #endif // RRTSTAR_H
RRTObstacles * obstacles
Definition: rrtstar.h:63
vector< Node * > nodes
Definition: rrtstar.h:64
double goalBias
Definition: rrtstar.h:78
Vector2f position
Definition: rrtstar.h:24
RRT* Node strut.
Definition: rrtstar.h:21
double step_size
Definition: rrtstar.h:74
double bot_radius
Definition: rrtstar.h:77
Node * root
Definition: rrtstar.h:66
double turn_radius
Definition: rrtstar.h:79
RRTStar Class.
Definition: rrtstar.h:32
double world_height
Definition: rrtstar.h:76
bool bot_follow_dubin
Definition: rrtstar.h:80
vector< Node * > children
Definition: rrtstar.h:22
Vector2f endPos
Definition: rrtstar.h:71
double rrt_star_neighbour_factor
Definition: rrtstar.h:81
Vector2f startPos
Definition: rrtstar.h:70
Node * lastNode
Definition: rrtstar.h:67
vector< Node * > path
Definition: rrtstar.h:65
Contains the declaration of Obstacles class.
double cost
Definition: rrtstar.h:26
Node * parent
Definition: rrtstar.h:23
int max_iter
Definition: rrtstar.h:73
float orientation
Definition: rrtstar.h:25
Obstacles class for RRT* Star Implementation.
Definition: obstacles.h:20
double start_orient
Definition: rrtstar.h:72
double world_width
Definition: rrtstar.h:75