Hybrid A* Planner
 All Classes Namespaces Files Functions Variables Friends Pages
smoother.h
1 #ifndef SMOOTHER_H
2 #define SMOOTHER_H
3 
4 #include <cmath>
5 #include <vector>
6 
7 #include "dynamicvoronoi.h"
8 #include "node3d.h"
9 #include "vector2d.h"
10 #include "helper.h"
11 #include "constants.h"
12 namespace HybridAStar {
18 class Smoother {
19  public:
20  Smoother() {}
21 
32 
38  double tracePath(const Node3D* node, int i = 0, std::vector<Node3D> path = std::vector<Node3D>(), double length = 0);
39 
41  std::vector<Node3D> getPath() {return path;}
42 
45 
48 
51 
54 
56  bool isOnGrid(Vector2D vec) {
57  if (vec.getX() >= 0 && vec.getX() < width &&
58  vec.getY() >= 0 && vec.getY() < height) {
59  return true;
60  }
61  return false;
62  }
63 
64  private:
66  float kappaMax = 1.f / (Constants::r * 1.1);
68  float obsDMax = Constants::minRoadWidth;
70  float vorObsDMax = Constants::minRoadWidth;
72  float alpha = 0.1;
74  float wObstacle = 0.2;
76  float wVoronoi = 0;
78  float wCurvature = 0;
80  float wSmoothness = 0.2;
84  int width;
86  int height;
88  std::vector<Node3D> path;
89 };
90 }
91 #endif // SMOOTHER_H
int height
height of the map
Definition: smoother.h:86
DynamicVoronoi voronoi
voronoi diagram describing the topology of the map
Definition: smoother.h:82
A three dimensional node class that is at the heart of the algorithm.
Definition: node3d.h:14
int width
width of the map
Definition: smoother.h:84
This is a collection of constants that are used throughout the project.
float wVoronoi
weight for the voronoi term
Definition: smoother.h:76
Vector2D obstacleTerm(Vector2D xi)
obstacleCost - pushes the path away from obstacles
Definition: smoother.cpp:102
void smoothPath(DynamicVoronoi &voronoi)
This function takes a path consisting of nodes and attempts to iteratively smooth the same using grad...
Definition: smoother.cpp:20
float wCurvature
weight for the curvature term
Definition: smoother.h:78
This class takes a path object and smoothes the nodes of the path.
Definition: smoother.h:18
float wObstacle
weight for the obstacle term
Definition: smoother.h:74
float wSmoothness
weight for the smoothness term
Definition: smoother.h:80
float obsDMax
maximum distance to obstacles that is penalized
Definition: smoother.h:68
float kappaMax
maximum possible curvature of the non-holonomic vehicle
Definition: smoother.h:66
Vector2D smoothnessTerm(Vector2D xim2, Vector2D xim1, Vector2D xi, Vector2D xip1, Vector2D xip2)
smoothnessCost - attempts to spread nodes equidistantly and with the same orientation ...
Definition: smoother.cpp:225
Vector2D curvatureTerm(Vector2D xi0, Vector2D xi1, Vector2D xi2)
curvatureCost - forces a maximum curvature of 1/R along the path ensuring drivability ...
Definition: smoother.cpp:164
A class describing a simple 2D vector.
Definition: vector2d.h:10
std::vector< Node3D > getPath()
returns the path of the smoother object
Definition: smoother.h:41
Vector2D voronoiTerm()
voronoiCost - trade off between path length and closeness to obstaclesg
float vorObsDMax
maximum distance for obstacles to influence the voronoi field
Definition: smoother.h:70
float alpha
falloff rate for the voronoi field
Definition: smoother.h:72
A DynamicVoronoi object computes and updates a distance map and Voronoi diagram.
Definition: dynamicvoronoi.h:14
bool isOnGrid(Vector2D vec)
a boolean test, whether vector is on the grid or not
Definition: smoother.h:56
double tracePath(const Node3D *node, int i=0, std::vector< Node3D > path=std::vector< Node3D >(), double length=0)
Given a node pointer the path to the root node will be traced recursively.
Definition: smoother.cpp:85
std::vector< Node3D > path
path to be smoothed
Definition: smoother.h:88
This is a collection of helper functions that are used throughout the project.