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 consttaints.

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

Public Functions

LoopConstraintBase(kc::ks_ptr<Multibody> &mb, kc::ks_ptr<kf::Frame2Frame> constrainet_f2f, const std::string &name)#

Constructor.

inline kc::ks_ptr<kf::Frame2Frame> constraintFrame2Frame() const#

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

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

Returns:

the constraint Frame2Frame 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 attatched 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 attatched 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

Protected Functions

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

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

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

Returns:

The acceleraton residual eror

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 (Lagrnage 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) = 0#

Protected Attributes

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

the defining Karana::Frame::Frame2Frame 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>> _QMats_cache = nullptr#

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

struct QMats#

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

[sourceQ, targetQ] * [V_source \\ V_target] = 0

where V_source and V_target are the spatial velocities of the source and target frames respectively defined by teh constraint Karana::Frame::Frame2Frame f2f’s oframe/pframe pair.

Public Functions

inline void resize(size_t nC)#

Resize the constraint matrices.

Parameters:

The – number of constrained dofs.

Public Members

km::Mat sourceQ#

Q at the source frame.

km::Mat targetQ#

Q at the target frame.