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 information about the object.

Parameters:
  • prefix – A string to use as prefix for each output line

  • options – Struct with options to tailor the output

Returns:

String with the information about the object.

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

Return the registered contact force model.

Returns:

The contact force model.

const std::vector<Collision::FrameCollider> &getFrameColliders() const#

Return the frame colliders.

Returns:

The frame colliders.

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.