RobWorkProject  23.9.11-
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
CollisionStrategy Class Referenceabstract

An interface that defines methods to test collision between two objects. More...

#include <CollisionStrategy.hpp>

Inherits ProximityStrategy.

Inherited by ProximityStrategyRW, ProximityStrategyBullet, ProximityStrategyFCL, ProximityStrategyPQP, and ProximityStrategyYaobi.

Classes

struct  Contact
 describes a simple collision contact data structure More...
 
class  Factory
 A factory for a CollisionStrategy. This factory also defines an ExtensionPoint. More...
 

Public Types

enum  QueryType { FirstContact , AllContacts }
 the type of query that is to be performed
 
typedef rw::core::Ptr< CollisionStrategyPtr
 smart pointer type to this class
 
using Result = CollisionResult
 
- Public Types inherited from ProximityStrategy
typedef rw::core::Ptr< ProximityStrategyPtr
 smart pointer type to this class
 

Public Member Functions

virtual ~CollisionStrategy ()
 Destroys object.
 
bool inCollision (const rw::core::Ptr< kinematics::Frame > a, const math::Transform3D< double > &wTa, const rw::core::Ptr< kinematics::Frame > b, const math::Transform3D< double > &wTb, QueryType type=FirstContact)
 Checks to see if two given frames \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are in collision. More...
 
bool inCollision (const rw::core::Ptr< kinematics::Frame > a, const math::Transform3D< double > &wTa, const rw::core::Ptr< kinematics::Frame > b, const math::Transform3D< double > &wTb, class ProximityStrategyData &data, QueryType type=FirstContact)
 Checks to see if two given frames \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are in collision. More...
 
bool inCollision (ProximityModel::Ptr a, const math::Transform3D< double > &wTa, ProximityModel::Ptr b, const math::Transform3D< double > &wTb, ProximityStrategyData &data)
 Checks to see if two proximity models are in collision. More...
 
virtual void getCollisionContacts (std::vector< CollisionStrategy::Contact > &contacts, ProximityStrategyData &data)=0
 this method interprets the collision query result and calculates a list of contacts to represent the collision geometry between the colliding geometries. More...
 
- Public Member Functions inherited from ProximityStrategy
virtual ~ProximityStrategy ()
 Destructor.
 
virtual bool addModel (rw::core::Ptr< rw::models::Object > object)
 Adds a Proximity model of a frame to this strategy. More...
 
virtual bool addModel (const rw::core::Ptr< rw::kinematics::Frame > frame, const rw::geometry::Geometry &faces)
 Adds a Proximity model to a frame where the geometry is copied in the underlying proximity strategy. More...
 
virtual bool addModel (const rw::core::Ptr< rw::kinematics::Frame > frame, rw::core::Ptr< rw::geometry::Geometry > faces, bool forceCopy=false)
 Adds a Proximity model to a frame. More...
 
virtual bool hasModel (const rw::core::Ptr< rw::kinematics::Frame > frame)
 Tells whether the frame has a proximity model in the strategy. More...
 
virtual void clearFrame (const rw::core::Ptr< rw::kinematics::Frame > frame)
 Clear (remove all) model information for frame frame.
 
virtual void clearFrames ()
 Clear (remove all) model information for all frames.
 
ProximityModel::Ptr getModel (const rw::core::Ptr< rw::kinematics::Frame > frame)
 get the proximitymodel associated to frame. If no model has been associated to frame then NULL is returned. More...
 
virtual ProximityModel::Ptr createModel ()=0
 creates an empty ProximityModel
 
virtual void destroyModel (ProximityModel *model)=0
 deallocates the memory used for model More...
 
virtual bool addGeometry (ProximityModel *model, const rw::geometry::Geometry &geom)=0
 adds geometry to a specific proximity model. The proximity strategy copies all data of the geometry. More...
 
virtual bool addGeometry (ProximityModel *model, rw::core::Ptr< rw::geometry::Geometry > geom, bool forceCopy=false)=0
 adds geometry to a specific model. Depending on the option forceCopy the proximity strategy may choose to copy the geometry data or use it directly. More...
 
virtual bool removeGeometry (ProximityModel *model, const std::string &geomId)=0
 removes a geometry from a specific proximity model
 
virtual std::vector< std::string > getGeometryIDs (ProximityModel *model)=0
 the list of all geometry ids that are associated to the proximity model model is returned More...
 
virtual std::vector< rw::core::Ptr< rw::geometry::Geometry > > getGeometries (rw::proximity::ProximityModel *model)=0
 the list of all geometry that are associated to the proximity model model is returned More...
 
 DEPRECATED ("This function is deprecated due to a spelling mistake, use the correct " "spelling \"getGeometries\" instead") std
 
virtual void clear ()=0
 Clears any stored model information.
 
void useThreads (int threads)
 setNumber of threads the strategy may use More...
 

Static Public Member Functions

static CollisionStrategy::Ptr make (rw::core::Ptr< CollisionToleranceStrategy > strategy, double tolerance)
 A collision strategy constructed from a collision tolerance strategy and a resolution. More...
 
static CollisionStrategy::Ptr make (rw::core::Ptr< CollisionToleranceStrategy > strategy, const rw::kinematics::FrameMap< double > &frameToTolerance, double defaultTolerance)
 A collision strategy constructed from a collision tolerance strategy and a resolution. More...
 

Protected Member Functions

virtual bool doInCollision (ProximityModel::Ptr a, const math::Transform3D< double > &wTa, ProximityModel::Ptr b, const math::Transform3D< double > &wTb, ProximityStrategyData &data)=0
 Checks to see if two proximity models are in collision. More...
 
 CollisionStrategy ()
 Creates object.
 
- Protected Member Functions inherited from ProximityStrategy
 ProximityStrategy ()
 Creates object.
 

Additional Inherited Members

- Protected Attributes inherited from ProximityStrategy
size_t _threads
 the number of threads the strategy may use
 

Detailed Description

An interface that defines methods to test collision between two objects.

Member Function Documentation

◆ doInCollision()

virtual bool doInCollision ( ProximityModel::Ptr  a,
const math::Transform3D< double > &  wTa,
ProximityModel::Ptr  b,
const math::Transform3D< double > &  wTb,
ProximityStrategyData data 
)
protectedpure virtual

Checks to see if two proximity models are in collision.

Parameters
a[in] model 1
wTa[in] transform of model a
b[in] model 2
wTb[in] transform of model b
data[in/out] caching and result container
Returns
true if \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are colliding, false otherwise.

◆ getCollisionContacts()

virtual void getCollisionContacts ( std::vector< CollisionStrategy::Contact > &  contacts,
ProximityStrategyData data 
)
pure virtual

this method interprets the collision query result and calculates a list of contacts to represent the collision geometry between the colliding geometries.

Please note that for most collisions a single point and normal is not sufficient to describe the complete collision area. However, it is typically a reasonable approximation. The approximation can hence be implementation specific.

Parameters
contacts[out] list of contacts that can be calculated from data
data[in] the result from the collision query

Implemented in ProximityStrategyYaobi, ProximityStrategyPQP, ProximityStrategyFCL, and ProximityStrategyRW.

◆ inCollision() [1/3]

bool inCollision ( const rw::core::Ptr< kinematics::Frame a,
const math::Transform3D< double > &  wTa,
const rw::core::Ptr< kinematics::Frame b,
const math::Transform3D< double > &  wTb,
class ProximityStrategyData data,
QueryType  type = FirstContact 
)

Checks to see if two given frames \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are in collision.

Parameters
a[in] \( \mathcal{F}_a \)
wTa[in] \( \robabx{w}{a}{\mathbf{T}} \)
b[in] \( \mathcal{F}_b \)
wTb[in] \( \robabx{w}{b}{\mathbf{T}} \)
data[in/out] caching and result container
type[in] collision query type
Returns
true if \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are colliding, false otherwise.

◆ inCollision() [2/3]

bool inCollision ( const rw::core::Ptr< kinematics::Frame a,
const math::Transform3D< double > &  wTa,
const rw::core::Ptr< kinematics::Frame b,
const math::Transform3D< double > &  wTb,
QueryType  type = FirstContact 
)

Checks to see if two given frames \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are in collision.

Parameters
a[in] \( \mathcal{F}_a \)
wTa[in] \( \robabx{w}{a}{\mathbf{T}} \)
b[in] \( \mathcal{F}_b \)
wTb[in] \( \robabx{w}{b}{\mathbf{T}} \)
type[in] collision query type
Returns
true if \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are colliding, false otherwise.

◆ inCollision() [3/3]

bool inCollision ( ProximityModel::Ptr  a,
const math::Transform3D< double > &  wTa,
ProximityModel::Ptr  b,
const math::Transform3D< double > &  wTb,
ProximityStrategyData data 
)

Checks to see if two proximity models are in collision.

Parameters
a[in] model 1
wTa[in] transform of model a
b[in] model 2
wTb[in] transform of model b
data[in/out] caching and result container
Returns
true if \( \mathcal{F}_a \) and \( \mathcal{F}_b \) are colliding, false otherwise.

◆ make() [1/2]

static CollisionStrategy::Ptr make ( rw::core::Ptr< CollisionToleranceStrategy strategy,
const rw::kinematics::FrameMap< double > &  frameToTolerance,
double  defaultTolerance 
)
static

A collision strategy constructed from a collision tolerance strategy and a resolution.

The constructed collision strategy considers a pair of geometries to be in collision if strategy claim they are in collision for a tolerance of tolerance.

◆ make() [2/2]

static CollisionStrategy::Ptr make ( rw::core::Ptr< CollisionToleranceStrategy strategy,
double  tolerance 
)
static

A collision strategy constructed from a collision tolerance strategy and a resolution.

The constructed collision strategy considers a pair of geometries to be in collision if strategy claim they are in collision for a tolerance of tolerance.


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