libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
grid.hpp
1 #ifndef GRID_H
2 #define GRID_H
3 
4 #include "API/Grids/ThreeDGrid.hpp"
5 #include "API/Grids/TwoDGrid.hpp"
6 
7 #include "API/planningAPI.hpp"
8 
9 
10 
11 using namespace Eigen;
12 
13 class GTPGrid : public API::ThreeDGrid
14 {
15 public:
16  GTPGrid();
17 };
18 
19 class GTPCell : public API::ThreeDCell
20 {
21 public:
22  GTPCell();
23 };
24 
25 class GTP2DCell;
26 
27 class GTP2DGrid : public API::TwoDGrid
28 {
30 public:
31  GTP2DGrid();
32  GTP2DGrid(double pace, std::vector<double> envSize);
33 
34  bool initCylinders();
35 
36  void addAgentAndComputeNav(Robot* robot);
37  void propagateDist(Robot* robot);
38  void initAllCells();
39  std::vector<GTP2DCell*> getCellsWithinReach(double xCenter, double yCenter, double reach, Robot* agent);
40 
41 
42  double getNbCellX() {return _nbCellsX;}
43  double getNbCellY() {return _nbCellsY;}
44 
45  void draw();
46 
47 
48  void createAllCells();
49  GTP2DCell* createNewCell2(unsigned int index,unsigned int x,unsigned int y );
50 
51  std::vector<GTP2DCell*> getPath(Robot *r, GTP2DCell* targetCell);
52  std::vector<GTP2DCell*> getHumanAwarePath(Robot *r, GTP2DCell* targetCell, double distWeight, double Hweight,
53  double angleWeight, double distHWeight, double distWeight2);
54 
55  std::vector<GTP2DCell*> getCellsArroundSupport(Robot* agent, Robot *support);
56  std::vector<GTP2DCell*> getCellsArroundObject(Robot* agent, Robot* manipulable);
57  std::vector<GTP2DCell*> getCellsArroundAgent(Robot* agent, Robot* targetAgent);
58 
59  void setCurrentRobot(Robot* rob);
60 
61  int getNbExploredCells(){return nbExploredCells;}
62 
63 
64 private:
65  std::vector<Robot*> _robotList;
66  Robot* _humCyl;
67  Robot* _robotCyl;
68  int nbExploredCells;
69 
70 };
71 
72 enum cellState {
73  NotTested,
74  Open,
75  Closed
76 };
77 
78 
79 
80 
81 class GTP2DCell : public API::TwoDCell
82 {
84 public:
85  GTP2DCell();
86  GTP2DCell(int i, Eigen::Vector2i coord, Eigen::Vector2d corner, GTP2DGrid* grid);
87  std::vector<GTP2DCell*> getNeighboors();
88  void setState(cellState s);
89  cellState getState() {return _state;}
90  void initialize();
91  void addToNavigability(Robot* robot);
92 
93  double dist(GTP2DCell* c);
94  void print();
95 
96  Eigen::Vector2i getCoord() { return _Coord; }
97 
98  bool getNavigability(Robot* r);
99 
100  bool toBeDrawn();
101  void setDrawn(bool v) {_toBeDrawn = v;}
102 
103 
104  void setPrev(Robot* r, GTP2DCell* c);
105  GTP2DCell* getPrev(Robot* r);
106 
107  void setDist(Robot* r, double d);
108  double getDist(Robot* r);
109  bool isReachable(Robot* r);
110 
111  void setScore(double f){f_score = f;}
112  double getScore() {return f_score;}
113 
114  double computeDistTo(GTP2DCell* c);
115 
116  void setIsInCol(bool val) { _collisionCheck = val;}
117  bool isInCol() { return _collisionCheck;}
118 
119 
120  void setCurrentRobot(Robot* rob) {_currentRobot = rob;}
121  double getDistCurrentRobot();
122 
123  double Ecolor;
124 
125 private:
126  bool _toBeDrawn;
127  cellState _state;
128  Eigen::Vector2i _Coord;
129 
130  std::vector< std::pair<Robot*,bool> > navigability;
131 
132  std::map<Robot*,double> distances_to_init;
133  std::map<Robot*,GTP2DCell*> previous_to_init;
134 
135  bool _collisionCheck;
136 
137  Robot* _currentRobot;
138 
139  double f_score;
140 };
141 
142 
143 
144 #endif // GRID_H
Definition: grid.hpp:13
Definition: grid.hpp:81
Definition: ThreeDGrid.hpp:24
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
Definition: TwoDCell.hpp:19
Definition: grid.hpp:27
#define MOVE3D_STATIC_LOGGER
MOVE3D_STATIC_LOGGER macro defines a static logger for the class.
Definition: Logger.h:74
Definition: TwoDGrid.hpp:25
Definition: ThreeDCell.hpp:25
Definition: grid.hpp:19