libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
taskManagerInterface.hpp
1 #ifndef TASKMANAGERINTERFACE_H
2 #define TASKMANAGERINTERFACE_H
3 
4 #include "taskManager.hpp"
5 
6 enum PlannerStates {
7  Iddle,
8  ExecuteTraj,
9  ExecuteSubTraj,
10  PlanningGTP,
11  ComputeTraj,
12  Smoothing,
13  SmoothingPlan,
14  FindingAlternative,
15  ComputeList,
16  ComputeListMP,
17  ComputeHeuristic,
18  ComputeMultiple,
19  LaunchMSgConnector,
20  testFunction
21 };
22 
23 
24 typedef struct struct_inputs {
25  std::string typeStr;
26  TasksId type;
27  std::multimap<std::string,std::string> agents;
28  std::multimap<std::string,std::string> objects;
29  std::multimap<std::string,p3d_point> points;
30  std::multimap<std::string,std::string> additionalData;
31  bool MPComputation;
32  TaskConstraints* constraints;
33 
34  bool isAlreadyComputed;
35  int TaskId;
36  int nbAlt;
37 
38  WorldState* ws;
39 
40 }task_in;
41 
42 
44 {
45  MOVE3D_STATIC_LOGGER;
46 public:
48  void initTaskManager();
49 
50  void setTypeStr(std::string str);
51  void setType(TasksId type);
52  TasksId getType() {return _type;}
53 
54  void setAgent(std::string id, std::string name);
55  void setObject(std::string id, std::string name);
56  void addPoint(std::string id, p3d_point p);
57  void addAdditinalData(std::string id, std::string value);
58 
59 
60  std::multimap<std::string,std::string> getAgents() {return _agents;}
61  std::multimap<std::string,std::string> getObjects() {return _objects;}
62  std::multimap<std::string,p3d_point> getPoints() {return _points;}
63  std::multimap<std::string,std::string> getAdditionalData() {return _additionalData;}
64 
65  void desactiveConstraints(Robot* ag);
66  void clearAgents() {_agents.clear();}
67  void clearObjects() {_objects.clear();}
68  void clearPoints() {_points.clear();}
69  void clearAdditionalData() {_additionalData.clear();}
70 
71  void setWorldState(WorldState* WS);
72  WorldState* getWorldState() {return _WS;}
73 
74  void callGTP();
75  void callAlternative(int taskId);
76  double getTaskHeuristic();
77 
78  TaskManager* getTaskManager() { return m_TM; }
79  Task* getLastSolutionFound();
80 
81  PlannerStates getState() { return _PS; }
82  void setState(PlannerStates PS) { _PS = PS; }
83 
84  int getSolutionId() {return _solutionId;}
85  void setSolutionId(int solId) {_solutionId = solId;}
86 
87  int getAlternativeId() {return _alternativeId;}
88  void setAlternativeId(int altId) {_alternativeId = altId;}
89 
90  int getSubSolutionId() {return _subSolutionId;}
91  void setSubSolutionId(int subSolId) {_subSolutionId = subSolId;}
92 
93  void resetAll();
94  void clearAllInputs();
95  std::string getCurrentInputsDescr();
96 
97  TaskSubSolution* current_executing_traj;
98 
99  bool hasWorldState(){return _hasWorldState;}
100  void setHasWorldState(bool val) {_hasWorldState = val;}
101 
102  TaskSolution* getCurrentSol() {return current_solution;}
103  void setCurrentSol(TaskSolution* curSol) {current_solution = curSol;}
104 
105  PlanNode* getCurrentPN() {return _curr_PN;}
106  void setCurrentPN(PlanNode* curPN) {_curr_PN = curPN;}
107 
108  TaskSubSolution* getCurrentSubSol() {return current_sub_solution;}
109  void setCurrentSubSol(TaskSubSolution* curSol) {current_sub_solution = curSol;}
110 
111  bool getComputeMP() {return _computeMP;}
112  void setComputeMP(bool CMP) { _computeMP = CMP;}
113 
114  TaskConstraints* getConstraints() {return _constraints;}
115  void setConstraints(TaskConstraints* vt) {_constraints = vt;}
116 
117  void removeConstraintFromPrevTS(int taskId, int altId);
118 
119  void addCurrentTaskToList();
120  void loadCurrentTaskFrom(task_in TI);
121  void clearList();
122  void resetAllFromScratch();
123  void removeLastTaskFromList();
124  std::string getOneTaskDescr(task_in t);
125  std::string getListDescr();
126  TaskConstraints* getGoalConstraints();
127  bool testGoalConstraints();
128  bool computePlan(bool computeMP, int init_id);
129  bool computeJustMP();
130 
131  bool getWSFromRangeParam(int taskId, int altId, WorldState* ws, double rangeParam);
132 
133  std::vector<std::pair<std::pair<int,int>, double> > getBacktrackPriorities();
134 
135  std::vector<task_in> getTaskList() {return _tasksList;}
136  void setTaskList(std::vector<task_in> ti) {_tasksList = ti;}
137 
138  bool getPlanFound() {return _planFound;}
139  void setPlanFound(bool pf) {_planFound = pf;}
140 
141  bool getIsComputePlanSuccess() {return _isComputePlanSuccess;}
142  void setIsComputePlanSuccess(bool s) {_isComputePlanSuccess = s;}
143 
144  WorldState* getInitWS() {return _initWS;}
145  void setInitWS(WorldState* ws){_initWS = ws;}
146 
147  void savePlanToDisk(std::string path);
148  void loadPlanFromDisk(std::string path);
149 
150  void readTask(std::vector<std::string> vt);
151  TaskSubSolution* readTSS(TaskSolution *TS, std::vector<std::string> vt);
152  std::pair<std::string,WorldState*> readWS(std::vector<std::string> vt);
153  p3d_traj *readTraj(std::vector<std::string> vt, Robot *r);
154  p3d_localpath *readLocalpath(std::vector<std::string> vt, std::string type, Robot *r);
155  confPtr_t readConf(std::vector<std::string> ligne, Robot *r );
156 
157 
158  double getCurrentHeurisitic() {return _currentHeuristic;}
159  void setCurrentHeurisitic(double h) {_currentHeuristic = h;}
160 
161  bool addAttachementsFromTask(int taskId, int alternativeId);
162  bool addAttachementFromObject(Robot* robot, Robot* object, int armId);
163  void clearAttachements();
164  std::vector<Attachement> getAttachements() {return _attachements;}
165 
166 
167 private:
168  TaskManager* m_TM;
169  TasksId _type;
170  std::string _typeStr;
171  std::multimap<std::string,std::string> _agents;
172  std::multimap<std::string,std::string> _objects;
173  std::multimap<std::string,p3d_point> _points;
174  std::multimap<std::string,std::string> _additionalData;
175 
176  TaskConstraints* _constraints;
177 
178  bool _computeMP;
179 
180  WorldState* _WS;
181  bool _hasWorldState;
182  int _solutionId; // this is the task id, but to not confuse with taskId it s name solution ID
183  int _alternativeId;
184  int _subSolutionId;
185 
186  int current_computing_id;
187 
188  PlannerStates _PS;
189 
190  TaskSubSolution* current_sub_solution;
191 
192  TaskSolution* current_solution;
193  PlanNode* _curr_PN;
194 
195  std::vector<task_in> _tasksList;
196  bool _planFound;
197  TaskConstraints* _goalConstraints;
198 
199  bool _isComputePlanSuccess;
200 
201  WorldState* _initWS;
202 
203  double _currentHeuristic;
204 
205  task_in _lastInputs;
206 
207  std::vector<Attachement> _attachements;
208 
209 
210 };
211 #endif // TASKMANAGERINTERFACE_H
Definition: taskSolution.hpp:9
Definition: taskConstraints.hpp:34
Definition: planNode.hpp:12
Definition: taskSubSolution.hpp:10
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
Definition: taskManager.hpp:19
Definition: taskManagerInterface.hpp:43
Definition: worldState.hpp:30
Definition: taskManagerInterface.hpp:24
Definition: task.hpp:44