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 LoopConstraintCutJoint 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<FrameToFrameJacobianGenerator> _jacgen()#

Return the Jacobian generator for the hinge.

This is used internally by the fit*() methods

Returns:

The Jacobian generator

inline virtual void _changeActionT()#

Carry out side effect of the the generalized force changing for the subhinge.

An example side effect is to mark the ATBI filter data cache for the hinge onode as not healthy for a physical hinge.

void _oneTimeSetup()#

Helper method to set up this FramePairHinge.

void _oneTimeTeardown()#

Helper method to tear down this FramePairHinge.

void _createStickParts(kc::ks_ptr<ks::ProxyScene> &scene, const StickPartsConfig &c, bool constraint) const#

Create stick parts for the hinge.

Parameters:
  • scene – the proxy scene

  • c – the stick parts configuration data

  • constraint – if true, this is a hinge constraint, else a regular one

void _createPhysicalSubhinges(const std::vector<SubhingeBase::SubhingeType> &subhinge_types)#

Helper method to create the subhinges for this hinge.

Parameters:

subhinge_types – list of subhinge types for the hinge

void _discardPhysicalSubhinges()#

Helper method to discard the subhinges for this hinge.

void _makeNlSolver()#

Helper method to create the nonlinear solver used by the fit*() methods.

void _makeJacobianGenerator()#

Helper method to create the Jacobian generator used by the fit*() methods.

Protected Attributes

kc::ks_ptr<kf::Frame> _newtonian_frame = nullptr#

the Newtonian frame for dynamics

kc::ks_ptr<FrameToFrameJacobianGenerator> _hinge_jacgen = nullptr#

the Jacobian generator for the hinge

kc::ks_ptr<km::NonlinearSolver> _nl_solver = nullptr#

the nonlinear solver for the hinge

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