Class CoordinateConstraint#
Defined in File CoordinateConstraint.h
Inheritance Relationships#
Base Type#
public Karana::Dynamics::BilateralConstraintBase(Class BilateralConstraintBase)
Class Documentation#
-
class CoordinateConstraint : public Karana::Dynamics::BilateralConstraintBase#
Class for coordinate constraints.
Thie constraint requires that the ratio of the Q coordinates for a pair of subhinges be related via a specific scale ratio.
See the Coordinate constraints section for more discussion on coordinate constraints.
Public Functions
-
CoordinateConstraint(kc::ks_ptr<Multibody> &mb, kc::ks_ptr<PhysicalSubhinge> oshg, kc::ks_ptr<PhysicalSubhinge> pshg, const std::string &name)#
Constructor.
-
inline virtual const std::string &typeString() const noexcept override#
Returns the type string of LockingBase.
- Returns:
The type string.
-
virtual size_t nResiduals() const override#
Return the number of dofs allowed by the constraint.
- Returns:
the number of dofs allowed by the constraint
-
km::Vec accelResidual() const#
Return the 1-d size accel residual term for the constraint.
Used for computing the acceleration kinematics and the lambda (Lagrange multiplier) terms for the TA dynamics correction step
- Returns:
The acceleraton residual eror
-
inline void setScaleRatio(double scale_ratio)#
Set the Q(pshg)/Q(oshg) coordinate scale ratio.
- Parameters:
scale_ratio – The scale ratio
-
inline double getScaleRatio() const#
Return the Q(pshg)/Q(oshg) coordinate scale ratio.
- Returns:
The scale ratio
-
inline kc::ks_ptr<PhysicalSubhinge> osubhinge() const#
Return the first subhinge for this coordinate constraint.
- Returns:
The first subhinge.
-
inline kc::ks_ptr<PhysicalSubhinge> psubhinge() const#
Return the second subhinge for this coordinate constraint.
- Returns:
The second subhinge.
-
virtual bool isFinalized() const override#
Checks is the params for the object have been initialized.
- Returns:
True if the params have set up.
-
virtual km::Vec velError() const override#
Return the current U constraint velocity error.
- Returns:
the velocity error
-
virtual km::Vec accelError() const override#
Return the current Udot constraint acceleration error.
- Returns:
the acceleration error
-
virtual km::Vec poseError() const override#
Return the current Q constraint coordinate error.
- Returns:
the coordinate error
Public Static Functions
-
static const kc::ks_ptr<CoordinateConstraint> create(kc::ks_ptr<Multibody> &mb, kc::ks_ptr<PhysicalSubhinge> oshg, kc::ks_ptr<PhysicalSubhinge> pshg, const std::string &name)#
Factory method for creating a CoordinateConstraint instance.
- Parameters:
mb – The Multibody instance
osh – the first Karana::Dynamics::PhysicalSubhinge instance
psh – the second Karana::Dynamics::PhysicalSubhinge instance
name – the name for the loop constraint instance
- Returns:
a CoordinateConstraint instance
Protected Functions
-
void lambda2ConstraintGenForces(const km::Vec &lambda) const#
Convert the lambda Lagrange multiplier term for the coordinate constraint into constraint generalized forces at its subhinges
-
void _discard(kc::ks_ptr<kc::Base> &base) override#
Protected Attributes
-
kc::ks_ptr<PhysicalSubhinge> _oshg = nullptr#
-
kc::ks_ptr<PhysicalSubhinge> _pshg = nullptr#
-
double _scale_ratio = km::uninitializedNaN#
U(pshg)/U(pshg) coordinate scale ratio
-
CoordinateConstraint(kc::ks_ptr<Multibody> &mb, kc::ks_ptr<PhysicalSubhinge> oshg, kc::ks_ptr<PhysicalSubhinge> pshg, const std::string &name)#