cd.h File Reference

Detailed Description

Headers and definitions of the interface with the collision detection engine.

See Also
cd.c

Definition in file cd.h.

Data Structures

struct  TCollisionInfo
 Information on the detected collisions. More...
 
struct  TsolidObj
 Information of each object. More...
 
struct  TsolidCD
 Information associated with the solid collision detection engine. More...
 
struct  TvcollideCD
 Information associated with the Vcollide collision detection engine. More...
 
struct  TpqpCD
 Information associated with the PQP collision detection engine. More...
 
struct  TworldCD
 Auxiliary data for the collision detection. More...
 

Functions

void InitCD (unsigned int engine, boolean parallel, Tmechanism *m, Tenvironment *e, boolean **checkCollisionsLL, boolean **checkCollisionsLO, TworldCD *cd)
 Initializes the collision detector. More...
 
boolean LinkCanCollide (unsigned int l, unsigned int nl, unsigned int no, boolean **checkCollisionsLL, boolean **checkCollisionsLO)
 Identifies links than can collide. More...
 
boolean ObstacleCanCollide (unsigned int o, unsigned int nl, boolean **checkCollisionsLO)
 Identifies obstacles than can collide. More...
 
unsigned int GetCDEngine (TworldCD *cd)
 Determines the collision engine. More...
 
boolean CheckCollision (boolean all, THTransform *tl, TLinkConf *def, THTransform *tlPrev, TLinkConf *defPrev, TworldCD *cd)
 Determines if there is a collision. More...
 
void StoreCollisionInfo (FILE *f, char *fname, unsigned int objectID, Tmechanism *m, TworldCD *cd)
 Stores the information collected during last collision check into a file. More...
 
void PrintCollisionInfo (THTransform *tl, Tmechanism *m, Tenvironment *e, TworldCD *cd)
 Prints some information collected during last collision check. More...
 
void DeleteCD (TworldCD *cd)
 Collision information destructor. More...
 

Function Documentation

void InitCD ( unsigned int  engine,
boolean  parallel,
Tmechanism m,
Tenvironment e,
boolean **  checkCollisionsLL,
boolean **  checkCollisionsLO,
TworldCD cd 
)

Initializes the collision detector.

Parameters
engineThe engine to use
parallelTRUE if we are in a contex of parallel execution, where different collision queries can be executed in parallel.
mThe machanism.
eThe enviroment.
checkCollisionsLLLink-link collision to be checked.
checkCollisionsLOLink-obstacle collision to be checked.
cdThe collision information to define.

Definition at line 2135 of file cd.c.

References BULLET, TworldCD::bullet, C_BULLET, C_FCL, TworldCD::engine, Error(), FCL, TworldCD::fcl, InitPQPCD(), InitSolidCD(), InitVcollideCD(), NEW, NOCD, PQP, TworldCD::pqp, RIGIDCLL, TworldCD::rigidCLL, SOLID, TworldCD::solid, VCOLLIDE, and TworldCD::vcollide.

Referenced by InitWorldCD().

boolean LinkCanCollide ( unsigned int  l,
unsigned int  nl,
unsigned int  no,
boolean **  checkCollisionsLL,
boolean **  checkCollisionsLO 
)

Identifies links that can collide either with other links or with obstacles.

Parameters
lThe identifier of the link to check.
nlNumber of links.
noNumber of obstacles.
checkCollisionsLLAllowed collisions between links.
checkCollisionsLOAllowed collisions between links and obstacles.
Returns
TRUE if the link collision is activated with respect to any other link or obstacle.

Definition at line 2218 of file cd.c.

References FALSE.

Referenced by AnyCollision(), InitPQPCD(), InitSolidCD(), and InitVcollideCD().

boolean ObstacleCanCollide ( unsigned int  o,
unsigned int  nl,
boolean **  checkCollisionsLO 
)

Identifies obstacles that can collide a given link..

Parameters
oThe identifier of the obstacle to check.
nlNumber of obstacles.
checkCollisionsLOAllowed collisions between links and obstacles.
Returns
TRUE if the obstacle collision is activated with respect to any link.

Definition at line 2240 of file cd.c.

References FALSE.

Referenced by InitPQPCD(), InitSolidCD(), and InitVcollideCD().

unsigned int GetCDEngine ( TworldCD cd)

Determines the collision library used.

Parameters
cdThe collision information to query.
Returns
The identifier of the collision detection library in use.

Definition at line 2255 of file cd.c.

References TworldCD::engine.

Referenced by MoveAndCheckCD(), and WorldContinuousCD().

boolean CheckCollision ( boolean  all,
THTransform tl,
TLinkConf def,
THTransform tlPrev,
TLinkConf defPrev,
TworldCD cd 
)

Determines if there is a collision.

Parameters
allTRUE if we want to detect all the collision. FALSE just to detect the first one. Right now this flag is only honored when using the Solid or the FCL collision libraries. The rest only detect the first collision and stop irrespectively of the value of this paramater.
tlThe transforms to apply to the links.
defDeformation parameter. IMPORTANT: Up to now SOLID is the only collision detection engine that uses the deformation.
tlPrevThe transforms to apply to the links in the previous configuration. Only used for the continuous collision checker (C_FCL). The rest of collision detection libraries are discrete and ignore this parameter.
defPrevDeformation parameter in the previous configuration.
cdThe collision information to use in the check.
Todo:
Implement link deformation in CD engines other than SOLID.
Returns
TRUE if there is a collision.

Definition at line 2260 of file cd.c.

References BULLET, TworldCD::bullet, C_BULLET, C_FCL, CheckCollisionPQP(), CheckCollisionSolid(), CheckCollisionVcollide(), TworldCD::engine, Error(), FALSE, FCL, TworldCD::fcl, NOCD, PQP, TworldCD::pqp, RIGIDCLL, TworldCD::rigidCLL, SOLID, TworldCD::solid, VCOLLIDE, and TworldCD::vcollide.

Referenced by MoveAndCheckCDFromTransforms().

void StoreCollisionInfo ( FILE *  f,
char *  fname,
unsigned int  objectID,
Tmechanism m,
TworldCD cd 
)

Stores information collected during last collision check into a file. This is only used from the cuikmove application, when using the "save" option. The information to be stored is collected during the collision detection and latter compleated in a call to PrintCollisionInfo. In other words, this function can only be used after detecting a collision and after calling PrintCollisionInfo. The cuikmove alrady coordinates these steps: it first uses MoveWorldDOF and if the user press the "Save" button, it then calls this function.

Up to now this only works for the SOLID collision engine.

See StoreCollisionInfoInt for more deatils.

Parameters
fFile where to write the collision script.
fnameFile from where we obtained the world information. The last part of the filename (from the last '_' to the end) is assumed to be the name of the object. This name is the one used to call the sub-matlab scripts giving contact points and normals on the object.
objectIDIdentifier of the object being manipulated. This is assumed to be a link. Use NO_UINT to print all the information without any filtering.
mThe mechanism description.
cdThe collision information.

Definition at line 2346 of file cd.c.

References BULLET, TworldCD::bullet, TsolidCD::collision, TworldCD::engine, Error(), FCL, TworldCD::fcl, TsolidCD::nc, SOLID, TworldCD::solid, and StoreCollisionInfoInt().

Referenced by PrintWorldCollisionInfo().

void PrintCollisionInfo ( THTransform tl,
Tmechanism m,
Tenvironment e,
TworldCD cd 
)

Prints some information collected during last collision check.

Up to now this only works for the SOLID collision engine.

This is used when obtain contact information while interactively moving the robots.

Parameters
tlThe transforms positioning the links.
mThe mechanism description.
eThe environment description.
cdThe collision information.

Definition at line 2374 of file cd.c.

References BULLET, TworldCD::bullet, TsolidCD::collision, TworldCD::engine, Error(), FCL, TworldCD::fcl, TsolidCD::nc, PrintCollisionInfoInt(), SOLID, and TworldCD::solid.

Referenced by MoveAndCheckCDFromTransforms().

void DeleteCD ( TworldCD cd)

Releases the structures used for collision detection.

Parameters
cdThe collision detection information to be released.

Definition at line 2403 of file cd.c.

References BULLET, TworldCD::bullet, C_BULLET, C_FCL, DeletePQPCD(), DeleteSolidCD(), DeleteVcollideCD(), TworldCD::engine, Error(), FCL, TworldCD::fcl, NOCD, PQP, TworldCD::pqp, RIGIDCLL, TworldCD::rigidCLL, SOLID, TworldCD::solid, VCOLLIDE, and TworldCD::vcollide.

Referenced by DeleteWorldCD(), and InitWorldCD().