Class SphericalSubhinge#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

Class Documentation#

class SphericalSubhinge : public Karana::Dynamics::PhysicalSubhinge_T<3, 3>#

Represents a 1 dof rotational subhinge using minimal RotationVector coords.

See Subhinges section for more information on physical subhinges.

Public Functions

virtual ~SphericalSubhinge()#

SphericalSubhinge destructor.

virtual SubhingeBase::SubhingeType subhingeType() const override#

Helper method to return the subhinge type.

Returns:

the subhinge type

SphericalSubhinge(kc::ks_ptr<kf::Frame> oframe, kc::ks_ptr<kf::Frame> pframe, std::string_view name, kc::ks_ptr<FramePairHinge> hge)#

Constructs a SphericalSubhinge.

Parameters:
  • oframe – the oframe frame

  • pframe – the pframe frame

  • name – the name for the subhinge

  • hge – the parent hinge

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.

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

Return a formatted string containing information about this object.

Parameters:
  • prefix – String prefix to use for formatting.

  • options – Dump options (if null, defaults will be used).

Returns:

A string representation of the object.

inline virtual bool requiresCoordSanitization() const override#

Return true if the subhinge has coordinate sanitization needs.

This method can be used to identify the subset of subhinges that have coordinate sanitization needs, so that sanitizeCoords() can be called for them when needed.

Returns:

true if the subhinge has coordinate sanitization needs.

inline void setMaxChartAngle(double val)#

Set the threshold for the RotationVector coordinates chart recentering.

Set the max allowed angle before the chart is recentered when sanitizeCoords() is called.

Parameters:

val – the threshold value

inline double getMaxChartAngle() const#

Return the threshold for the RotationVector coordinates chart recentering.

Return the max allowed angle before the chart is recentered when sanitizeCoords() is called.

Returns:

the threshold value

virtual bool sanitizeCoords() override#

Method to recenter or otherwise sanitize the subhinge’s coordinates.

Some subhinge may have coordinates that need to be “sanitized” from time to time. An example if that of spherical subhinges, where the orientation coordinate representation may require recentering of the local charts when the values are nearing singularity. This method can specialized for subhinges that have this need. The return value should be true if any such sanitization was done to modify the coordinate values.

Returns:

true, is any sanitization was needed and carried out

inline const km::UnitQuaternion &getChartOffset() const#

Return the current offset for the RotationVector coordinates chart.

Returns:

the chart offset UnitQuaternion

inline virtual void resetChart() override#

Reset any sanitization related chart offsets etc that may have been applied.

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

Return the global Q coordinates - not the chart relative ones.

Returns:

the Q coordinates

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

Set the global Q coordinates - not the chart relative ones.

Parameters:

val – the input Q coordinates

Protected Functions

virtual void _computeTransform(km::HomTran&) override#

Compute the transformation between the oframe and pframe.

This the relTransform data cache callback.

Parameters:

T – The buffer to place the computed homogeneous transformation in.

virtual void _computeVelocity(km::SpatialVector&) override#

Compute the spatial velocity between the oframe and pframe.

This the relSpVel data cache callback.

Parameters:

V – The buffer to put the computed spatial velocity in.

virtual void _computeAccel(km::SpatialVector&) override#

Compute the spatial acceleration between the oframe and pframe.

This the relSpAccel data cache callback.

Parameters:

a – The buffer to put the computed spatial acceleration in.

void _computeQdot(km::Vec &val) const#

Data cache callback to compute the Qdot values.

Parameters:

val – the data buffer for the computed value

virtual km::Mat poseGradient(const kf::FrameToFrame &f2f, bool oriented) const override#

Return the pose gradient matrix for a Karana::Frame::FrameToFrame.

Return the 6xnU gradient matrix for the pose of a Karana::Frame::FrameToFrame’s pframe with respect to its oframe with respect to the generalized coordinates Q using analytical methods. The relative orientation is expressed using RotationVectors for a minimal coordinates representation. Though closely related to the Jacobian, the gradient matrix is a coordinate space mapping, while the Jacobian is a velocity space mapping. The gradient matrix is handy for inverse kinematics computations. If oriented is false, the returned value is negated first.

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

Parameters:
  • f_to_f – the FrameToFrame defining the relative from/to frames

  • oriented – the orientation of the coordinates provider

Returns:

the gradient matrix

km::Mat33 _genvelToQdotMap() const#

Return the (nU x nU) matrix that converts U generalized velocities into Qdot gen coord rates.

This matrix is non-identity only when quasi-velocities are used - such as for spherical subhinges. Currently unused.

Returns:

the U to Qdot conversion matrix

km::Mat33 _qdotToGenvelMap() const#

Return the (nU x nU) matrix that converts Qdot gen coord rates into U generalized velocities for the coordinates provider.

This matrix is non-identity only when quasi-velocities are used - such as for spherical subhinges.

This matrix is used in transforming the velocity space Jacobian into a pose gradient that works with Qdot values instead of U values. During this process, the Jacobian is from the oframe (not pframe) for the CoordBase_T, and the _qdotToGenvelMap should also be the oframe (and not the pframe) version. We point this out to avoid confusion since we work with the pframe variants of this map when computing Qdot values for spherical subhinges (since the angular velocity is in the pframe frame).

Returns:

the Qdot to U conversion matrix

virtual kc::ks_ptr<PhysicalSubhinge::PhysicalSubhingeParams> _getParams() const override#

Get params for the subhinge.

Returns:

the params

virtual void _setParams(const PhysicalSubhinge::PhysicalSubhingeParams &params) override#

Apply the params from the twin subhinge to this subhinge.

Parameters:

params – the input parameters

virtual void _enableCoordChart(bool flag) override#

Enable/disable the use of local charts for the subhinge. Typically charts should be enabled when doing time domain simulations, but disabled when doing configuration kinematics, and linearization operations.

struct PhysicalSubhingeParams : public Karana::Dynamics::PhysicalSubhinge::PhysicalSubhingeParams#

Specialization of param class for this subhinge type

Public Functions

inline PhysicalSubhingeParams &operator=(const PhysicalSubhinge::PhysicalSubhingeParams *p)#

Assignment operator.

Parameters:

p – the other params

Returns:

the updated params

Public Members

double max_chart_angle#

the maximum angle threshold to trigger a chart reset