libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
HRICS_TwoDGrid.hpp
1 #ifndef HRICS_TWODGRID_HPP
2 #define HRICS_TWODGRID_HPP
3 
4 #include "API/planningAPI.hpp"
5 #include "API/Grids/gridsAPI.hpp"
6 
7 namespace HRICS
8 {
13  class PlanGrid : public API::TwoDGrid
14  {
15  public:
16  PlanGrid(Robot* R, double pace, std::vector<double> envSize);
17 
18  API::TwoDCell* createNewCell(unsigned int index,unsigned int x,unsigned int y );
19 
20  void writeToOBPlane();
21  void draw();
22  void setRobotToStoredConfig();
23  void reset();
24 
25  Robot* getRobot() { return mRobot; }
26 
27  private:
28  Robot* mRobot;
29  };
30 
35  class PlanCell : public API::TwoDCell
36  {
37 
38  public:
39  PlanCell(int i, Eigen::Vector2i coord, Eigen::Vector2d corner, PlanGrid* grid);
40 
41  ~PlanCell() { }
42 
43  Eigen::Vector2i getCoord() { return _Coord; }
44 
45  double getCost(); /* { std::cout << " Warning not implemented" << std::endl; }*/
46  void resetCost() { mCostIsComputed = false; }
47 
48  bool getOpen() { return _Open; }
49  void setOpen() { _Open = true; }
50  bool getClosed() { return _Closed; }
51  void setClosed() { _Closed = true; }
52  void resetExplorationStatus() { _Open = false; _Closed = false; }
53 
54  bool isValid();
55  void resetIsValid() { mIsCellTested = false; }
56 
57  private:
58 
59  confPtr_t setRobotAtCenter();
60 
61  Eigen::Vector2i _Coord;
62 
63  bool _Open;
64  bool _Closed;
65 
66  bool mCostIsComputed;
67  double mCost;
68 
69  bool mIsCellTested;
70  bool mIsValid;
71  };
72 
77  class PlanState : public API::State
78  {
79  public:
80  PlanState() {}
81  PlanState( Eigen::Vector2i cell, PlanGrid* grid);
82  PlanState( PlanCell* cell , PlanGrid* grid);
83 
84  std::vector<API::State*> getSuccessors(API::State* s);
85 
86  bool isLeaf(); /* leaf control for an admissible heuristic function; the test of h==0*/
87  bool equal(API::State* other);
88  bool isValid();
89 
90  void setClosed(std::vector<PlanState*>& closedStates,std::vector<PlanState*>& openStates);
91  bool isColsed(std::vector<PlanState*>& closedStates);
92 
93  void setOpen(std::vector<PlanState*>& openStates);
94  bool isOpen(std::vector<PlanState*>& openStates);
95 
96  void reset();
97  void print();
98 
99  PlanCell* getCell() { return _Cell; }
100 
101  protected:
102  double computeLength(API::State *parent); /* g */
103  double computeHeuristic(API::State *parent = NULL ,API::State* goal = NULL); /* h */
104 
105  private:
106  PlanGrid* _Grid;
107  PlanCell* _Cell;
108  PlanCell* _PreviousCell;
109  };
110 }
111 
112 #endif // HRICS_TWODGRID_HPP
API::TwoDCell * createNewCell(unsigned int index, unsigned int x, unsigned int y)
Virtual function that creates a new Cell.
Definition: HRICS_TwoDGrid.cpp:36
Plannar HRI State.
Definition: HRICS_TwoDGrid.hpp:77
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
Definition: TwoDCell.hpp:19
void writeToOBPlane()
Write a Cost Tab to an ObPlane format, this output has to go through a script to be used as a Cost Ma...
Definition: HRICS_TwoDGrid.cpp:133
Definition: TwoDGrid.hpp:25
++
Definition: State.hpp:20
Plannar HRI Grid.
Definition: HRICS_TwoDGrid.hpp:13
Plannar HRI Cell.
Definition: HRICS_TwoDGrid.hpp:35