Class CompoundSubhinge#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Types#

Derived Type#

Class Documentation#

class CompoundSubhinge : public Karana::Core::LockingBase, public Karana::Dynamics::SubhingeBase#

Represents the articulation subhinge class for CompoundBody subhinges.

Subclassed by Karana::Dynamics::CECompoundSubhinge

Public Functions

virtual ~CompoundSubhinge()#

CompoundSubhinge destructor.

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

Return the object’s name.

Returns:

The object’s string name.

inline virtual const kc::id_t &id() const override#

Return the object’s id.

Returns:

The object’s id.

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

Returns the type string of Base.

Returns:

The type string.

inline virtual const km::Mat atbiCoordMapMatrix() const override#

Return the coordinate map matrix to be used for ATBI computations.

Returns:

coordinate map matrix

virtual SubhingeBase::SubhingeType subhingeType() const override#

Helper method to return the subhinge type.

Returns:

the subhinge type

virtual kc::ks_ptr<kf::FrameToFrame> f2f() const override#

Return the frame to frame for the CoordBase.

The returned f2f helps locate the CoordBase in the frames tree. Its transform etc data does not however represent the relative transformation changes from the changes to this object’s coordinates.

Returns:

Return the oframe Frame instance

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.

virtual void setQ(const Eigen::Ref<const km::Vec> &val) override#

Set the global (chart) Q coordinates.

Get/set methods for buffers for the generalized coordinates for this coordinate provider.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

val – Array of values.

virtual void setQ(double fill_value) override#

Set the global (chart) Q coordinates to a constant value.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

fill_value – Fill value.

virtual const km::Vec &getQ() const override#

Return the global (chart) Q coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Returns:

Array of values.

virtual void setU(const Eigen::Ref<const km::Vec> &val) override#

Set the U velocity coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

val – Array of values.

virtual void setU(double fill_value) override#

Set the U velocity coordinates to a constant value.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

fill_value – Fill value.

virtual const km::Vec &getU() const override#

Return the U velocity coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Returns:

Array of values.

virtual void setT(const Eigen::Ref<const km::Vec> &val) override#

Set the T generalized forces.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

val – Array of values.

virtual void setT(double fill_value) override#

Set the T generalized forces to a constant value.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

fill_value – Fill value.

virtual const km::Vec &getT() const override#

Return the T generalized forces.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Returns:

Array of values.

virtual void setUdot(const Eigen::Ref<const km::Vec> &val) override#

Set the Udot acceleration coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

val – Array of values.

virtual void setUdot(double fill_value) override#

Set the Udot acceleration coordinates to a constant value.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

fill_value – Fill value.

virtual const km::Vec &getUdot() const override#

Return the Udot acceleration coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Returns:

Array of values.

virtual const km::Vec &getQdot() const override#

Return the Qdot rate coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Returns:

Array of values.

CompoundSubhinge(kc::ks_ptr<CompoundHinge> hge)#

Constructs a CompoundSubhinge.

Parameters:

hge – the parent hinge instance

Protected Functions

virtual void _localChartSetQ(const Eigen::Ref<const km::Vec> &val) override#

Set the local chart Q coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Parameters:

val – Array of values.

virtual const km::Vec &_localChartGetQ() const override#

Return the local chart Q coordinates - without sanitizing coordinates.

See Generalized Q, U etc coordinates section for discussion on Q, U etc coordinates.

Returns:

Array of values.

inline virtual km::Mat getUpsilonMatrix() override#

The Upsilon at the pframe (after crossing the ATBI dofs). For a subhinge, pframe is the regular subhinge pframe, and for a flex body it is the body frame. For a subhinge, this is a nU size square matrix, while for a flex body it is a (nU+6) size square matrix.

Returns:

The ATBI Upsilon matrix value for this subhinge.

km::SpatialVector _aprimeAccel(kc::ks_ptr<PhysicalBody> bd) const#

Update and return the aprime Coriolis accel for an embedded physical body.

Parameters:

bd – the embedded body

Returns:

the a’ value for the embedded body

virtual km::Mat jacobian(const kf::Frame &target, bool oriented) const override#

Return the analytical 6xnU Jacobian matrix for the subhinge to the target frame. The left side of the Jacobian is in the target frame. This method assumes that the target frame is outboard of the subhinge’s pframe.

Parameters:
  • target – the target frame whose Jacobian is computed

  • oriented – if true, the polarity of the subhinge is assumed to be aligned with the path to the target frame

Returns:

the Jacobian matrix

virtual km::Mat jacobianDot(const kf::Frame &target, bool oriented) const override#

Return the time derivative of the Jacobian matrix for the target Karana::Frame::Frame.

For this coordinates provider, return the 6xnU Jacobian matrix time derivative for the target Karana::Frame::Frame. If oriented is false, the return value is negated.

See Coordinate Frames section for more information on frames, and Jacobians section for more on Jacobians.

See also

jacobian()

Parameters:
  • target – Frame the target frame

  • oriented – the orientation of the coordinates provider

Returns:

the Jacobian matrix time derivative

inline const km::Mat &_getE_Phi_G() const#

Compute A(p, G) = E_G A_G in Section 18.3.1.

This is a (6+vroot_body_nU)x(6nbodies) size row matrix with \(\phi(vroot_pnode, pnode)\) (6+vroot_body_nU)x6 matrix elements for the \(\phi\) matrix from the physical virtual root body’s pnode to the pnode of each aggregated physical body.

Returns:

the computed E_Phi_G matrix

void _computeATBICoordMapMatrix(km::Mat &val) const#

Callback to compute the \(\underbar H_{G}^* = \phi^* H_G\) coord map matrix for the compound subhinge as defined in Eq 18.4 that includes just the subhinge dofs for the embedded bodies.

The size of the matrix is (6nbodies) x (sh_nU), where bd_nU denotes the overall deformation dofs for the embedded bodies, and sh_nU the overall subhinge generalized velocities for the embedded subhinges. This is in fact the Jacobian from the aggregated subhinges to the pnodes and modal coords of the aggregated bodies.

There is one block row per embedded body of size 6 for the rigid body spatial velocity elements. The columns are organized in the subhingeCoordData coords order.

Parameters:

val – the buffer for the data

void _computeFullCoordMapMatrix(km::Mat &val) const#

Callback to compute the “full” \(\underbar H_{G}^* = \phi^* H_G\) coord map matrix for the compound subhinge as defined in Eq 18.4 that includes both the subhinge and flex dofs for the embedded bodies.

The size of the matrix is (6nbodies + bd_nU) x (bd_nU + sh_nU), where bd_nU denotes the overall deformation dofs for the embedded bodies, and sh_nU the overall subhinge generalized velocities for the embedded subhinges. This is in fact the Jacobian from the aggregated subhinges and modal coords to the pnodes and modal coords of the aggregated bodies.

There is one block row per embedded body, with the size of the row being the number of body deformation coords plus 6, with the modal etadot coords coming first followed by the 6 rigid body spatial velocity elements. However, the columns are organized in the treeCoordData coords order - so all sh_nU subhinge coordinates come first, followed by all the bd_nU modal coordinates coming after.

Parameters:

val – the buffer for the data

void _discard(kc::ks_ptr<kc::Base> &base) override#

Discard the provided CompoundSubhinge.

Parameters:

base – - Base pointer to the CompoundSubhinge to discard.

km::Mat _getVrootPnodeATBIMatrixP()#

Cache callback to compute the ATBI P matrix at the physical parent body’s pnode.

This computes a (6+vroot_body_nU) size square matrix

Returns:

the computed P matrix for the vroot body

km::Vec _getVrootPnodeATBIFilterZ()#

Method to compute the ATBI z at the physical physical parent body (pnode for rigid parent, body frame for flex parent)

This computes a (6+vroot_body_nU) size vector

Returns:

the computed z vector for the vroot body

km::SpatialVector _getVrootPnodeInvDynF()#

Method to compute the inverse dynamics spatial force vector at the physical parent.

Returns:

the computed spatial force vector for the vroot body

void _computeATBIMatrices()#

Callback to update the ATBI matrices data cache

void _computeATBIFilterVectors()#

Callback to update the ATBI filter data cache

void _computeATBISmootherVectors()#

Callback to update the ATBI smoother data cache

void _computeUpsilonMatrices()#

Callback to update the ATBI OSI data cache

km::SpatialVector _computeAprimeAccel(kc::ks_ptr<PhysicalBody> bd, kc::ks_ptr<PhysicalBody> prev_bd) const#

Method to update the a’ Coriolis spatial acceleration for an embedded body.

Parameters:
  • bd – the embedded body

  • prev_bd – the parent of the embedded body

Returns:

the Coriolis spatial acceleration vector

inline virtual km::Mat getATBIMatPsi() const override#

Get the ATBI psi matrix value.

Returns:

The ATBI psi matrix value for this subhinge.

virtual km::Mat getATBID() const override#

Get the ATBI D matrix value.

Returns:

The ATBI D matrix value for this subhinge.

virtual km::Mat getATBIDinv() const override#

Get the ATBI D inverse matrix value.

Returns:

The ATBI D inverse matrix value for this subhinge.

inline virtual km::Mat getATBIG() const override#

The ATBI G matrix at the pframe. For a subhinge, pframe is the regular subhinge pframe, and for a flex body it is the body frame. This is different from _atbi_mats.G.

Returns:

The ATBI G matrix value for this subhinge.

inline virtual km::Mat getATBITauper() const override#

The ATBI tauper matrix at the pframe. For a subhinge, pframe is the regular subhinge pframe, and for a flex body it is the body frame. This is different from _atbi_mats.tauper.

Returns:

The ATBI tauper matrix value for this subhinge.

virtual km::Vec _getHingeXdotU(PhysicalHinge &hge) const#

Return the XdotU vector for the specific embedded physical hinge.

This method returns a null vector for regular compound bodies. Its return value is non-null however for constraint-embedded compound bodies whose X matrix is configuration dependent.

Parameters:

hge – the hinge

Returns:

the a’ spatial acceleration value

void _computeInvDynGenForce()#

Compute the subhinge’s generalized force value for inverse dynamics

void _computeE_Phi_G(km::Mat &val)#

Callback method to compute the (6+vroot_body_nU)x(6*nbodies) size E_Ph_G matrix for the compound body.

Parameters:

val – the data buffer for the computed data

virtual km::Mat _oframe2pframePsi() const override#

Return the oframe to pframe Psi() matrix for this CoordBase.

For

  • a flex body this is a 6x(nU+6) psi matrix, the lhs is at the pnode, and the rhs at the body frame.

  • For a subhinge this is a 6x6 psi matrix, the lhs/rhs are the subhinge’s oframe and pframe pair.

  • a compound subhinge this is the 6x(nbodies*(6+nU)) psi matrix, the lhs is at the physical parent, and the rhs at the embedded bodies.

Returns:

the Psi() matrix

virtual km::Mat _oframe2pframePhi() const override#

Return the oframe to pframe Phi() matrix for this CoordBase.

For

  • a flex body this is a 6x(nU+6) phi matrix, the lhs is at the pnode, and the rhs at the body frame.

  • a subhinge this is a 6x6 phi matrix, the lhs/rhs are the subhinge’s oframe and pframe pair.

  • a compound subhinge this is the 6x(nbodies*(6+nU)) E_Phi_G matrix, the lhs is at the physical parent, and the rhs at the embedded bodies.

Returns:

the Phi() matrix

virtual km::Mat _pframe2otherPhi(const kf::Frame &other) const override#

Return the pframe to other frame Phi() matrix for this CoordBase.

For

  • a flex body this is a (nU+6)x6 phi matrix - the lhs is at the body frame, and the rhs at the other frame.

  • a subhinge this is a 6x6 matrix - the lhs is the pframe, and the rhs at the other frame.

  • a compound subhinge this is the (nbodies*(6+nU))x6 matrix, the lhs is at the embedded body frames, and the rhs at the other frame.

Parameters:

other – the other to frame

Returns:

the Phi() matrix

Protected Attributes

kc::ks_ptr<CompoundBody> _parent_body = nullptr#

the compound body associated with this compound subhinge

std::map<std::pair<kc::id_t, kc::id_t>, bool> _body_pnodes_orientation_map#

map with orientation values for every <body, coord element> pair for the bodies and physical coord data physical elements in the compound body. Thus, for every <body, coord element> pair in the map, the true/false value indicates that the coord element is oriented/opposed in the virtual root/pnode path. A missing entry indicates that the coord element is not in the path from the virtual root to the pnode, and hence does not contribute to its motion.

This map is used in assembling Jacobian from coord elements to frames in the multibody system.

std::unordered_map<kc::id_t, kc::ks_ptr<kc::DataCache<km::SpatialVector>>> _aprime_caches#

Data caches for evaluating the “aprime” Coriolis accel values in the ATBI forward dynamics algorithm for all the aggregated physical bodies. Each cache returns the a’ Coriolis accel value for the pnode of a physical body.

kc::ks_ptr<kc::DataCache<km::Mat>> _matE_Phi_G_cache = nullptr#

Data cache for the nbodies size row matrix with \(\phi(vroot_pnode, pnode)\) 6x6 matrix elements for the \(\phi\) matrix from the physical virtual root body’s pnode to the pnode of each aggregated physical body. This is denoted \(A(p, G) = E_G A_G\) in Section 18.3.1.

kc::ks_ptr<kc::DataCache<km::Mat>> _atbi_coord_map_matrix_cache = nullptr#

the (6*nbodies)xNU joint map matrix data cache for ATBI computations for the subhinge.

mutable km::Vec _getQ_cache#

Vector for storing getQ.

mutable km::Vec _getQdot_cache#

Vector for storing getQdot.

mutable km::Vec _getU_cache#

Vector for storing getU.

mutable km::Vec _getUdot_cache#

Vector for storing getUdot.

mutable km::Vec _getT_cache#

Vector for storing getT.

struct ATBIFilterVectors : public Karana::Dynamics::CoordBase::ATBIFilterVectors#

Overall struct for ATBI dynamics filter quantities for compound body subhinge which includes the embedded body subhinge and flex dof vectors.

Public Functions

inline void resize(size_t full_n_u, size_t body_n_u)#

Resize the ATBI matrix elements.

Parameters:
  • full_n_u – is the overall number of generalized velocities from all the aggregated bodies (subhinges+flex coords)

  • body_n_u – is (6*nbodies+flex_n_u) where nbodies is the number of aggregated physical bodies.

Public Members

km::Vec z#

the body_nU size z ATBI spatial vector for the subhinge on the pframe side of the subhinge and represented in pframe

km::Vec zplus#

the body_nU size zplus vector after crossing the subhinge about and expressed in the subhinge’s oframe.

km::Vec epsilon#

Residual hinge force (full_nU)

eps = T - H * (zR + PR*a)

km::Vec nu#

Residual hinge acceleration (full_nU)

nu = Dinv * eps

struct ATBIMatrices : public Karana::Dynamics::CoordBase::ATBIMatrices#

Overall struct for ATBI dynamics matrix quantities for compound body subhinge which includes the embedded body subhinge and flex dof matrices.

Public Functions

inline void resize(size_t full_n_u, size_t body_n_u)#

Resize the ATBI matrix elements.

Parameters:
  • full_n_u – is the overall number of generalized velocities from all the aggregated bodies (subhinges+flex coords)

  • body_n_u – is (6*nbodies+flex_n_u) where nbodies is the number of aggregated physical bodies.

Public Members

km::Mat P#

The body_nU square block diagonal matrix with 6x6 ATBI P matrix element contributions from each of the aggregated physical bodies about their pnodes. Each body’s contribution is expressed in the body’s pnode frame. Only the rigid body P contributions are being kept since that is all this is needed.

km::Mat Pplus#

The body_nU square Pplus block diagonal matrix with 6x6 matrix elements after crossing the compound subhinge. The block matrix entries are about the pnode for each of the aggregated physical bodies. Note that this matrix is NOT block diagonal

km::Mat HP#

HP = H*P (full_nU x body_nU)

For a subhinge the lhs is in the pframe, while it in the pnode deformed translational frame for a flex body.

km::Mat D#

D = H*P*HT (full_nU x full_nU)

km::Mat Dinv#

Dinv = inverse(D) (full_nU x full_nU)

km::Mat G#

G = P*H*Dinv (body_nU x full_nU)

For a subhinge the lhs is in the pframe, while it in the pnode deformed translational frame for a flex body.

km::Mat tauper#

tauper = I - GH (body_nU x body_nU)

For a subhinge the lhs is in the pframe, while it in the pnode deformed translational frame for a flex body.

km::Mat psi#

psi = phi * tauper (body_nU x body_nU)

For a subhinge, the left is in the oframe, right in the pframe. For a flex body, the lefts is in the pnode frame and the right in the body frame.