Class ContactForceBase#

Inheritance Relationships#

Base Type#

Derived Types#

Class Documentation#

class ContactForceBase : public Karana::Core::BaseWithVars#

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 Functions

virtual std::pair<const kc::ks_ptr<kd::Node>&, const kc::ks_ptr<kd::Node>&> 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.

Returns:

A pair of contact force nodes at which we applied the force.

virtual km::SpatialForce 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.

virtual std::string dumpString(std::string_view prefix = "", const 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.

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

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

Parameters:
  • name – Name for the class.

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

BaseWithVars(const BaseWithVars &other)#

Copy constructor.

Parameters:

other – BaseWithVars class to copy.

BaseWithVars(BaseWithVars &&other) noexcept#

Move constructor.

Parameters:

other – BaseWithVars class to move.