libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
HRICS_Distance.hpp
1 #ifndef HRIDISTANCE_H
2 #define HRIDISTANCE_H
3 
4 /*
5  * Distance.h
6  *
7  *
8  * Created by Jim Mainprice on 05/12/09.
9  * Copyright 2009 mainprice@gmail.com All rights reserved.
10  *
11  */
12 
13 #include "API/planningAPI.hpp"
14 
18 namespace HRICS
19 {
20  class Distance
21  {
22  // EIGEN_MAKE_ALIGNED_OPERATOR_NEW
23 
24  public:
25  Distance();
26  Distance(Robot* rob, std::vector<Robot*> humans);
27 
28  ~Distance();
29 
30  void drawZones();
31  void parseHumans();
32  double getDistance();
33  void offSetPrim(p3d_poly* poly,double offset);
34 
36  void activateNormalMode();
37 
38  double computeCost(double distance);
39  double getWorkspaceCost(const Eigen::Vector3d& WSPoint);
40 
41  std::vector<double> getDistToZones();
42  std::vector<double> getVectorJim() {return vect_jim; }
43 
44  void setVector( std::vector<double> toDrawVector ) { vect_jim = toDrawVector; }
45 
46  double computeBBDist(p3d_vector3 robot, p3d_vector3 human);
47 
48  bool computeCylinderZone(Eigen::Vector3d &p1, Eigen::Vector3d& p2);
49 
50  double pointToLineSegmentDistance(const Eigen::Vector3d& p,
51  const Eigen::Vector3d& p1,
52  const Eigen::Vector3d& p2,
53  Eigen::Vector3d& closestPoint);
54 
55  double computeBoundingBalls(const Eigen::Vector3d& WSPoint, p3d_vector3 robot, p3d_vector3 human);
56 
57  Eigen::Vector3d getColsestPointToHuman() { return mClosestPointToHuman; }
58 
59  void setSafeRadius(double radius) { _SafeRadius = radius; }
60 
61  void drawInteractionZone();
62 
63  int isPointInInteractionZone(const Eigen::Vector3d& WSPoint);
64 
65 
66  private:
67  Robot* m_Robot;
68  std::vector<Robot*> _Humans;
69  std::vector< std::vector<int> > _SafetyZonesBodyId;
70  std::vector<double> _PenetrationDist;
71  std::vector<double> vect_jim;
72  double _SafeOffset;
73  double _SafeRadius;
74  double m_InteractionRadius;
75 
76  enum Computation
77  {
78  Balls,
79  Boxes,
80  Full,
81  } m_Method;
82 
83  Eigen::Vector3d mClosestPointToHuman;
84  };
85 }
86 
87 #endif
double pointToLineSegmentDistance(const Eigen::Vector3d &p, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2, Eigen::Vector3d &closestPoint)
Computes the closest point of a point to a segment line.
Definition: HRICS_Distance.cpp:706
void parseHumans()
Goes through the Human (p3d_rob) structure to find the safety zones.
Definition: HRICS_Distance.cpp:103
void activateSafetyZonesMode()
Changes the collision context to compute distance only to the pritimives that represent the human...
Definition: HRICS_Distance.cpp:271
This class holds a the robot represented by a kinematic chain.
Definition: robot.hpp:42
double computeBBDist(p3d_vector3 robot, p3d_vector3 human)
Bounding Box Distance.
Definition: HRICS_Distance.cpp:536
void activateNormalMode()
Changes the collision context to compute the CD with the finer representation of the Human...
Definition: HRICS_Distance.cpp:301
Distance()
Constructor that sets the Human and Robot structures.
Definition: HRICS_Distance.cpp:26
double computeBoundingBalls(const Eigen::Vector3d &WSPoint, p3d_vector3 robot, p3d_vector3 human)
Bounding Balls Distance computes the distance to a line and a sphere The Line is the body and the sph...
Definition: HRICS_Distance.cpp:747
bool computeCylinderZone(Eigen::Vector3d &p1, Eigen::Vector3d &p2)
Computes the cylinder associated with the human (body)
Definition: HRICS_Distance.cpp:642
double getWorkspaceCost(const Eigen::Vector3d &WSPoint)
Get Workspace Cost.
Definition: HRICS_Distance.cpp:371
Definition: HRICS_Distance.hpp:20
void offSetPrim(p3d_poly *poly, double offset)
Changes dynamically the size of the zone shown in the OpenGl display.
Definition: HRICS_Distance.cpp:213
~Distance()
Destructor sets back the safety radius.
Definition: HRICS_Distance.cpp:63
std::vector< double > getDistToZones()
Main function computing the distance between the Human and the Robot.
Definition: HRICS_Distance.cpp:385