Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimTK::GeneralContactSubsystem Class Reference

This class performs collision detection for use in contact modeling. More...

#include <GeneralContactSubsystem.h>

+ Inheritance diagram for SimTK::GeneralContactSubsystem:

Public Member Functions

 GeneralContactSubsystem ()
 
 GeneralContactSubsystem (MultibodySystem &)
 
ContactSetIndex createContactSet ()
 Create a new contact set. More...
 
int getNumContactSets () const
 Get the total number of contact sets that have been created. More...
 
void addBody (ContactSetIndex index, const MobilizedBody &body, const ContactGeometry &geom, Transform transform)
 Add a body to a contact set. More...
 
int getNumBodies (ContactSetIndex set) const
 Get the number of bodies in a contact set. More...
 
const MobilizedBodygetBody (ContactSetIndex set, ContactSurfaceIndex index) const
 Get the MobilizedBody in whose reference frame a body is defined. More...
 
const ContactGeometrygetBodyGeometry (ContactSetIndex set, ContactSurfaceIndex index) const
 Get the ContactGeometry which defines the shape of a body. More...
 
ContactGeometryupdBodyGeometry (ContactSetIndex set, ContactSurfaceIndex index)
 Get a mutable reference to the ContactGeometry which defines the shape of a body. More...
 
const TransformgetBodyTransform (ContactSetIndex set, ContactSurfaceIndex index) const
 Get the location and orientation of a body. More...
 
TransformupdBodyTransform (ContactSetIndex set, ContactSurfaceIndex index)
 Get a mutable reference to the location and orientation of a body. More...
 
const Array_< Contact > & getContacts (const State &state, ContactSetIndex set) const
 Get a list of all contacts between bodies in a contact set. More...
 
 SimTK_PIMPL_DOWNCAST (GeneralContactSubsystem, Subsystem)
 
- Public Member Functions inherited from SimTK::Subsystem
 Subsystem ()
 
 Subsystem (const Subsystem &)
 
Subsystemoperator= (const Subsystem &)
 
 ~Subsystem ()
 
const StringgetName () const
 
const StringgetVersion () const
 
QIndex allocateQ (State &, const Vector &qInit) const
 
UIndex allocateU (State &, const Vector &uInit) const
 
ZIndex allocateZ (State &, const Vector &zInit) const
 
DiscreteVariableIndex allocateDiscreteVariable (State &, Stage invalidates, AbstractValue *v) const
 
DiscreteVariableIndex allocateAutoUpdateDiscreteVariable (State &, Stage invalidates, AbstractValue *v, Stage updateDependsOn) const
 
CacheEntryIndex allocateCacheEntry (const State &, Stage dependsOn, Stage computedBy, AbstractValue *v) const
 
CacheEntryIndex allocateCacheEntry (const State &state, Stage g, AbstractValue *v) const
 
CacheEntryIndex allocateLazyCacheEntry (const State &state, Stage earliest, AbstractValue *v) const
 
QErrIndex allocateQErr (const State &, int nqerr) const
 
UErrIndex allocateUErr (const State &, int nuerr) const
 
UDotErrIndex allocateUDotErr (const State &, int nudoterr) const
 
EventTriggerByStageIndex allocateEventTriggersByStage (const State &, Stage, int ntriggers) const
 
const VectorgetQ (const State &) const
 
const VectorgetU (const State &) const
 
const VectorgetZ (const State &) const
 
const VectorgetQDot (const State &) const
 
const VectorgetUDot (const State &) const
 
const VectorgetZDot (const State &) const
 
const VectorgetQDotDot (const State &) const
 
const VectorgetQErr (const State &) const
 
const VectorgetUErr (const State &) const
 
const VectorgetUDotErr (const State &) const
 
const VectorgetMultipliers (const State &) const
 
const VectorgetEventTriggersByStage (const State &, Stage) const
 
VectorupdQ (State &) const
 
VectorupdU (State &) const
 
VectorupdZ (State &) const
 
void setQ (State &s, const Vector &q) const
 
void setU (State &s, const Vector &u) const
 
void setZ (State &s, const Vector &z) const
 
VectorupdQDot (const State &) const
 
VectorupdUDot (const State &) const
 
VectorupdZDot (const State &) const
 
VectorupdQDotDot (const State &) const
 
VectorupdQErr (const State &) const
 
VectorupdUErr (const State &) const
 
VectorupdUDotErr (const State &) const
 
VectorupdMultipliers (const State &) const
 
VectorupdEventTriggersByStage (const State &, Stage) const
 
Stage getStage (const State &) const
 
const AbstractValuegetDiscreteVariable (const State &s, DiscreteVariableIndex dx) const
 
Real getDiscreteVarLastUpdateTime (const State &s, DiscreteVariableIndex dx) const
 
CacheEntryIndex getDiscreteVarUpdateIndex (const State &s, DiscreteVariableIndex dx) const
 
const AbstractValuegetDiscreteVarUpdateValue (const State &s, DiscreteVariableIndex dx) const
 
AbstractValueupdDiscreteVarUpdateValue (const State &s, DiscreteVariableIndex dx) const
 
bool isDiscreteVarUpdateValueRealized (const State &s, DiscreteVariableIndex dx) const
 
void markDiscreteVarUpdateValueRealized (const State &s, DiscreteVariableIndex dx) const
 
AbstractValueupdDiscreteVariable (State &, DiscreteVariableIndex) const
 
const AbstractValuegetCacheEntry (const State &, CacheEntryIndex) const
 
AbstractValueupdCacheEntry (const State &, CacheEntryIndex) const
 
bool isCacheValueRealized (const State &, CacheEntryIndex) const
 
void markCacheValueRealized (const State &, CacheEntryIndex) const
 
void markCacheValueNotRealized (const State &, CacheEntryIndex) const
 
SystemQIndex getQStart (const State &) const
 
int getNQ (const State &) const
 
SystemUIndex getUStart (const State &) const
 
int getNU (const State &) const
 
SystemZIndex getZStart (const State &) const
 
int getNZ (const State &) const
 
SystemQErrIndex getQErrStart (const State &) const
 
int getNQErr (const State &) const
 
SystemUErrIndex getUErrStart (const State &) const
 
int getNUErr (const State &) const
 
SystemUDotErrIndex getUDotErrStart (const State &) const
 
int getNUDotErr (const State &) const
 
SystemMultiplierIndex getMultipliersStart (const State &) const
 
int getNMultipliers (const State &) const
 
SystemEventTriggerByStageIndex getEventTriggerStartByStage (const State &, Stage) const
 
int getNEventTriggersByStage (const State &, Stage) const
 
bool isInSystem () const
 
bool isInSameSystem (const Subsystem &otherSubsystem) const
 
const SystemgetSystem () const
 
SystemupdSystem ()
 
SubsystemIndex getMySubsystemIndex () const
 
bool isOwnerHandle () const
 
bool isEmptyHandle () const
 
bool isSameSubsystem (const Subsystem &otherSubsystem) const
 
bool subsystemTopologyHasBeenRealized () const
 
void invalidateSubsystemTopologyCache () const
 
MeasureIndex adoptMeasure (AbstractMeasure &)
 
AbstractMeasure getMeasure (MeasureIndex) const
 
template<class T >
Measure_< T > getMeasure_ (MeasureIndex mx) const
 
const Subsystem::GutsgetSubsystemGuts () const
 
Subsystem::GutsupdSubsystemGuts ()
 
void adoptSubsystemGuts (Subsystem::Guts *g)
 
void setSystem (System &, SubsystemIndex)
 
 Subsystem (Subsystem::Guts *g)
 
bool hasGuts () const
 

Detailed Description

This class performs collision detection for use in contact modeling.

It manages sets of bodies that can potentially interact with each other. At each time step, it identifies all the contacts between them. It does not directly affect the behavior of the system in any way. Instead, it simply provides a service that can be used by other classes to implement forces, events, contraints, etc. that are based on contacts between bodies.

To use this class, first create a "contact set" by calling createContactSet(). A contact set is a group of bodies which can interact with each other. If you create multiple contact sets, the bodies within each one will be checked for contacts with each other, but bodies in different sets will not interact.

Next, add bodies to the contact set. Each one is represented by a ContactGeometry object that describes its shape, the MoblizedBody it is attached to, and a Transform giving the location of the geometry in the MobilizedBody's reference frame.

Finally, call getContacts() to get a list of all contacts which exist between bodies in a contact set. Each Contact specifies two bodies that overlap, along with a description of the contact point, such as its location and normal vector.

Constructor & Destructor Documentation

SimTK::GeneralContactSubsystem::GeneralContactSubsystem ( )
SimTK::GeneralContactSubsystem::GeneralContactSubsystem ( MultibodySystem )
explicit

Member Function Documentation

ContactSetIndex SimTK::GeneralContactSubsystem::createContactSet ( )

Create a new contact set.

The return value is an index which can be used to refer to the contact set when calling other methods.

int SimTK::GeneralContactSubsystem::getNumContactSets ( ) const

Get the total number of contact sets that have been created.

void SimTK::GeneralContactSubsystem::addBody ( ContactSetIndex  index,
const MobilizedBody body,
const ContactGeometry geom,
Transform  transform 
)

Add a body to a contact set.

Parameters
indexthe index of the contact set the body should be added to
bodythe MobilizedBody whose reference frame the body is attached to
geoma ContactGeometry describing the shape of the body
transformthe location and orientation of the ContactGeometry in the MobilizedBody's reference frame
int SimTK::GeneralContactSubsystem::getNumBodies ( ContactSetIndex  set) const

Get the number of bodies in a contact set.

const MobilizedBody& SimTK::GeneralContactSubsystem::getBody ( ContactSetIndex  set,
ContactSurfaceIndex  index 
) const

Get the MobilizedBody in whose reference frame a body is defined.

Parameters
setthe contact set the body belongs to
indexthe index of the body within the contact set
const ContactGeometry& SimTK::GeneralContactSubsystem::getBodyGeometry ( ContactSetIndex  set,
ContactSurfaceIndex  index 
) const

Get the ContactGeometry which defines the shape of a body.

Parameters
setthe contact set the body belongs to
indexthe index of the body within the contact set
ContactGeometry& SimTK::GeneralContactSubsystem::updBodyGeometry ( ContactSetIndex  set,
ContactSurfaceIndex  index 
)

Get a mutable reference to the ContactGeometry which defines the shape of a body.

Parameters
setthe contact set the body belongs to
indexthe index of the body within the contact set
const Transform& SimTK::GeneralContactSubsystem::getBodyTransform ( ContactSetIndex  set,
ContactSurfaceIndex  index 
) const

Get the location and orientation of a body.

Parameters
setthe contact set the body belongs to
indexthe index of the body within the contact set
Transform& SimTK::GeneralContactSubsystem::updBodyTransform ( ContactSetIndex  set,
ContactSurfaceIndex  index 
)

Get a mutable reference to the location and orientation of a body.

Parameters
setthe contact set the body belongs to
indexthe index of the body within the contact set
const Array_<Contact>& SimTK::GeneralContactSubsystem::getContacts ( const State state,
ContactSetIndex  set 
) const

Get a list of all contacts between bodies in a contact set.

Contacts are calculated at Dynamics stage, so the state must have been realized to at least Dynamics stage. This subsystem is guaranteed to be realized before all ForceSubsystems, however, so a Force may still invoke it to calculate forces based on contacts.

SimTK::GeneralContactSubsystem::SimTK_PIMPL_DOWNCAST ( GeneralContactSubsystem  ,
Subsystem   
)

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