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.
This 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(std::string_view name, kc::ks_ptr<Multibody> mb, kc::ks_ptr<PhysicalSubhinge> osh, kc::ks_ptr<PhysicalSubhinge> psh)#
Constructor.
- 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
-
virtual size_t nResiduals() const override#
Return the number of dofs allowed by the constraint.
- Returns:
the number of dofs allowed by the constraint
-
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 isReady() 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(std::string_view name, kc::ks_ptr<Multibody> mb, kc::ks_ptr<PhysicalSubhinge> osh, kc::ks_ptr<PhysicalSubhinge> psh)#
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
-
virtual km::Vec _poseResidual() const override#
Return the nResiduals() size pose residual term for the constraint.
Used for computing the Baumgarte error control term for TA dynamics
- Returns:
The pose residual error
-
virtual km::Vec _velResidual() const override#
Return the nResiduals() size velocity residual term for the constraint.
Used for computing the Baumgarte error control term for TA dynamics
- Returns:
The velocity residual error
-
virtual km::Vec _accelResidual() const override#
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 acceleration residual error
-
void _lambdaToConstraintGenForces(const km::Vec &lambda) const#
Convert the lambda Lagrange multiplier term for the coordinate constraint into constraint generalized forces at its subhinges.
- Parameters:
lambda – the Lagrange multiplier value
-
void _discard(kc::ks_ptr<kc::Base> &base) override#
Protected Attributes
-
kc::ks_ptr<PhysicalSubhinge> _oshg = nullptr#
the source of 1-dof subhinges pair whose coordinates are being constrained
-
kc::ks_ptr<PhysicalSubhinge> _pshg = nullptr#
the target of the 1-dof subhinges pair whose coordinates are being constrained
-
double _scale_ratio = km::notReadyNaN#
U(pshg)/U(pshg) coordinate scale ratio
-
CoordinateConstraint(std::string_view name, kc::ks_ptr<Multibody> mb, kc::ks_ptr<PhysicalSubhinge> osh, kc::ks_ptr<PhysicalSubhinge> psh)#