Class PenaltyContact#

Inheritance Relationships#

Base Type#

Class Documentation#

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

Model applying penalty forces proportional to collision penetration.

The normal force magnitude is Fn = max(0, (kp*p^n + kc*p^n*v)), where kp, kc, and n are as defined in the parameters and v is the velocity in the normal direction.

The tangential force magnitude is mu*Fn where mu is as defined in the parameters and Fn is the normal force magnitude defined above.

Public Types

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

CollisionModelSelectorFn selects a collision model given a FrameContact.

Public Functions

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

Constructor.

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

  • sp – The StatePropagator 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.

Public Static Functions

static kc::ks_ptr<PenaltyContact> create(std::string_view name, const kc::ks_ptr<Karana::Dynamics::StatePropagator> &sp, 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.

  • sp – The StatePropagator 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.