complete_turn_path_obj.h
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 // Author: Gonzalo Mier
4 // BSD-3 License
5 //=============================================================================
6 
7 #pragma once
8 #ifndef FIELDS2COVER_OBJECTIVES_COMPLETE_TURN_PATH_OBJ_H_
9 #define FIELDS2COVER_OBJECTIVES_COMPLETE_TURN_PATH_OBJ_H_
10 
11 #include "fields2cover/types.h"
16 
17 namespace f2c::obj {
18 
25 template <class T, class R = PPObjective>
27  static_assert(std::is_base_of<pp::TurningBase, T>::value,
28  "T must derive from f2c::pp::TurningBase");
29  static_assert(std::is_base_of<PPObjective, R>::value,
30  "R must derive from f2c::obj::PPObjective");
31 
32  public:
33  using RPObjective::RPObjective;
34  explicit CompleteTurnPathObj(const F2CRobot& params);
35  explicit CompleteTurnPathObj(const F2CRobot& params, const T& turn_planner);
36 
37  public:
39 
42  double computeCost(
43  const F2CPoint& p1, double ang1,
44  const F2CPoint& p2, double ang2) override;
45 
46  void setRobot(const F2CRobot& robot);
47  void setTurnPlanner(const T& turner);
48 
49  private:
54 };
55 
56 
57 template <class T, class R>
59  this->setRobot(robot);
60 }
61 
62 template <class T, class R>
64  const F2CRobot& _robot, const T& _turner) :
65  turn_planner(_turner), robot(_robot) {}
66 
67 template <class T, class R>
69  this->robot = params;
70 }
71 
72 template <class T, class R>
74  this->turn_planner = turner;
75 }
76 
77 
78 template <class T, class R>
80  const F2CPoint& p1, double ang1,
81  const F2CPoint& p2, double ang2) {
82  return pp_objective.computeCost(
83  this->turn_planner.createTurn(this->robot, p1, ang1, p2, ang2));
84 }
85 
86 
87 } // namespace f2c::obj
88 
89 #endif // FIELDS2COVER_OBJECTIVES_COMPLETE_TURN_PATH_OBJ_H_
f2c::obj::CompleteTurnPathObj::CompleteTurnPathObj
CompleteTurnPathObj(const F2CRobot &params)
Definition: complete_turn_path_obj.h:58
f2c::obj::CompleteTurnPathObj::turn_planner
T turn_planner
Planner that derives from f2c::pp::TurningBase.
Definition: complete_turn_path_obj.h:51
1_basic_types.p1
p1
Definition: 1_basic_types.py:11
types.h
f2c::obj::CompleteTurnPathObj::robot
F2CRobot robot
Definition: complete_turn_path_obj.h:52
f2c::obj::CompleteTurnPathObj::setTurnPlanner
void setTurnPlanner(const T &turner)
Definition: complete_turn_path_obj.h:73
f2c::obj::CompleteTurnPathObj::pp_objective
R pp_objective
Definition: complete_turn_path_obj.h:53
2_objective_functions.robot
robot
Definition: 2_objective_functions.py:76
f2c::obj
Objective algorithms' namespace.
Definition: base_objective.h:14
1_basic_types.p2
p2
Definition: 1_basic_types.py:15
pp_objective.h
f2c::types::Point
Definition: Point.h:21
f2c::obj::CompleteTurnPathObj
Class to compute the cost of turning from one point to another.
Definition: complete_turn_path_obj.h:26
f2c::types::Robot
Definition: Robot.h:25
rp_objective.h
f2c::obj::RPObjective::computeCost
virtual double computeCost(const F2CPoint &p1, const F2CPoint &p2)
Definition: rp_objective.cpp:11
direct_dist_path_obj.h
turning_base.h
f2c::obj::CompleteTurnPathObj::computeCost
double computeCost(const F2CPoint &p1, double ang1, const F2CPoint &p2, double ang2) override
Definition: complete_turn_path_obj.h:79
f2c::obj::RPObjective
Base class for objective functions of route planners.
Definition: rp_objective.h:18
f2c::obj::CompleteTurnPathObj::setRobot
void setRobot(const F2CRobot &robot)
Definition: complete_turn_path_obj.h:68


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31