Class DampedContactForce#
Defined in File DampedContactForce.h
Nested Relationships#
Nested Types#
Inheritance Relationships#
Base Type#
public Karana::Collision::ContactForceBase(Class ContactForceBase)
Class Documentation#
-
class DampedContactForce : public Karana::Collision::ContactForceBase#
ContactForceBase implementation using a Hunt-Crossley model.
Based on https://chatgpt.com/s/t_6955d6cac734819194154f53251a0038
See Collision dynamics for more discussion on contact and collision dynamics.
Public Functions
-
virtual km::SpatialForce computeForce(const Karana::Collision::FrameContact &contact, const kc::ks_ptr<kd::Node> &nd_1, const kc::ks_ptr<kd::Node> &nd_2) final#
Compute the contact force for the associated contact.
- Parameters:
contact – The contact to compute the force for.
nd_1 – The contact node on the first body.
nd_2 – The contact node on the second body.
- Returns:
The contact force.
-
virtual bool isReady() const final#
Used to ensure the DampedContactForce contact force model is ready.
- Returns:
true if the DampedContactForce is ready, false otherwise.
-
virtual std::string dumpString(std::string_view prefix, const Karana::Core::Base::DumpOptions *options = nullptr) 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.
Public Members
-
DampedContactForceParams params#
Parameters used for the contact model.
-
DampedContactForceScratch scratch#
Scratch values.
Public Static Functions
-
static kc::ks_ptr<DampedContactForce> create(std::string_view name)#
Create an instance of the DampedContactForce contact force model.
- Parameters:
name – The name for the DampedContactForce instance.
- Returns:
A ks_ptr to the newly created DampedContactForce contact force model.
-
class DampedContactForceParams#
Structure that holds the DampedContactForce contact force parameters.
Public Members
-
double kp = km::notReadyNaN#
Normal penetration stiffness coefficient.
-
double kc = km::notReadyNaN#
Normal penetration restitution/damping coefficient.
-
double n = km::notReadyNaN#
Exponent.
-
double mu = km::notReadyNaN#
Friction coefficient.
-
double dmax = km::notReadyNaN#
DMAx - max penetration value where damping stops increasing.
-
double e = 3#
Damping exponent (default cubic dependency).
-
double linear_region_tol = km::notReadyNaN#
Tolerance at which friction is linearly interpolated between the real value and 0.
To avoid jittering for cases like rolling without friction, near zero, the friction force uses a linear interpolation between the full friction force and zero. This avoids rapid, large changes in the friction force as the velocity changes sign, and instead, smoothly, linearly interpolates between these large forces over a region of linear_region_tol * 2.
-
double kp = km::notReadyNaN#
-
class DampedContactForceScratch#
Structure that holds the DampedContactForce scratch data.
-
virtual km::SpatialForce computeForce(const Karana::Collision::FrameContact &contact, const kc::ks_ptr<kd::Node> &nd_1, const kc::ks_ptr<kd::Node> &nd_2) final#