base_local_planner
alignment_cost_function.cpp
Go to the documentation of this file.
2 
3 #define PI 3.14159
4 
5 namespace base_local_planner {
6 
8  theta_desired_(0.0)
9 {
10 
11 }
12 
14 {
15 
16 }
17 
19 {
21  if (traj.getPointsSize() == 0)
22  {
23  return 0.0;
24  }
25  else
26  {
27  double x, y, theta;
28  traj.getEndpoint(x, y, theta);
29  double error = theta_desired_-theta;
31  if (error < -PI) {error += 2*PI; }
32  else if (error > PI) {error -= 2*PI; }
33 
34  return fabs(error);
35  }
36 }
37 
38 }
alignment_cost_function.h
base_local_planner::AlignmentCostFunction::theta_desired_
double theta_desired_
Desired orientation.
Definition: alignment_cost_function.h:28
base_local_planner::AlignmentCostFunction::AlignmentCostFunction
AlignmentCostFunction()
Definition: alignment_cost_function.cpp:7
base_local_planner::AlignmentCostFunction::scoreTrajectory
double scoreTrajectory(Trajectory &traj)
Definition: alignment_cost_function.cpp:18
PI
#define PI
Definition: alignment_cost_function.cpp:3
base_local_planner::AlignmentCostFunction::~AlignmentCostFunction
virtual ~AlignmentCostFunction()
Definition: alignment_cost_function.cpp:13
base_local_planner::Trajectory::getEndpoint
void getEndpoint(double &x, double &y, double &th) const
Get the last point of the trajectory.
Definition: trajectory.cpp:103
base_local_planner::Trajectory::getPointsSize
unsigned int getPointsSize() const
Return the number of points in the trajectory.
Definition: trajectory.cpp:109
base_local_planner::Trajectory
Holds a trajectory generated by considering an x, y, and theta velocity.
Definition: trajectory.h:76
base_local_planner
Definition: alignment_cost_function.h:7