RobWorkProject  23.9.11-
Public Types | Public Member Functions | Protected Attributes | List of all members
ContactStrategy Class Referenceabstract

The ContactStrategy is a common interface for different contact strategies. More...

#include <ContactStrategy.hpp>

Inherits ProximityStrategy.

Inherited by BallBallStrategy, ContactStrategyDMS< T >, ContactStrategyGeometry< A, B >, ODEContactStrategy, and BtContactStrategy.

Public Types

typedef rw::core::Ptr< ContactStrategyPtr
 smart pointer type to this class
 
- Public Types inherited from ProximityStrategy
typedef rw::core::Ptr< ProximityStrategyPtr
 smart pointer type to this class
 

Public Member Functions

 ContactStrategy ()
 Create new contact strategy.
 
virtual ~ContactStrategy ()
 Destruct contact strategy.
 
virtual bool match (rw::core::Ptr< const rw::geometry::GeometryData > geoA, rw::core::Ptr< const rw::geometry::GeometryData > geoB)=0
 Test is this strategy can be used for the given geometries. More...
 
virtual std::vector< ContactfindContacts (rw::proximity::ProximityModel::Ptr a, const rw::math::Transform3D<> &wTa, rw::proximity::ProximityModel::Ptr b, const rw::math::Transform3D<> &wTb) const
 Check if there is contact between two contact models. More...
 
virtual std::vector< ContactfindContacts (rw::proximity::ProximityModel::Ptr a, const rw::math::Transform3D<> &wTa, rw::proximity::ProximityModel::Ptr b, const rw::math::Transform3D<> &wTb, ContactStrategyData &data) const
 Check if there is contact between two contact models using additional data. More...
 
virtual std::vector< ContactfindContacts (rw::proximity::ProximityModel::Ptr a, const rw::math::Transform3D<> &wTa, rw::proximity::ProximityModel::Ptr b, const rw::math::Transform3D<> &wTb, ContactStrategyData &data, ContactStrategyTracking &tracking, rwsim::log::SimulatorLogScope *log=NULL) const =0
 Check if there is contact between two contact models using additional data and tracking of contacts. More...
 
virtual std::vector< ContactupdateContacts (rw::proximity::ProximityModel::Ptr a, const rw::math::Transform3D<> &wTa, rw::proximity::ProximityModel::Ptr b, const rw::math::Transform3D<> &wTb, ContactStrategyData &data, ContactStrategyTracking &tracking, rwsim::log::SimulatorLogScope *log=NULL) const =0
 Update known contacts between two contact models. More...
 
virtual std::string getName ()=0
 Get the name of the strategy as a string. More...
 
virtual rw::proximity::ProximityModel::Ptr createModel ()=0
 creates an empty ProximityModel More...
 
virtual void destroyModel (rw::proximity::ProximityModel *model)=0
 deallocates the memory used for model More...
 
virtual bool addGeometry (rw::proximity::ProximityModel *model, const rw::geometry::Geometry &geom)=0
 
virtual bool addGeometry (rw::proximity::ProximityModel *model, rw::core::Ptr< rw::geometry::Geometry > geom, bool forceCopy=false)=0
 
virtual bool removeGeometry (rw::proximity::ProximityModel *model, const std::string &geomId)=0
 removes a geometry from a specific proximity model More...
 
virtual std::vector< std::string > getGeometryIDs (rw::proximity::ProximityModel *model)=0
 the list of all geometry ids that are associated to the proximity model model is returned More...
 
virtual void clear ()=0
 Clears any stored model information. More...
 
virtual rw::core::PropertyMapgetPropertyMap ()
 Get the properties used by the contact strategy. More...
 
virtual const rw::core::PropertyMapgetPropertyMap () const
 Get the properties used by the contact strategy. More...
 
virtual void setPropertyMap (const rw::core::PropertyMap &map)
 Set which properties the contact strategy should use. 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 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
 
void useThreads (int threads)
 setNumber of threads the strategy may use More...
 

Protected Attributes

rw::core::PropertyMap _propertyMap
 Properties for strategy.
 
- Protected Attributes inherited from ProximityStrategy
size_t _threads
 the number of threads the strategy may use
 

Additional Inherited Members

- Protected Member Functions inherited from ProximityStrategy
 ProximityStrategy ()
 Creates object.
 

Detailed Description

The ContactStrategy is a common interface for different contact strategies.

Each contact strategy implements its own contact models, and uses these models to find contacts.

Member Function Documentation

◆ addGeometry() [1/2]

virtual bool addGeometry ( rw::proximity::ProximityModel model,
const rw::geometry::Geometry geom 
)
pure virtual

◆ addGeometry() [2/2]

virtual bool addGeometry ( rw::proximity::ProximityModel model,
rw::core::Ptr< rw::geometry::Geometry geom,
bool  forceCopy = false 
)
pure virtual

◆ clear()

virtual void clear ( )
pure virtual

◆ createModel()

virtual rw::proximity::ProximityModel::Ptr createModel ( )
pure virtual

◆ destroyModel()

virtual void destroyModel ( rw::proximity::ProximityModel model)
pure virtual

deallocates the memory used for model

Parameters
model

Implements ProximityStrategy.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyGeometry< A, B >, ContactStrategyDMS< T >, and BallBallStrategy.

◆ findContacts() [1/3]

virtual std::vector<Contact> findContacts ( rw::proximity::ProximityModel::Ptr  a,
const rw::math::Transform3D<> &  wTa,
rw::proximity::ProximityModel::Ptr  b,
const rw::math::Transform3D<> &  wTb 
) const
virtual

Check if there is contact between two contact models.

Parameters
a[in] model a.
wTa[in] transform of model a.
b[in] model b.
wTb[in] transform of model b.
Returns
a list of contacts.

◆ findContacts() [2/3]

virtual std::vector<Contact> findContacts ( rw::proximity::ProximityModel::Ptr  a,
const rw::math::Transform3D<> &  wTa,
rw::proximity::ProximityModel::Ptr  b,
const rw::math::Transform3D<> &  wTb,
ContactStrategyData data 
) const
virtual

Check if there is contact between two contact models using additional data.

Use of this function is encouraged if changes between consecutive calls are expected to be small. This will in some cases allow the detection algorithm to do certain speed-ups.

Parameters
a[in] model a.
wTa[in] transform of model a.
b[in] model b.
wTb[in] transform of model b.
data[in/out] allows caching between contact detection calls, and makes it possible for detection algorithms to exploit spatial and temporal coherence.
Returns
a list of contacts.

◆ findContacts() [3/3]

virtual std::vector<Contact> findContacts ( rw::proximity::ProximityModel::Ptr  a,
const rw::math::Transform3D<> &  wTa,
rw::proximity::ProximityModel::Ptr  b,
const rw::math::Transform3D<> &  wTb,
ContactStrategyData data,
ContactStrategyTracking tracking,
rwsim::log::SimulatorLogScope log = NULL 
) const
pure virtual

Check if there is contact between two contact models using additional data and tracking of contacts.

Use of this function is encouraged if changes between consecutive calls are expected to be small. This will in some cases allow the detection algorithm to do certain speed-ups.

Parameters
a[in] model a.
wTa[in] transform of model a.
b[in] model b.
wTb[in] transform of model b.
data[in/out] allows caching between contact detection calls, and makes it possible for detection algorithms to exploit spatial and temporal coherence.
tracking[in/out] meta-data for previously found contacts.
log[in/out] (optional) store detailed logging information.
Returns
a list of contacts.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyDMS< T >, and BallBallStrategy.

◆ getGeometryIDs()

virtual std::vector<std::string> getGeometryIDs ( rw::proximity::ProximityModel model)
pure virtual

the list of all geometry ids that are associated to the proximity model model is returned

Parameters
model[in] the model containing the geometries
Returns
all geometry ids associated to the proximity model

Implements ProximityStrategy.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyGeometry< A, B >, ContactStrategyDMS< T >, and BallBallStrategy.

◆ getName()

virtual std::string getName ( )
pure virtual

Get the name of the strategy as a string.

Returns
name of the strategy.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyDMS< T >, and BallBallStrategy.

◆ getPropertyMap() [1/2]

virtual rw::core::PropertyMap& getPropertyMap ( )
virtual

Get the properties used by the contact strategy.

Returns
reference to the property map.

◆ getPropertyMap() [2/2]

virtual const rw::core::PropertyMap& getPropertyMap ( ) const
virtual

Get the properties used by the contact strategy.

Returns
the property map.

◆ match()

virtual bool match ( rw::core::Ptr< const rw::geometry::GeometryData geoA,
rw::core::Ptr< const rw::geometry::GeometryData geoB 
)
pure virtual

Test is this strategy can be used for the given geometries.

Parameters
geoA[in] geometry data for the first object.
geoB[in] geometry data for the second object.
Returns
true if this strategy can be used for the given geometries.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyDMS< T >, and BallBallStrategy.

◆ removeGeometry()

virtual bool removeGeometry ( rw::proximity::ProximityModel model,
const std::string &  geomId 
)
pure virtual

removes a geometry from a specific proximity model

Implements ProximityStrategy.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyGeometry< A, B >, ContactStrategyDMS< T >, and BallBallStrategy.

◆ setPropertyMap()

virtual void setPropertyMap ( const rw::core::PropertyMap map)
virtual

Set which properties the contact strategy should use.

Parameters
map[in] the property map to get properties from.

◆ updateContacts()

virtual std::vector<Contact> updateContacts ( rw::proximity::ProximityModel::Ptr  a,
const rw::math::Transform3D<> &  wTa,
rw::proximity::ProximityModel::Ptr  b,
const rw::math::Transform3D<> &  wTb,
ContactStrategyData data,
ContactStrategyTracking tracking,
rwsim::log::SimulatorLogScope log = NULL 
) const
pure virtual

Update known contacts between two contact models.

Parameters
a[in] model a.
wTa[in] current transform of model a.
b[in] model b.
wTb[in] current transform of model b.
data[in/out] allows caching between contact detection calls, and makes it possible for detection algorithms to exploit spatial and temporal coherence.
tracking[in/out] meta-data for previously found contacts.
log[in/out] (optional) store detailed logging information.
Returns
a list of updated contacts.

Implemented in ODEContactStrategy, BtContactStrategy, ContactStrategyDMS< T >, and BallBallStrategy.


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