Class ContactForceBase#

Inheritance Relationships#

Base Type#

Derived Types#

Class Documentation#

class ContactForceBase : public Karana::Core::Base#

Base class for all contact force models.

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

Subclassed by Karana::Collision::ContactForceManager, Karana::Collision::HuntCrossley

Public Types

using NodePair = std::pair<kc::ks_ptr<kd::Node>, kc::ks_ptr<kd::Node>>#

The pair of nodes used when computing the contact force.

Public Functions

virtual void applyForce(const FrameContact &contact, const kc::ks_ptr<Karana::Dynamics::SubTree> &st)#

Apply the contact force for the associated contact.

This first calls computeForce to get the contact force. Then, it applies it to frames if those frames belong to a body.

Parameters:
  • contact – The contact to apply the force for.

  • st – The SubTree we are computing forces for.

virtual km::SpatialVector computeForce(const FrameContact &contact, const kc::ks_ptr<kd::Node> &nd_1, const kc::ks_ptr<kd::Node> &nd_2) = 0#

Compute the contact force for the associated contact.

Parameters:
  • contact – The contact to compute the force for.

  • nd_1 – The contact node associated with object 1. This node is located at contact.location_1 and the frame of the node is that of frame_1.

  • nd_2 – The contact node associated with object 2. This node is located at contact.location_2 and the frame of the node is that of frame_2.

Returns:

The contact force on the frame_1 object at location_1 expressed in frame_1 coordinates.

const NodePair &getLastNodePair() const#

Get the pair of nodes from the most recent contact.

Returns:

The node pair (may be null)

virtual void resetLastNodePair()#

Reset the most recent contact node pair to nullptr.

Base(std::string_view name, const ks_ptr<BaseContainer> &container = nullptr)#

Base class constructor.

Parameters:
  • name – Name for the base class.

  • container – The container to add the Base too. If none is specified, the default singleton container will be used.

Base(const Base &other)#

Copy constructor.

Parameters:

other – Base class to copy.

Base(Base &&other) noexcept#

Move constructor.

Parameters:

other – Base class to move.

Protected Attributes

NodePair _last_node_pair = {nullptr, nullptr}#

The last node pair used in contact force calculation.