libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
HRICS_old.hpp
1 #ifndef P3D_HRICOST_HPP
2 #define P3D_HRICOST_HPP
3 
4 #include "API/planningAPI.hpp"
5 
9 namespace HRICS
10 {
11  typedef struct confCost {
12  configPt q;
13  double cost;
14  } confCost;
15 
19  class Hri
20  {
21  public:
22  //robot
23  p3d_rob* Robot;
24 
25  //Human
26  p3d_rob* Human;
27 
28  private:
29  // Cost variables
30  double c_to_goal;
31  double c_penetra;
32  double c_natural;
33  double c_jlimits;
34  double c_taskdist;
35 
36  // Max variables
37  double max_to_goal;
38  double max_taskdist;
39  double max_jlimits;
40 
41  double cost;
42 
43 
44  class zoneHri{
45 
46  public:
47  // identifier for robot object
48  int id;
49 
50  // nom du corps
51  std::string name;
52 
53  // radius of the zone
54  double radius;
55 
56  // position
57  std::vector<double> position;
58 
59  // dist hri
60  double dist_pene;
61 
62  zoneHri(){
63  id = -1;
64  name = "";
65  radius = 0;
66  position.clear();
67  position.resize(3);
68  dist_pene = std::numeric_limits<double>::max();
69  };
70 
71  bool done() const {
72  if( id==-1 || radius==0 )
73  return false;
74  else
75  return true;
76  };
77 
78  void reset(){
79  zoneHri zone;
80  *this = zone;
81  };
82 
83  inline bool operator < (const zoneHri& zone) const
84  {
85  if (dist_pene < zone.dist_pene)
86  return true;
87  return false;
88  };
89 
90  };
91 
92  std::vector<zoneHri> zones;
93 
94  //Vector for HRI closeness
95  std::vector<double> vect_jim;
96 
97  //distances to points
98  std::vector<double> dist_penetration;
99 
100  double dist_min;
101 
102  double safe_radius;
103  double safe_offset;
104 
105  double color;
106 
107  configPt fromComp;
108  configPt toComp;
109  configPt qConfort;
110 
111  public:
112  //Constructor
113  Hri();
114  Hri(double zone_size);
115 
116  void setNodes(Node* fromComp,Node* toComp);
117 
118  void parseEnvForZone();
119  void parseEnvHoleHuman();
120  void parseEnvBarre();
121  void parseEnv();
122  void changeColor();
123 
124  void offSetPrim(p3d_poly* poly,double offset);
125  void computeMaxValues();
130  double getHriDistCost(p3d_rob* robotPt, int disp);
131  double getDistZone(int zone, int disp);
132  void getDistBody(int disp);
133  void getDistHoleHuman(int disp);
134 
135  void *beg_zone_hri(char *name);
136 
137  p3d_obj* getObjectByName(char *name);
138 
139  void activateAll(int disp);
140  void deactivateAllButHri(int disp);
141  void deactivateHri(int disp);
142  void deactivateAllButHriAchile(int zone,int disp);
143  void activateAllAchile(int disp);
144 
148  std::vector<double>& getVectJim(void);
149 
153  configPt getGoalConfig(p3d_rob* robotPt);
154 
155  double getPeneTrajCost(graph* graphPt, traj* trajPt,
156  double* minCostPt, double* maxCostPt,
157  double* totalCostPt, int* nbConfigPt);
158 
159  void getDistToGoalCost(int disp);
160  void getNaturalLookingCost(int disp);
161  void getSafeZoneCost(int disp);
162  double getCustomDistConfig(configPt q_i, configPt q_f);
163 
164  void saveGPlotCostTraj(int iteration);
165  void saveGPlotCostNodeChro(void);
166 
171  void setCostToTab( p3d_rob *robotPt, confCost *tab , int nbPart );
172  void writeConfCostToCsv(confCost *tab,int size);
173  void writeConfCostToObPlane(confCost *tab,int size);
174 
175  void costTabFormFunction(confCost* tab);
176  double costMapFunctions(double x, double y, int id_func);
177 
178 
179  };
180 }
181 
182 //extern HRICS::Hri hri_zones;
183 
184 #endif
void deactivateHri(int disp)
p3d_DeactivateHris
Definition: HRICS_old.cpp:1665
double getDistZone(int zone, int disp)
Computes the penetration distance.
Definition: HRICS_old.cpp:647
Classe Hri.
Definition: HRICS_old.hpp:19
void activateAll(int disp)
p3d_ActivateAll
Definition: HRICS_old.cpp:1700
void saveGPlotCostTraj(int iteration)
p3d_SaveGPlotCostTraj
Definition: HRICS_old.cpp:1305
void deactivateAllButHri(int disp)
p3d_DeactivateAllButHri
Definition: HRICS_old.cpp:1628
Classe représentant un Node d'un Graph.
Definition: node.hpp:39
void getDistHoleHuman(int disp)
Computes the penetration distance.
Definition: HRICS_old.cpp:837
void parseEnvForZone()
Add zones to Hri module.
Definition: HRICS_old.cpp:47
void writeConfCostToCsv(confCost *tab, int size)
Writes Configuration Cost to CSV file format.
Definition: HRICS_old.cpp:1545
void offSetPrim(p3d_poly *poly, double offset)
Changes dynamically the size of the zone shown in the OpenGl display.
Definition: HRICS_old.cpp:365
void deactivateAllButHriAchile(int zone, int disp)
p3d_DeactivateHris
Definition: HRICS_old.cpp:1733
void activateAllAchile(int disp)
p3d_ActivateAll
Definition: HRICS_old.cpp:1713
Definition: HRICS_old.hpp:11
void saveGPlotCostNodeChro(void)
p3d_SaveGPlotCostNodeChro
Definition: HRICS_old.cpp:1366
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
p3d_obj * getObjectByName(char *name)
p3d_GetObjectByName
Definition: HRICS_old.cpp:1282
double getHriDistCost(p3d_rob *robotPt, int disp)
p3d_GetMinDistCost Get the cost of a current configuration based
Definition: HRICS_old.cpp:566
double getPeneTrajCost(graph *graphPt, traj *trajPt, double *minCostPt, double *maxCostPt, double *totalCostPt, int *nbConfigPt)
Gets the penetration cost along a trajectory.
Definition: HRICS_old.cpp:1166
double getCustomDistConfig(configPt q_i, configPt q_f)
Compute the classic square distance between two configurations with weight.
Definition: HRICS_old.cpp:1100
std::vector< double > & getVectJim(void)
p3d_GetVectJim
Definition: HRICS_old.cpp:1619
void setCostToTab(p3d_rob *robotPt, confCost *tab, int nbPart)
Puts all costs in a tab for 2D environment.
Definition: HRICS_old.cpp:1390
void parseEnvBarre()
Creates zone out of the Bar model.
Definition: HRICS_old.cpp:236
void computeMaxValues()
Intent to compute the interval of value in the CSpace that the robot goes through during specific pla...
Definition: HRICS_old.cpp:417
void parseEnvHoleHuman()
Creates zone out of the Achile model.
Definition: HRICS_old.cpp:140
void parseEnv()
Main function to create zones.
Definition: HRICS_old.cpp:268
void changeColor()
Changes color of the zone.
Definition: HRICS_old.cpp:316
void getDistToGoalCost(int disp)
Computes the distance to goal cost.
Definition: HRICS_old.cpp:939
void costTabFormFunction(confCost *tab)
Creates a Tab Cost out of a function.
Definition: HRICS_old.cpp:1469
void * beg_zone_hri(char *name)
Fonction commencant la description d'une zone hri (obstacle) p3d rattache a l'environnement courant...
Definition: HRICS_old.cpp:1246
double costMapFunctions(double x, double y, int id_func)
Creates a simple 2D Cost tab.
Definition: HRICS_old.cpp:1497
void getNaturalLookingCost(int disp)
Computes the natural looking cost of a robot configuration.
Definition: HRICS_old.cpp:1004
configPt getGoalConfig(p3d_rob *robotPt)
Gives the goal configuration.
Definition: HRICS_old.cpp:907
void getDistBody(int disp)
Computes the penetration distance.
Definition: HRICS_old.cpp:726
void writeConfCostToObPlane(confCost *tab, int size)
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_old.cpp:1571