1 #ifndef HRICS_EnvGRID_HPP
2 #define HRICS_EnvGRID_HPP
4 #include "API/planningAPI.hpp"
5 #include "API/Grids/gridsAPI.hpp"
19 EnvGrid(
double pace, std::vector<double> envSize,
bool isHumanCentered);
20 EnvGrid(
double pace, std::vector<double> envSize,
bool isHumanCentered,
Robot* robot,
Robot* human);
23 void setRobot(
Robot* R) { mRobot = R; }
24 Robot* getRobot() {
return mRobot; }
26 void setHuman(
Robot* R) { mHuman = R; }
27 Robot* getHuman() {
return mHuman; }
29 Robot* getHumanCylinder() {
return humCyl;}
30 Robot* getRobotCylinder() {
return robotCyl;}
32 double getNbCellX() {
return _nbCellsX;}
33 double getNbCellY() {
return _nbCellsY;}
35 double getHumanMaxDist() {
return m_humanMaxDist;}
36 double getRobotMaxDist() {
return m_robotMaxDist;}
38 void setAsNotSorted() {gridIsSorted =
false;}
40 std::vector<EnvCell*> getHumanAccessibleCells() {
return m_HumanAccessible;}
47 void init(std::pair<double,double> minMax);
52 void initGrid(Eigen::Vector3d humanPos);
143 double m_humanMaxDist;
148 double m_robotMaxDist;
153 std::vector<EnvCell*> m_HumanAccessible;
158 std::vector<EnvCell*> m_RobotAccessible;
163 std::vector<std::pair<double,EnvCell*> > sortedGrid;
180 EnvCell(
int i, Eigen::Vector2i coord, Eigen::Vector2d corner,
EnvGrid* grid);
189 void setHumanDist(
double value) {m_humanDist = value; }
190 double getHumanDist() {
return m_humanDist; }
191 void setHumanDistIsComputed() {m_humanDistIsComputed =
true;}
192 bool isHumanDistComputed() {
return m_humanDistIsComputed;}
195 void setRobotDist(
double value) {m_robotDist = value; }
196 double getRobotDist() {
return m_robotDist; }
197 void setRobotDistIsComputed() {m_robotDistIsComputed =
true;}
198 bool isRobotDistComputed() {
return m_robotDistIsComputed;}
201 bool getOpen() {
return _Open; }
202 void setOpen() { _Open =
true; }
204 bool getClosed() {
return _Closed; }
205 void setClosed() { _Closed =
true; }
207 void resetExplorationStatus() { _Open =
false; _Closed =
false; }
211 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > getHumanVectorTraj() {
return humanVectorTraj;}
212 void setHumanVectorTraj(std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > _humanVectorTraj) {humanVectorTraj = _humanVectorTraj; }
214 std::vector<EnvCell*> getHumanTraj() {
return humanTraj;}
215 void setHumanTraj(std::vector<EnvCell*> _humanTraj) {humanTraj = _humanTraj; }
217 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > getRobotVectorTraj() {
return robotVectorTraj;}
218 void setRobotVectorTraj(std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > _RobotVectorTraj) {robotVectorTraj = _RobotVectorTraj; }
220 std::vector<EnvCell*> getRobotTraj() {
return robotTraj;}
221 void setRobotTraj(std::vector<EnvCell*> _robotTraj) {robotTraj = _robotTraj; }
224 bool isHumAccessible() {
return m_isHumanAccessible;}
225 void setHumAccessible(
bool value) {m_isHumanAccessible = value;}
227 bool isRobAccessible() {
return m_isRobotAccessible;}
228 void setRobAccessible(
bool value) {m_isRobotAccessible = value;}
231 void setHumanRobotReachable(std::vector<EnvCell*> value) {initHumanRobotReachable = value;}
232 std::vector<EnvCell*> getHumanRobotReachable() {
return initHumanRobotReachable;}
233 void addToHumanRobotReachable(
EnvCell* cell) {initHumanRobotReachable.push_back(cell);}
234 void clearHumanRobotReachable() {initHumanRobotReachable.clear();}
236 void setCurrentHumanRobotReachable(std::vector<EnvCell*> value) {currentHumanRobotReachable = value;}
237 std::vector<EnvCell*> getCurrentHumanRobotReachable() {
return currentHumanRobotReachable;}
238 void addToCurrentHumanRobotReachable(
EnvCell* cell) {currentHumanRobotReachable.push_back(cell);}
239 void clearCurrentHumanRobotReachable() {currentHumanRobotReachable.clear();}
242 std::pair<double,EnvCell*> getRobotBestPos(){
return robotBestPos;}
243 void setRobotBestPos(std::pair<double,EnvCell*> value){robotBestPos = value;}
245 void setAngleForHumanComming(
double value) {angleForHumanComming = value;}
246 double getAngleForHumanComming(){
return angleForHumanComming;}
249 void setBlankCost() { mCostIsComputed =
false; }
250 void setCost(
double value) {mCost = value; }
251 double getCost() {
return mCost; }
253 Eigen::Vector2i getCoord() {
return _Coord; }
255 std::vector<double> getRandomVector(){
return randomVectorPoint;}
311 std::vector<EnvCell*>
getCrown(
double min,
double max);
317 Eigen::Vector2i _Coord;
332 bool mCostIsComputed;
342 bool m_isHumanAccessible;
347 bool m_isRobotAccessible;
352 bool m_reachComputed;
357 bool m_humanDistIsComputed;
367 std::vector<EnvCell*> humanTraj;
372 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > humanVectorTraj;
377 bool m_robotDistIsComputed;
387 std::vector<EnvCell*> robotTraj;
392 std::vector<Eigen::Vector2d,Eigen::aligned_allocator<Eigen::Vector2d> > robotVectorTraj;
397 std::vector<double> randomVectorPoint;
402 std::vector<EnvCell*> initHumanRobotReachable;
407 std::vector<EnvCell*> currentHumanRobotReachable;
412 std::pair<double,EnvCell*> robotBestPos;
417 double angleForHumanComming;
424 #endif // HRICS_TWODGRID_HPP
void initAllCellState()
call resetexplorationstatus() in each cell
Definition: HRICS_EnvGrid.cpp:758
void computeDistances(EnvCell *cell, bool isHuman)
using the method of distance propagation to compute distances
Definition: HRICS_EnvGrid.cpp:968
std::vector< EnvCell * > getCrown(double min, double max)
return the crown arround the cell taking the min and max value
Definition: HRICS_EnvGrid.cpp:1364
Plannar HRI Grid.
Definition: HRICS_EnvGrid.hpp:14
void computeHumanDistances(EnvCell *cell)
using the method of distance propagation to compute distances for human
Definition: HRICS_EnvGrid.cpp:786
void resetTraj()
reset the Trajectories computing
Definition: HRICS_EnvGrid.cpp:1348
std::vector< EnvCell * > getNeighbors(bool isHuman)
find the neighbors of this cell (used when computing distance propagation)
Definition: HRICS_EnvGrid.cpp:1297
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
void draw()
drawing the grid
Definition: HRICS_EnvGrid.cpp:499
Definition: TwoDCell.hpp:19
void initAllTrajs()
call resetTrajs() in each cell
Definition: HRICS_EnvGrid.cpp:766
bool computeBestRobotPos()
compute best robot pos
Definition: HRICS_EnvGrid.cpp:1273
void computeHumanRobotReacheability(std::pair< double, double > minMax)
Compute the crown arround the human for reacheability.
Definition: HRICS_EnvGrid.cpp:433
std::vector< std::pair< double, EnvCell * > > getSortedGrid()
sort the cells of the grid
Definition: HRICS_EnvGrid.cpp:441
void setCellsToblankCost()
call setBlankCost() in each cell
Definition: HRICS_EnvGrid.cpp:747
Definition: TwoDGrid.hpp:25
void computeHumanReach()
test if there is a collision with a BB (the cylinders) for the human
Definition: HRICS_EnvGrid.cpp:1180
void initAllReachability()
call resetexplorationstatus() in each cell
Definition: HRICS_EnvGrid.cpp:774
double computeDist(EnvCell *neighCell)
compute distance between two cells
Definition: HRICS_EnvGrid.cpp:1331
API::TwoDCell * createNewCell(unsigned int index, unsigned int x, unsigned int y)
Virtual function that creates a new Cell.
Definition: HRICS_EnvGrid.cpp:484
void recomputeGridWhenHumanMove(Eigen::Vector3d humanPos)
recompute the grid cost if human move
Definition: HRICS_EnvGrid.cpp:376
void computeRobotReach()
test if there is a collision with a BB (the cylinders) for the robot
Definition: HRICS_EnvGrid.cpp:1212
void addPoint(double Rz)
add a point to the random vector in order to draw it (the red arrows)
Definition: HRICS_EnvGrid.cpp:1358
void resetReacheability()
reset the reacheability computing
Definition: HRICS_EnvGrid.cpp:1336
double computeCost()
compute partial cost
Definition: HRICS_EnvGrid.cpp:1243
void computeRobotDistances(EnvCell *cell)
using the method of distance propagation to compute distances for robot
Definition: HRICS_EnvGrid.cpp:883
void initGrid(Eigen::Vector3d humanPos)
initialising the part of the grid needed for fused grid use
Definition: HRICS_EnvGrid.cpp:201
void init(std::pair< double, double > minMax)
initialisation of the grid ( computing distances and taking obstacle into account) ...
Definition: HRICS_EnvGrid.cpp:72
Plannar HRI Cell.
Definition: HRICS_EnvGrid.hpp:175