Template Class CompleteTurnPathObj

Inheritance Relationships

Base Type

Class Documentation

template<class T, class R = PPObjective>
class CompleteTurnPathObj : public f2c::obj::RPObjective

Class to compute the cost of turning from one point to another.

This is the closest result to the real cost of executing the path plan, as it actually compute all the turns.

Warning

Do not use this objective function with slow planners as too many turns may need to be computed for a simple path.

Public Functions

explicit CompleteTurnPathObj(const F2CRobot &params)
explicit CompleteTurnPathObj(const F2CRobot &params, const T &turn_planner)
virtual double computeCost(const F2CPoint &p1, double ang1, const F2CPoint &p2, double ang2) override

Compute the cost of doing the turn between p1 with angle ang1 to p2 with angle ang2.

void setRobot(const F2CRobot &robot)
void setTurnPlanner(const T &turner)
double computeCost(const F2CPoint &p1, const F2CPoint &p2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • p2 – End point

Returns:

Cost value

double computeCost(const F2CPoint &p1, double ang1, const F2CPoint &p2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • ang1 – Angle of the robot in p1

  • p2 – End point

Returns:

Cost value

double computeCost(const F2CPoint &p1, double ang1, const F2CPoint &p2, double ang2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • ang1 – Angle of the robot in p1

  • p2 – End point

  • ang2 – Angle of the robot in p2

Returns:

Cost value

double computeCost(const F2CPoint &p1, const F2CPoint &p2, double ang2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • p2 – End point

  • ang2 – Angle of the robot in p2

Returns:

Cost value

double computeCost(const F2CSwath &s, const F2CPoint &p)

Return the cost of going from swath s to point p.

Parameters:
  • s – Start point (end of the swath)

  • p – End point

Returns:

Cost value

double computeCost(const F2CSwath &s1, const F2CSwath &s2)

Return the cost of going from swath s to point p.

Parameters:
  • s1 – Start point (end of the swath)

  • s2 – End point (start of the swath)

Returns:

Cost value

double computeCost(const F2CSwath &s, const F2CPoint &p, double ang)

Return the cost of going from swath s to point p.

Parameters:
  • s – Start point (end of the swath)

  • p – End point

  • ang – Angle of the robot in p

Returns:

Cost value

double computeCost(const F2CPoint &p, const F2CSwath &s)

Return the cost of going from point p to swath s.

Parameters:
  • p – Start point

  • s – End point (start of the swath)

Returns:

Cost value

double computeCost(const F2CPoint &p, double ang, const F2CSwath &s)

Return the cost of going from point p to swath s.

Parameters:
  • p – Start point

  • ang – Angle of the robot in p

  • s – End point (start of the swath)

Returns:

Cost value

double computeCost(const std::vector<F2CPoint> &ps)

Return the cost of covering all the points of ps.

Parameters:

ps – vector of points

Returns:

Cost value

double computeCost(const F2CMultiPoint &ps)

Return the cost of covering all the points of ps.

Parameters:

ps – vector of points

Returns:

Cost value

double computeCost(const F2CSwath &s, const F2CMultiPoint &ps)

Return the cost of going from swath s to the first point of ps.

Parameters:
  • s – Start point (end of the swath)

  • ps – vector of points

Returns:

Cost value

double computeCost(const F2CSwaths &s, const F2CMultiPoint &ps)

Return the cost of going from the last swath of s to the first point of ps.

Parameters:
  • s – Start point (end of the last swath)

  • ps – vector of points (first point)

Returns:

Cost value

double computeCost(const F2CMultiPoint &ps, const F2CSwath &s)

Return the cost of going from the last point of ps to the swath s.

Parameters:
  • ps – vector of points (end point)

  • s – Start point (start of the swath)

Returns:

Cost value

double computeCost(const F2CMultiPoint &ps, const F2CSwaths &s)

Return the cost of going from the last point of ps to the first swath of s.

Parameters:
  • ps – vector of points (end point)

  • s – Start point (start of the first swath)

Returns:

Cost value

double computeCost(const F2CSwath &s)

Return the cost of covering a swath.

Parameters:

s – Swath

Returns:

Cost value

double computeCost(const F2CSwaths &swaths)

Return the cost of covering a vector of swaths.

Costs of each swath + Cost of going from one to another. The order may affect the cost.

Parameters:

s – Swaths

Returns:

Cost value

double computeCost(const F2CRoute &r)

Return the cost of covering a Route.

Costs of each swath + Cost of going from one to another.

Parameters:

r – Route

Returns:

Cost value

virtual double computeCost(const F2CPoint &p1, const F2CPoint &p2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • p2 – End point

Returns:

Cost value

virtual double computeCost(const F2CPoint &p1, double ang1, const F2CPoint &p2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • ang1 – Angle of the robot in p1

  • p2 – End point

Returns:

Cost value

virtual double computeCost(const F2CPoint &p1, const F2CPoint &p2, double ang2)

Return the cost of going from point p1 to point p2.

Parameters:
  • p1 – Start point

  • p2 – End point

  • ang2 – Angle of the robot in p2

Returns:

Cost value

virtual double computeCost(const F2CSwath &s, const F2CPoint &p)

Return the cost of going from swath s to point p.

Parameters:
  • s – Start point (end of the swath)

  • p – End point

Returns:

Cost value

virtual double computeCost(const F2CSwath &s1, const F2CSwath &s2)

Return the cost of going from swath s to point p.

Parameters:
  • s1 – Start point (end of the swath)

  • s2 – End point (start of the swath)

Returns:

Cost value

virtual double computeCost(const F2CSwath &s, const F2CPoint &p, double ang)

Return the cost of going from swath s to point p.

Parameters:
  • s – Start point (end of the swath)

  • p – End point

  • ang – Angle of the robot in p

Returns:

Cost value

virtual double computeCost(const F2CPoint &p, const F2CSwath &s)

Return the cost of going from point p to swath s.

Parameters:
  • p – Start point

  • s – End point (start of the swath)

Returns:

Cost value

virtual double computeCost(const F2CPoint &p, double ang, const F2CSwath &s)

Return the cost of going from point p to swath s.

Parameters:
  • p – Start point

  • ang – Angle of the robot in p

  • s – End point (start of the swath)

Returns:

Cost value

virtual double computeCost(const std::vector<F2CPoint> &ps)

Return the cost of covering all the points of ps.

Parameters:

ps – vector of points

Returns:

Cost value

virtual double computeCost(const F2CMultiPoint &ps)

Return the cost of covering all the points of ps.

Parameters:

ps – vector of points

Returns:

Cost value

virtual double computeCost(const F2CSwath &s, const F2CMultiPoint &ps)

Return the cost of going from swath s to the first point of ps.

Parameters:
  • s – Start point (end of the swath)

  • ps – vector of points

Returns:

Cost value

virtual double computeCost(const F2CSwaths &s, const F2CMultiPoint &ps)

Return the cost of going from the last swath of s to the first point of ps.

Parameters:
  • s – Start point (end of the last swath)

  • ps – vector of points (first point)

Returns:

Cost value

virtual double computeCost(const F2CMultiPoint &ps, const F2CSwath &s)

Return the cost of going from the last point of ps to the swath s.

Parameters:
  • ps – vector of points (end point)

  • s – Start point (start of the swath)

Returns:

Cost value

virtual double computeCost(const F2CMultiPoint &ps, const F2CSwaths &s)

Return the cost of going from the last point of ps to the first swath of s.

Parameters:
  • ps – vector of points (end point)

  • s – Start point (start of the first swath)

Returns:

Cost value

virtual double computeCost(const F2CSwath &s)

Return the cost of covering a swath.

Parameters:

s – Swath

Returns:

Cost value

virtual double computeCost(const F2CSwaths &swaths)

Return the cost of covering a vector of swaths.

Costs of each swath + Cost of going from one to another. The order may affect the cost.

Parameters:

s – Swaths

Returns:

Cost value

virtual double computeCost(const F2CRoute &r)

Return the cost of covering a Route.

Costs of each swath + Cost of going from one to another.

Parameters:

r – Route

Returns:

Cost value

inline double computeCostWithMinimizingSign(const T1 &t1)

Compute the cost function with minimizing sign.

If the objective is to maximize the cost function, the cost is multiplied by -1.

inline double computeCostWithMinimizingSign(const T1 &t1, const T2 &t2)
inline double computeCostWithMinimizingSign(const T1 &t1, const T2 &t2, const T3 &t3)
inline double computeCostWithMinimizingSign(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
inline virtual bool isMinimizing() const

Return true if the objective is to minimize the cost function.

inline virtual bool isMaximizing() const

Return true if the objective is to maximize the cost function.