Class LoopConstraintBase#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

Derived Types#

Class Documentation#

class LoopConstraintBase : public Karana::Dynamics::BilateralConstraintBase#

Base class for loop constraints See the.

Bilateral closure constraints section for more discussion on loop constraints.

Subclassed by Karana::Dynamics::LoopConstraintConVel, Karana::Dynamics::LoopConstraintHinge

Public Functions

LoopConstraintBase(kc::ks_ptr<Multibody> &mb, kc::ks_ptr<kf::FrameToFrame> constrainet_f2f, std::string_view name)#

Constructor.

Parameters:
  • mb – the multibody instance

  • constraint_f2f – the FrameToFrame being constrained

  • instance – name

inline kc::ks_ptr<kf::FrameToFrame> constraintFrameToFrame() const#

Return the Karana::Frame::FrameToFrame whose oframe/pframe define the constraint.

When the constraint is satisfied, the relative configuration, velocity and accel values across the Karana::Frame::FrameToFrame f2f are constrained to those satisfied by the associated constraint hinge

Returns:

the constraint FrameToFrame instance

inline virtual bool hasHinge() const#

Return true if the loop constraint is based on a hinge.

Returns:

true if the loop constraint is based on a hinge

inline virtual bool constrainsQ() const#

Return true if the loop constraint constrains Q configuration coordinates.

Returns:

true if the loop constraint constrains the Q coordinates

inline kc::ks_ptr<ConstraintNode> sourceNode() const#

Return the source (oframe) node for the constraint.

Return the source frame as a constraint node, if the source frame is attached to a non-virtual root body. Return a null pointer if the source frame is not attached to a multibody body.

Returns:

the source constraint node.

inline kc::ks_ptr<ConstraintNode> targetNode() const#

Return the target (pframe) node for the constraint.

Return the target frame as a constraint node, if the target frame is attached to a non-virtual root body. Return a null pointer if the target frame is not attached to a multibody body.

Returns:

the source constraint node.

inline const QMats &getQMats() const#

Return the constraint QMat matrices for this constraint

Returns:

the QMats struct for this constraint

Protected Functions

virtual km::Vec _accelResidual() const = 0#

Return the (6-nU) size accel residual term for the constraint.

Used for computing the lambda (Lagrange multiplier) terms for the TA dynamics correction step

Returns:

The acceleration residual error

km::Vec _baumgarteResidual(double stiffness, double damping) const#

Return the (6-nU) size Baumgarte residual term for the constraint for use for computing the lambda (Lagrange multiplier) terms for the Baumgarte dynamics method

void _lambda2ConstraintForces(const km::Vec &lambda) const#

Convert the lambda Lagrange multiplier term for the constraint into constraint forces at its constraint nodes

void _discard(kc::ks_ptr<Base> &base) override#

Discard the provided LoopConstraintBase.

Parameters:

base – - Base pointer to the LoopConstraintBase to discard.

virtual void _computeQMats(QMats &val)#

Protected Attributes

kc::ks_ptr<kf::FrameToFrame> _constraint_f2f#

the defining Karana::Frame::FrameToFrame for this constraint. The only motion allowed across this f2f is that permitted by the QMat constraint matrices across this f2f.

kc::ks_ptr<ConstraintNode> _source_node = nullptr#

the constraint node of the physical body the source frame is attached to. if null, the source frame is not attached to a body

kc::ks_ptr<ConstraintNode> _target_node = nullptr#

the constraint node of the physical body the target frame is attached to. if null, the target frame is not attached to a body

kc::ks_ptr<kc::DataCache<QMats>> _matsQ_cache = nullptr#

cache for computing the nResiduals()x6 the Q related orthogonal complement matrices for the constraint hinge coordinate matrix.

struct QMats#

Struct for the constraint QMat matrices needed for kinematics analysis, Gamma, TA dynamics algorithm. The constraint requirement is that.

[source_Q, target_Q] * [V_source \\ V_target] = 0

where V_source and V_target are the spatial velocities (with respect to the inertial frame) of the source and target frames respectively for the constraint Karana::Frame::FrameToFrame f2f.

rel_Q on the other hand acts directly on the the relative spatial velocity (source frame derivative) across the constraint oframe/pframe as follows:

    rel_Q * V(source, target) = 0

We also in some cases allow the RHS in the above equations to non-zero for user inputs.

Public Functions

inline void resize(size_t n_c)#

Resize the constraint matrices.

Parameters:

n_c – The number of constrained dofs.

Public Members

km::Mat source_Q#

acts on V(source), inertial frame derivative

km::Mat target_Q#

acts on V(target), inertial frame derivative

km::Mat rel_Q#

acts on relative V(source, target), source frame derivative