libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | List of all members
CollisionSpace Class Reference
Inheritance diagram for CollisionSpace:
API::ThreeDGrid API::BaseGrid

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW CollisionSpace (Robot *rob)
 
RobotgetRobot ()
 
int getNbCellsOverX (void)
 
int getNbCellsOverY (void)
 
int getNbCellsOverZ (void)
 
BodySurfaceSamplergetBodySampler ()
 
void init (void)
 
std::vector< CollisionSpaceCell * > getCellListForObject (obj *obj, const Eigen::Affine3d &Trans)
 
std::vector< CollisionSpaceCell * > getOccupiedCells ()
 
void resetOccupationCells ()
 
void updateRobotOccupationCells (Robot *rob)
 
bool areCellsValid (const std::vector< CollisionSpaceCell * > &cells)
 
void unvalidObjectCells (obj *obj)
 
bool collisionCheck ()
 
void addRobotBody (Joint *jnt)
 
void addRobot (Robot *rob)
 
void addAllPointsToField ()
 
double addPointsToField (const std::vector< Eigen::Vector3d > &points)
 
void initNeighborhoods ()
 
int getDirectionNumber (int dx, int dy, int dz) const
 
double getDistanceGradient (const Eigen::Vector3d &point, Eigen::Vector3d &gradient) const
 Computes the finiate differenting gradient.
 
double getDistance (CollisionSpaceCell *cell) const
 
bool getCollisionPointPotentialGradient (const CollisionPoint &collision_point, const Eigen::Vector3d &collision_point_pos, double &distance, double &potential, Eigen::Vector3d &gradient) const
 The distance potential and the gradient is computed for a collision point First the distance d of the collision point (sphere) to the closest obstacle is computed Then 3 cases apear to compute the potential. More...
 
bool isRobotColliding (double &distance) const
 Goes through all points and computes whether the robot is colliding Computes the transform of all point from the joint transform Uses the potential gradient function.
 
void drawSquaredDist ()
 
void drawGradient ()
 
void drawStaticVoxels ()
 Draws a sphere in all voxels the color of the sphere represent the distance to the nearest obstacle.
 
void drawCollisionPoints ()
 
void draw ()
 Draw a openGl view of the grid.
 
- Public Member Functions inherited from API::ThreeDGrid
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ThreeDGrid ()
 Constructor. More...
 
 ThreeDGrid (Eigen::Vector3i size, std::vector< double > envSize)
 
 ThreeDGrid (double samplingRate, std::vector< double > envSize)
 
 ThreeDGrid (const ThreeDGrid &grid)
 Copy.
 
virtual ~ThreeDGrid ()
 Destructor.
 
void createAllCells ()
 Creates All Cells. More...
 
Eigen::Vector3d getCellSize ()
 
unsigned int getXNumberOfCells () const
 
unsigned int getYNumberOfCells () const
 
unsigned int getZNumberOfCells () const
 
ThreeDCellgetCell (unsigned int x, unsigned int y, unsigned int z) const
 Retruns the Cell at (x,y,z) More...
 
ThreeDCellgetCell (Eigen::Vector3i cell) const
 
ThreeDCellgetCell (const Eigen::Vector3d &pos) const
 
ThreeDCellgetCell (double *pos) const
 Get Cell in 3D ThreeDGrid. More...
 
Eigen::Vector3i getCellCoord (ThreeDCell *ptrCell) const
 Get place in grid. More...
 
ThreeDCellgetNeighbour (const Eigen::Vector3i &pos, unsigned int i) const
 Get Neighboor Cell.
 
Eigen::Vector3d getCoordinates (ThreeDCell *cell) const
 Retrive the X Y Z coordinate of the cell from its index.
 
unsigned int getXlineOfCell (unsigned int ith)
 
unsigned int getYlineOfCell (unsigned int ith)
 
unsigned int getZlineOfCell (unsigned int ith)
 
bool writeToXmlFile (std::string file)
 Writes the grid to en xml file.
 
bool loadFromXmlFile (std::string file)
 Reads the grid from an xml file.
 
- Public Member Functions inherited from API::BaseGrid
 BaseGrid (const BaseGrid &grid)
 
BaseCellgetCell (unsigned int i)
 Get Cell. More...
 
unsigned int getNumberOfCells ()
 Get Number Of Cells.
 
virtual std::vector
< Eigen::Vector3d > 
getBox ()
 
std::string getName ()
 

Protected Member Functions

API::ThreeDCellcreateNewCell (unsigned int index, unsigned int x, unsigned int y, unsigned int z)
 Virtual function that creates a new Cell. More...
 
- Protected Member Functions inherited from API::ThreeDGrid
Eigen::Vector3d computeCellCorner (unsigned int x, unsigned int y, unsigned int z)
 Computes the corner of a cell. More...
 

Additional Inherited Members

- Protected Attributes inherited from API::ThreeDGrid
Eigen::Vector3d _originCorner
 
Eigen::Vector3d _cellSize
 
unsigned int _nbCellsX
 
unsigned int _nbCellsY
 
unsigned int _nbCellsZ
 
- Protected Attributes inherited from API::BaseGrid
std::vector< BaseCell * > _cells
 
std::string m_name
 

Member Function Documentation

API::ThreeDCell * CollisionSpace::createNewCell ( unsigned int  index,
unsigned int  x,
unsigned int  y,
unsigned int  z 
)
protectedvirtual

Virtual function that creates a new Cell.

Parameters
integerindex
integerx
integery
integerz

Reimplemented from API::ThreeDGrid.

void CollisionSpace::drawGradient ( )
 Eigen::Vector3d axis = //gradient.cross(unitX).length() > 0 ?  
 gradient.cross(Eigen::Vector3d::UnitX()); // : unitY;
 double angle = -gradient.dot(Eigen::Vector3d::UnitX());

 Eigen::Affine3d t = Eigen::AngleAxisd(angle,axis) * Eigen::Translation3d(point);

 p3d_matrix4 mat;
 for (unsigned int i=0; i<4; i++) {
 for (unsigned int j=0;j<4; j++) {
 mat[i][j] =  t(i,j);

cout << t.matrix() << endl; } } g3d_draw_frame(mat, 0.10);

bool CollisionSpace::getCollisionPointPotentialGradient ( const CollisionPoint collision_point,
const Eigen::Vector3d &  collision_point_pos,
double &  field_distance,
double &  potential,
Eigen::Vector3d &  gradient 
) const

The distance potential and the gradient is computed for a collision point First the distance d of the collision point (sphere) to the closest obstacle is computed Then 3 cases apear to compute the potential.

  • 0 if this distance is greater than the coll point clearance

The documentation for this class was generated from the following files: