Class CELoopKinematicsPlanar4Bar#

Inheritance Relationships#

Base Type#

Class Documentation#

class CELoopKinematicsPlanar4Bar : public Karana::Dynamics::CELoopKinematicsBase#

The analytical kinematics solver for a planar 4-bar system.

This analytical solver for a planar 4-bar linkage requires that the subgraph’s bodies be a serial chain of length 3. The cut-join loop constraint is between the third body and the first body’s parent body. All the hinges involved should be REVOLUTE with parallel rotational axes. The independent coordinate is the first body’s coordinate.

Public Functions

CELoopKinematicsPlanar4Bar(std::string_view name, kc::ks_ptr<SubGraph> bodies_sg)#

Constructor.

Constructor

Parameters:
  • name – instance name

  • bodies_sg – SubGraph with the embedded bodies

virtual bool updateDependentQ(const km::Vec &min_q, bool global) const override#

Convert the input minimal independent coords Q into the full dependent Q for all the aggregated subhinges for the compound body as appropriate and set the values.

Note that the constraints are at the velocity level and not the Q level, and in some cases Q is subject to a different (and perhaps no) constraints, The global flag controls whether the incoming Q values are global are local chart coordinates.

Parameters:
  • min_q – The minimal coordinates.

  • global – Flag to indicate whether incoming coords are local or global.

Returns:

true if the dependent Q coordinates were successfully updated

virtual void computeConstraintX(km::Mat &X) const override#

Fill the X matrix that maps the min independent U to the full U (independent, dependent, constraint dofs) for the compound body.

Parameters:

X – The matrix to fill with the X matrix.

virtual void computeXdotU(km::Vec &XdotU) const override#

Return Xdot*U product of the time derivative of X constraint matrix with the U generalized velocities.

Parameters:

XdotU – the vector to fill with the compute value

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

inline kc::ks_ptr<kf::Frame> planarFrame() const#

Return the planar frame for the 4-bar.

Returns:

the planar frame

void setSolutionMode(bool mode)#

Select the open of crossed solution mode.

Parameters:

mode – the solution mode

Public Static Functions

static Karana::Core::ks_ptr<CELoopKinematicsPlanar4Bar> create(std::string_view name, kc::ks_ptr<SubGraph> bodies_sg)#

Constructs a CELoopKinematicsPlanar4Bar instance.

Parameters:
  • name – instance name

  • bodies_sg – SubGraph with bodies being embedded

Returns:

a CELoopKinematicsPlanar4Bar instance

Protected Functions

void _fourbarSolveQ(double theta, bool &status, bool mode = true, double eps_geom = 1e-12) const#

Helper method to solver 4-bar configuration kinematics.

enum for the open and crossed 4-bar configurations

This method solves the 4-bar kinematics in the planar frame’s XY plane

Parameters:
  • theta – the independent coordinate

  • mode – the open or crossed configuration solution being requested

  • eps_geom – tolerance used for checking solution Q solution existence

  • status – return true if the solution succeeded

void _fourbarX(const km::Vec &Q, km::Vec &X, double eps_det = 1e-12) const#

Helper method to solve for the X vector.

Parameters:
  • Q – the full Q coordinates

  • X – the vector to populate with the computed values

  • eps_det – tolerance to check for singular configuration

void _fourbarXdotU(const km::Vec &Q, const km::Vec &U, km::Vec &XdotU, double eps_det = 1e-12) const#

Helper method to compute Xdot*U.

Parameters:
  • Q – the full Q coordinates

  • U – the full U velocity coordinates

  • XdotU – the vector to populate with the computed values

  • eps_det – tolerance to check for singular configuration

virtual void _discard(Karana::Core::ks_ptr<Karana::Core::Base> &base) override#

Discard the the object. Derived classes should implement this with the logic required to discard themselves if applicable.

Parameters:

base – - A pointer to the object to discard.

Protected Attributes

double _a#

first link length

double _b#

second link length

double _c#

third link length

double _d#

fourth link length

double _planar_offset_angle#

the common rotation axis for the fourbar

the constant offset angle for the planar frame

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

planar frame. This frame is fixes to the anchor body. The 4-bar moves in its XY plane. The Z axis is the hinge axes, while the X axis is defined by the line joining the 2 body fixed nodes for the ends of the 4-bar on the anchor body

kc::ks_ptr<kf::FrameToFrame> _planar2B_f2f = nullptr#

cache the f2f from the planar frame to the B 4-bar vertex

bool _solution_mode = false#

solution mode - true means open, else crossed