Simbody
|
This is a force subsystem that implements a compliant contact model to respond to Contact objects as detected by a ContactTrackerSubsystem. More...
#include <CompliantContactSubsystem.h>
Public Member Functions | |
CompliantContactSubsystem () | |
Default constructor creates an empty handle. | |
CompliantContactSubsystem (MultibodySystem &, const ContactTrackerSubsystem &) | |
Add a new CompliantContactSubsystem to the indicated MultibodySystem, specifying the ContactTrackerSubsystem that we will use to obtain the list of ActiveContacts from which we will generate compliant forces. | |
Real | getTransitionVelocity () const |
Get the transition velocity (vt) of the friction model. | |
void | setTransitionVelocity (Real vt) |
Set the transition velocity (vt) of the friction model. | |
Real | getOOTransitionVelocity () const |
Get a precalculated 1/vt to avoid expensive runtime divisions. | |
int | getNumContactForces (const State &state) const |
Determine how many of the active Contacts are currently generating contact forces. | |
const ContactForce & | getContactForce (const State &state, int n) const |
For each active Contact, get a reference to the most recently calculated force there; the ContactId that produced this force is available from the referenced ContactForce object. | |
const ContactForce & | getContactForceById (const State &state, ContactId id) const |
Get a reference to the ContactForce currently being produced by a particular ContactId; if that Contact is not currently producing forces then a reference to an invalid ContactForce is returned (you can check with isValid()). | |
bool | calcContactPatchDetailsById (const State &state, ContactId id, ContactPatch &patch) const |
Calculate detailed information about a particular active contact patch, including deformed geometric information, pressure and friction force distribution, and resultant forces and moments. | |
Real | getDissipatedEnergy (const State &state) const |
Obtain the total amount of energy dissipated by all the contact responses that were generated by this subsystem since some arbitrary starting point. | |
void | setDissipatedEnergy (State &state, Real energy) const |
Set the accumulated dissipated energy to an arbitrary value. | |
void | adoptForceGenerator (ContactForceGenerator *generator) |
Attach a new generator to this subsystem as the responder to be used when we see the kind of Contact type for which this generator is defined, replacing the previous generator for this Contact type if there was one. | |
void | adoptDefaultForceGenerator (ContactForceGenerator *generator) |
Attach a new generator to this subsystem as the responder to be used when we see a Contact type for which no suitable generator has been defined, replacing the previous default generator type if there was one. | |
bool | hasForceGenerator (ContactTypeId contact) const |
Return true if this subsystem has a force generator registered that can respond to this kind of Contact. | |
bool | hasDefaultForceGenerator () const |
Return true if this subsystem has a force generator registered that can be used for response to an unrecognized type of Contact (typically this will be a "do nothing" or "throw an error" generator. | |
const ContactForceGenerator & | getContactForceGenerator (ContactTypeId contact) const |
Return the force generator to be used for a Contact of the indicated type. | |
const ContactForceGenerator & | getDefaultForceGenerator () const |
Return the force generator to be used for a Contact type for which no suitable force generator has been registered. | |
const ContactTrackerSubsystem & | getContactTrackerSubsystem () const |
Get a read-only reference to the ContactTrackerSubsystem associated with this CompliantContactSubsystem. | |
const MultibodySystem & | getMultibodySystem () const |
Every Subsystem is owned by a System; a CompliantContactSubsystem expects to be owned by a MultibodySystem. |
This is a force subsystem that implements a compliant contact model to respond to Contact objects as detected by a ContactTrackerSubsystem.
The subsystem contains an extendable collection of ContactForceGenerator objects, one per type of Contact. For example, a point contact would be handled by a different force generator than would a mesh contact.
SimTK::CompliantContactSubsystem::CompliantContactSubsystem | ( | ) | [inline] |
Default constructor creates an empty handle.
SimTK::CompliantContactSubsystem::CompliantContactSubsystem | ( | MultibodySystem & | , |
const ContactTrackerSubsystem & | |||
) |
Add a new CompliantContactSubsystem to the indicated MultibodySystem, specifying the ContactTrackerSubsystem that we will use to obtain the list of ActiveContacts from which we will generate compliant forces.
The MultibodySystem takes over ownership of the new subsystem object, but the handle we construct here retains a reference to it.
Real SimTK::CompliantContactSubsystem::getTransitionVelocity | ( | ) | const |
Get the transition velocity (vt) of the friction model.
void SimTK::CompliantContactSubsystem::setTransitionVelocity | ( | Real | vt | ) |
Set the transition velocity (vt) of the friction model.
Real SimTK::CompliantContactSubsystem::getOOTransitionVelocity | ( | ) | const |
Get a precalculated 1/vt to avoid expensive runtime divisions.
int SimTK::CompliantContactSubsystem::getNumContactForces | ( | const State & | state | ) | const |
Determine how many of the active Contacts are currently generating contact forces.
You can call this at Velocity stage or later; the contact forces will be realized first if necessary before we report how many there are.
const ContactForce& SimTK::CompliantContactSubsystem::getContactForce | ( | const State & | state, |
int | n | ||
) | const |
For each active Contact, get a reference to the most recently calculated force there; the ContactId that produced this force is available from the referenced ContactForce object.
The ContactForce object is measured and expressed in the Ground frame. You can request this response at Velocity stage or later; the contact forces will be realized first if necessary.
const ContactForce& SimTK::CompliantContactSubsystem::getContactForceById | ( | const State & | state, |
ContactId | id | ||
) | const |
Get a reference to the ContactForce currently being produced by a particular ContactId; if that Contact is not currently producing forces then a reference to an invalid ContactForce is returned (you can check with isValid()).
The ContactForce object is measured and expressed in the Ground frame. You can call this at Velocity stage or later; the contact forces (not just this one) will be realized first if necessary.
bool SimTK::CompliantContactSubsystem::calcContactPatchDetailsById | ( | const State & | state, |
ContactId | id, | ||
ContactPatch & | patch | ||
) | const |
Calculate detailed information about a particular active contact patch, including deformed geometric information, pressure and friction force distribution, and resultant forces and moments.
This detailed information is only calculated when requested because it may be expensive for some ContactForceGenerators; for simulation purposes only the resultants are needed. Resultant forces may be obtained cheaply by calling getContactForceById(); don't call this method unless you really need these details. The returned information will overwrite anything that is already in the supplied ContactPatch object; the contact point and vectors are expressed in Ground. You can call this operator at Velocity stage or higher. The result is calculated here and not saved internally.
[in] | state | The state from whose active contacts we are selecting. |
[in] | id | The ContactId of the Contact whose patch details are to be returned. This refers to a Contact within the ContactTrackerSubsystem associated with this ContactForceSubsystem. |
[out] | patch | The object that will be overwritten with the result or set invalid if the given ContactId is not currently producing a patch. Results are returned in the Ground frame. |
Real SimTK::CompliantContactSubsystem::getDissipatedEnergy | ( | const State & | state | ) | const |
Obtain the total amount of energy dissipated by all the contact responses that were generated by this subsystem since some arbitrary starting point.
This is the time integral of all the power dissipated during any of the contacts by material dissipative and friction forces. For a system whose only non-conservative forces are contacts, the sum of potential, kinetic, and dissipated energies should be conserved with an exception noted below. This is particularly useful for debugging new ContactForceGenerators. This is a State variable so you can obtain its value any time after it is allocated.
[in] | state | The State from which to obtain the current value of the dissipated energy. |
void SimTK::CompliantContactSubsystem::setDissipatedEnergy | ( | State & | state, |
Real | energy | ||
) | const |
Set the accumulated dissipated energy to an arbitrary value.
Typically this is used only to reset the dissipated energy to zero, but non-zero values can be useful if you are trying to match some existing data or continuing a simulation. This is a State variable so you can set its value any time after it is allocated.
[in,out] | state | The State whose dissipated energy variable for this subsystem is to be modified. |
[in] | energy | The new value for the accumulated dissipated energy (must be a nonnegative scalar). |
void SimTK::CompliantContactSubsystem::adoptForceGenerator | ( | ContactForceGenerator * | generator | ) |
void SimTK::CompliantContactSubsystem::adoptDefaultForceGenerator | ( | ContactForceGenerator * | generator | ) |
Attach a new generator to this subsystem as the responder to be used when we see a Contact type for which no suitable generator has been defined, replacing the previous default generator type if there was one.
The subsystem takes over ownership of the generator; don't delete it yourself.
bool SimTK::CompliantContactSubsystem::hasForceGenerator | ( | ContactTypeId | contact | ) | const |
Return true if this subsystem has a force generator registered that can respond to this kind of Contact.
bool SimTK::CompliantContactSubsystem::hasDefaultForceGenerator | ( | ) | const |
Return true if this subsystem has a force generator registered that can be used for response to an unrecognized type of Contact (typically this will be a "do nothing" or "throw an error" generator.
const ContactForceGenerator& SimTK::CompliantContactSubsystem::getContactForceGenerator | ( | ContactTypeId | contact | ) | const |
Return the force generator to be used for a Contact of the indicated type.
If no generator was registered for this type of contact, this will be the default generator.
const ContactForceGenerator& SimTK::CompliantContactSubsystem::getDefaultForceGenerator | ( | ) | const |
Return the force generator to be used for a Contact type for which no suitable force generator has been registered.
const ContactTrackerSubsystem& SimTK::CompliantContactSubsystem::getContactTrackerSubsystem | ( | ) | const |
Get a read-only reference to the ContactTrackerSubsystem associated with this CompliantContactSubsystem.
This is the contact tracker that is maintaining the list of contacts for which this subsystem will be providing the response forces.
const MultibodySystem& SimTK::CompliantContactSubsystem::getMultibodySystem | ( | ) | const |
Every Subsystem is owned by a System; a CompliantContactSubsystem expects to be owned by a MultibodySystem.
This method returns a const reference to the containing MultibodySystem and will throw an exception if there is no containing System or it is not a MultibodySystem.