Class FramePairHinge#

Inheritance Relationships#

Base Types#

Derived Type#

Class Documentation#

class FramePairHinge : public Karana::Dynamics::HingeBase, public Karana::Frame::OrientedChainedFrameToFrame#

Represents the articulation class used by PhysicalHinge and LoopConstraintHinge physical articulation classes.

See Connecting bodies via hinges section for more discussion on hinges.

Subclassed by Karana::Dynamics::PhysicalHinge

Public Functions

virtual ~FramePairHinge()#

FramePairHinge destructor.

FramePairHinge(kc::ks_ptr<kf::Frame> oframe, kc::ks_ptr<kf::Frame> pframe, std::string_view name, HingeBase::HingeType htype, const std::vector<SubhingeBase::SubhingeType> &subhinge_types = std::vector<SubhingeBase::SubhingeType>())#

FramePairHinge constructor.

Parameters:
  • oframe – The oframe

  • pframe – The pframe

  • name – instance name

  • htype – The hinge type

  • subhinge_types – The list of subhinge types for a custom hinge type

inline virtual std::string_view typeString() const noexcept override#

Returns the type string of the HingeBase.

Returns:

The type string.

inline virtual std::string_view name() const override#

Return the name of the hinge instance.

Returns:

the hinge name

virtual km::Mat pframeCoordMapMatrix() const override#

Return the overall 6xnU() pframe coord map matrix for the hinge.

Return the overall 6xnU() coord map matrix for the hinge referenced to and in the pframe frame with contributions from all of its subhinges. Note that the matrix will be configuration dependent when there are multiple subhinges. The product of this matrix with the generalized velocity U coordinates for the hinge returns the delta velocity across the hinge rigidly transformed to the pframe.

Returns:

the coord map matrix

virtual km::Mat oframeCoordMapMatrix() const override#

Return the overall 6xnU() oframe coord map matrix for the hinge.

Return the overall 6xnU() coord map matrix for the hinge, referenced to and in the oframe frame with contributions from all of its subhinges. Note that the matrix will be configuration dependent when there are multiple subhinges. The product of this matrix with the generalized velocity U coordinates for the hinge returns the delta velocity across the hinge in the oframe.

Returns:

the coord map matrix

km::HomTran fitQ(const km::HomTran &T, kc::ks_ptr<FrameToFrame> f_to_f = nullptr)#

Method to find best fit Q coordinates for the hinge for the input transform.

This method can be used to initialize the hinge’s Q coordinates to values that best fit the input transform T. If f_to_f is non-null, then T is assumed to be the desired relative transform for the f_to_f, and if null then this hinge is used as the f_to_f.

Parameters:
  • T – Input transform

  • f_to_f – The frame to frame instance the T transform is for

Returns:

The residual error transform

km::SpatialVector fitU(const km::SpatialVector &V, kc::ks_ptr<FrameToFrame> f_to_f = nullptr)#

Method to find best fit U velocity coordinates for the input spatial velocity vector.

This method can be used to initialize the hinge U velocity coordinates to values that best fit the input spatial velocity for the hinge. If f_to_f is non-null, then V is assumed to be the desired spatial velocity for this f_to_f , and if null then this hinge is used as the f_to_f .

Parameters:
  • V – Input spatial velocity vector

  • f_to_f – The frame to frame instance the V spatial velocity is for

Returns:

The residual spatial velocity error

km::SpatialVector fitUdot(const km::SpatialVector &alpha, kc::ks_ptr<FrameToFrame> f_to_f = nullptr)#

Method to find best fit Udot accel coordinates for the input spatial acceleration vector.

This method can be used to initialize the hinge Udot acceleration coordinates to values that best fit the input spatial acceleration for the hinge. If f_to_f is non-null, then A is assumed to be the desired spatial accel for this f_to_f , and if null then this hinge is used as the f_to_f .

Parameters:
  • alpha – Input spatial acceleration vector

  • f_to_f – The frame to frame instance the A spatial acceleration is for

Returns:

The residual spatial acceleration error

inline const std::vector<SubhingeBase::SubhingeType> &subhingeTypes() const#

Return the list of SubhingeBase::SubhingeType subhinge types for this hinge.

Returns:

the list of subhinge types

virtual std::string dumpString(std::string_view prefix, const Karana::Core::Base::DumpOptions *options) 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.

Public Static Functions

static kc::ks_ptr<FramePairHinge> create(kc::ks_ptr<kf::Frame> oframe, kc::ks_ptr<kf::Frame> pframe, std::string_view name, HingeBase::HingeType htype, const std::vector<SubhingeBase::SubhingeType> &subhinge_types = std::vector<SubhingeBase::SubhingeType>())#

FramePairHinge creation static factory method.

Parameters:
  • oframe – The oframe

  • pframe – The pframe

  • name – instance name

  • htype – The hinge type

  • subhinge_types – The list of subhinge types for a custom hinge type

Returns:

A new FramePairHinge instance

Protected Functions

kc::ks_ptr<F2FJacobianGenerator> _jacgen()#

Return the Jacobian generator for the hinge.

This is used internally by the fit*() methods

Returns:

The Jacobian generator

inline virtual void _changeActionT()#
void _oneTimeSetup()#
void _oneTimeTeardown()#
void _createPhysicalSubhinges(const std::vector<SubhingeBase::SubhingeType> &subhinge_types)#
void _discardPhysicalSubhinges()#
void _makeNlSolver()#
void _makeJacobianGenerator()#

Protected Attributes

kc::ks_ptr<kf::Frame> _newtonian_frame = nullptr#
kc::ks_ptr<F2FJacobianGenerator> _hinge_jacgen = nullptr#
kc::ks_ptr<km::NonlinearSolver> _nl_solver = nullptr#
kc::ks_ptr<kf::Frame> _fit_frame = nullptr#

frame used by the fitQ method. this frame is positioned at the desired hinge transform pose, and the solver to drive this frame to pframe relTransform to zero to get the best fit Q coordinates