Robot Planning and its Applications Project
utils.hpp
Go to the documentation of this file.
1 #ifndef PATH_H
2 #define PATH_H
3 
4 #include <vector>
5 #include <cmath>
6 #include <cstddef>
8 struct Pose
9 {
10  float s, x, y, theta, kappa;
11 
12  Pose(float s, float x, float y, float theta, float kappa):
13  s(s), x(x), y(y), theta(theta), kappa(kappa)
14  {}
15 
16  Pose():
17  Pose(0, 0, 0, 0, 0)
18  {}
19 
20  float distance(float _x, float _y)
21  {
22  return std::hypot(x-_x, y-_y);
23  }
24 };
25 
27 struct Path
28 {
29  std::vector<Pose> points;
30 
31  Path(std::vector<Pose> const & points):
32  points(points)
33  {}
34 
35  Path()
36  {}
37 
38  bool empty() { return points.empty(); }
39  size_t size() { return points.size(); }
40  void setPoints(const std::vector<Pose>& points) { this->points = points; }
41 };
43 struct Point
44 {
45  float x, y;
46 
47  Point(float x, float y):
48  x(x), y(y)
49  {}
50 
51  Point():
52  Point(0, 0)
53  {}
54 
55 };
56 
58 typedef std::vector<Point> Polygon;
59 
60 
61 #endif
Point(float x, float y)
Definition: utils.hpp:47
Path(std::vector< Pose > const &points)
Definition: utils.hpp:31
Path()
Definition: utils.hpp:35
float x
Definition: utils.hpp:10
A configuration of the robot along the path, represented by x, y, orientation and curvature...
Definition: utils.hpp:8
float y
Definition: utils.hpp:10
float y
Definition: utils.hpp:45
float distance(float _x, float _y)
Definition: utils.hpp:20
size_t size()
Definition: utils.hpp:39
Pose()
Definition: utils.hpp:16
Point()
Definition: utils.hpp:51
float kappa
Definition: utils.hpp:10
Pose(float s, float x, float y, float theta, float kappa)
Definition: utils.hpp:12
std::vector< Pose > points
Definition: utils.hpp:29
bool empty()
Definition: utils.hpp:38
void setPoints(const std::vector< Pose > &points)
Definition: utils.hpp:40
float s
Definition: utils.hpp:10
Point in given space.
Definition: utils.hpp:43
float theta
Definition: utils.hpp:10
std::vector< Point > Polygon
Polygon(which is a representation of multiple points)
Definition: utils.hpp:58
A sequence of sampled robot configurations composing a (discretization of the) path.
Definition: utils.hpp:27