Class PenaltyContact#

Inheritance Relationships#

Base Type#

Class Documentation#

class PenaltyContact : public Karana::Models::KModel<PenaltyContact>#

Model applying penalty contact forces to collisions from the provided FrameColliders.

This model takes the provided FrameCollider(s) and passes their colliding pairs to the provided ContactForceBase to calculate and apply contact forces.

See Collision dynamics for more discussion on contact and collision dynamics.

Public Types

using CollisionModelFn = std::function<const kc::ks_ptr<Collision::ContactForceBase>&(const Collision::FrameContact&)>#

CollisionModelFn selects a collision model given a FrameContact.

Public Functions

PenaltyContact(std::string_view name, const kc::ks_ptr<Karana::Dynamics::ModelManager> &mm, const kc::ks_ptr<Karana::Dynamics::SubTree> &st, const std::vector<Karana::Collision::FrameCollider> &colliders, const kc::ks_ptr<Karana::Collision::ContactForceBase> &contact_force_model)#

PenaltyContact constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.

Parameters:
  • name – - The name of the model.

  • mm – The ModelManager to register this model with.

  • st – - The SubTree that this model is operating on.

  • colliders – - Helpers to generate body contacts.

  • contact_force_model – - The model used for computing contact forces.

~PenaltyContact()#

Destructor for PenaltyContact.

void preDeriv(const Karana::Math::Ktime &t, const Karana::Math::Vec &x)#

Apply penalty contact forces.

Parameters:
  • t – - Current time. Not used.

  • x – - Current state. Not used.

virtual std::string dumpString(std::string_view prefix, const Karana::Core::Base::DumpOptions *options) const override#

Return a formatted string containing information about this object.

Parameters:
  • prefix – String prefix to use for formatting.

  • options – Dump options (if null, defaults will be used).

Returns:

A string representation of the object.

kc::ks_ptr<Collision::ContactForceBase> getContactForceModel() const#

Return the registered contact force model.

Returns:

The contact force model.

Public Static Functions

static kc::ks_ptr<PenaltyContact> create(std::string_view name, const kc::ks_ptr<Karana::Dynamics::ModelManager> &mm, const kc::ks_ptr<Karana::Dynamics::SubTree> &st, const std::vector<Karana::Collision::FrameCollider> &colliders, const kc::ks_ptr<Karana::Collision::ContactForceBase> &contact_force_model)#

Create a PenaltyContact model.

Parameters:
  • name – - The name of the model.

  • mm – The ModelManager to register this model with.

  • st – - The SubTree that this model is operating on.

  • colliders – - Helpers to generate body contacts.

  • contact_force_model – - The model used for computing contact forces.

Returns:

The created PenaltyContact model.