RobWorkProject
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
RWPECollisionSolver Class Referenceabstract

Interface for collision solvers that handle bouncing contacts. More...

#include <RWPECollisionSolver.hpp>

Inherited by RWPECollisionSolverChain, RWPECollisionSolverHybrid, RWPECollisionSolverSimultaneous, and RWPECollisionSolverSingle.

Classes

class  Factory
 A factory for a RWPECollisionSolver. This factory also defines an ExtensionPoint. More...
 

Public Types

typedef rw::common::Ptr< const RWPECollisionSolverPtr
 Smart pointer type of RWPECollisionSolver.
 

Public Member Functions

virtual ~RWPECollisionSolver ()
 Destructor.
 
virtual void doCollisions (const std::vector< const RWPEContact *> &contacts, const RWPEBodyConstraintGraph &bc, const RWPEMaterialMap *map, RWPEIslandState &islandState, const rw::kinematics::State &rwstate, const rw::common::PropertyMap &pmap, class RWPELogUtil *log=NULL, rw::common::Ptr< rw::common::ThreadTask > task=NULL) const =0
 Find and apply impulses with origin in given contacts. More...
 
virtual void addDefaultProperties (rw::common::PropertyMap &map) const
 Add the default properties to the given map. More...
 
rw::common::PropertyMap getDefaultMap () const
 Get a new PropertyMap with default properties. More...
 

Static Public Member Functions

static void applyImpulse (const rw::math::Wrench6D<> &impulse, const rw::math::Vector3D<> &position, const RWPEBodyDynamic &body, RWPEIslandState &islandState)
 Apply an impulse at given position to a body. More...
 
static void applyImpulses (const std::vector< rw::math::Wrench6D<> > &impulses, const std::vector< rw::math::Vector3D<> > &positions, const RWPEBodyDynamic &body, RWPEIslandState &islandState)
 Apply multiple impulses to a body. More...
 

Protected Member Functions

 RWPECollisionSolver ()
 Constructor.
 

Detailed Description

Interface for collision solvers that handle bouncing contacts.

Different paradigms exist for collision handling, and this interface defines a high-level abstraction for different solvers that can be used to resolve collisions. The Factory defines a default set of collisions solvers, and allows extension with custom solvers if required.

Please see the Factory class for an overview of available solvers.

Member Function Documentation

◆ addDefaultProperties()

virtual void addDefaultProperties ( rw::common::PropertyMap map) const
virtual

Add the default properties to the given map.

Please look at the documentation for the specific implementations of this function to get information about the required properties for these implementations.

Parameters
map[in/out] the map to add the default properties to.

Reimplemented in RWPECollisionSolverSingle, RWPECollisionSolverSimultaneous, RWPECollisionSolverChain, and RWPECollisionSolverHybrid.

◆ applyImpulse()

static void applyImpulse ( const rw::math::Wrench6D<> &  impulse,
const rw::math::Vector3D<> &  position,
const RWPEBodyDynamic body,
RWPEIslandState islandState 
)
static

Apply an impulse at given position to a body.

This is mostly a convenience function for the RWPECollisionSolver implementations, as impulses will typically be applied the same way once they have been found.

Parameters
impulse[in] the impulse to apply given in world coordinates.
position[in] the position to apply the impulse at in world coordinates.
body[in] the body to apply the impulse for.
islandState[in/out] the current configuration of the system, where the velocity of the given body will be updated.

◆ applyImpulses()

static void applyImpulses ( const std::vector< rw::math::Wrench6D<> > &  impulses,
const std::vector< rw::math::Vector3D<> > &  positions,
const RWPEBodyDynamic body,
RWPEIslandState islandState 
)
static

Apply multiple impulses to a body.

This is mostly a convenience function for the RWPECollisionSolver implementations, as impulses will typically be applied the same way once they have been found.

Parameters
impulses[in] the impulses to apply given in world coordinates.
positions[in] the corresponding positions of where to apply the impulses in world coordinates.
body[in] the body to apply the impulses for.
islandState[in/out] the current configuration of the system, where the velocity of the given body will be updated.

◆ doCollisions()

virtual void doCollisions ( const std::vector< const RWPEContact *> &  contacts,
const RWPEBodyConstraintGraph bc,
const RWPEMaterialMap map,
RWPEIslandState islandState,
const rw::kinematics::State rwstate,
const rw::common::PropertyMap pmap,
class RWPELogUtil log = NULL,
rw::common::Ptr< rw::common::ThreadTask task = NULL 
) const
pure virtual

Find and apply impulses with origin in given contacts.

Resolving the impulses involves the complete graph of contact/constraint-connected bodies. This information is provided by the RWPEBodyConstraintGraph. The state structures makes it possible to get the positions and velocities of bodies and constraints, and allows storing new velocities after they have been changed instantaneously by the applied impulses.

Impulses will origin in the contacts given as input to the function. These contacts are expected to have relative velocities that make them colliding. Restitution models are used to relate the incoming and outgoing relative velocities of the contacts. These will be retrieved from the RWPEMaterialMap.

If there are non-contact constraints between the two objects, impulses are applied in these constraints to make sure that the relative velocity stays zero.

There can be contacts between the two objects besides the colliding contacts given as input. Due to the impulse applied by the colliding contacts (and possibly constraint impulses), the existing contacts might become either leaving or penetrating. An impulse will be applied at these existing contacts if they become penetrating, to make sure that they do not penetrate.

Parameters
contacts[in] the list of initiating colliding contacts.
bc[in] the current graph of bodies connected by constraints (the colliding contact are expected to be included in this graph as well).
map[in] the material map to use to resolve restitution models.
islandState[in/out] the current configuration of the system, where new velocities will be stored.
rwstate[in] the current state.
pmap[in] properties to use - see addDefaultProperties for details.
log[in] (optional) do logging.
task[in] (optional) task to add work to.

Implemented in RWPECollisionSolverSimultaneous, RWPECollisionSolverChain, RWPECollisionSolverSingle, and RWPECollisionSolverHybrid.

◆ getDefaultMap()

rw::common::PropertyMap getDefaultMap ( ) const

Get a new PropertyMap with default properties.

Returns
PropertyMap with all default properties.

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