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 reported 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 returned also. | |
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 | calcContactPatchDetails (const State &state, Array_< ContactPatch > &patches) const |
Calculate detailed information about the current set of active contact patches, including deformed geometric information, pressure and friction force distribution, and resultant forces and moments. | |
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.
CompliantContactSubsystem | ( | ) | [inline] |
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.
The MultibodySystem takes over ownership of the new subsystem object, but the handle we construct here retains a reference to it.
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.
The subsystem takes over ownership of the generator; don't delete it yourself.
void adoptForceGenerator | ( | ContactForceGenerator * | generator | ) |
void calcContactPatchDetails | ( | const State & | state, | |
Array_< ContactPatch > & | patches | |||
) | const |
Calculate detailed information about the current set of active contact patches, 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. The input to this calculation is the current set of ActiveContacts as obtained for this State from the associated ContactTrackerSubsystem. You can call this at Velocity stage or higher. Each contact patch is the result of a single Contact, but not all active Contacts will produce patches.
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 returned also.
You can call this at Velocity stage or later; the contact forces will be realized first if necessary.
const ContactForceGenerator& 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 ContactTrackerSubsystem& 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 ContactForceGenerator& getDefaultForceGenerator | ( | ) | const |
Return the force generator to be used for a Contact type for which no suitable force generator has been registered.
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.
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. |
const MultibodySystem& 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.
int getNumContactForces | ( | const State & | state | ) | const |
Determine how many of the reported 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.
Real getOOTransitionVelocity | ( | ) | const |
Get a precalculated 1/vt to avoid expensive runtime divisions.
Real getTransitionVelocity | ( | ) | const |
Get the transition velocity (vt) of the friction model.
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.
bool hasForceGenerator | ( | ContactTypeId | contact | ) | const |
Return true if this subsystem has a force generator registered that can respond to this kind of Contact.
void 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 setTransitionVelocity | ( | Real | vt | ) |
Set the transition velocity (vt) of the friction model.