Class CECompoundBody#

Inheritance Relationships#

Base Type#

Class Documentation#

class CECompoundBody : public Karana::Dynamics::CompoundBody#

Represents a compound body with embedded constraints (for constraint embedding).

This class is for compound bodies with embedded constraints

Public Functions

const km::VecInt &getIndependentIndicesU() const#

Return the indices of the independent Q coordinates.

Returns:

the independent Q coordinate indices

const km::VecInt &getIndependentIndicesQ() const#

Return the indices of the independent U coordinates.

Returns:

the independent U coordinate indices

void setIndependentIndices(const km::VecInt &indep_indices_U, const km::VecInt &indep_indices_Q = {})#

Set the independent Q and U coordinate indices.

If the Q indices are unspecified, they are assumed to be the same as the U indices.

Parameters:
  • indep_indices_U – the independent U coordinate indices

  • indep_indices_Q – the independent Q coordinate indices

virtual ~CECompoundBody()#

Destructor.

CECompoundBody(std::string_view name, kc::ks_ptr<SubGraph> parent_sg, kc::ks_ptr<SubGraph> bodies_sg, const km::VecInt &indep_indices_U, const km::VecInt &indep_indices_Q = {})#

Constructs a CECompoundBody with list of independent bodies. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance one of the classes derived from this.

Parameters:
  • name – instance name

  • parent_sg – the parent SubGraph this the body will belong to

  • bodies_sgSubGraph with bodies being embedded

  • indep_indices_U – the list of independent U coordinate indices

  • indep_indices_Q – the list of independent Q coordinate indices

CECompoundBody(std::string_view name, kc::ks_ptr<SubGraph> parent_sg, kc::ks_ptr<SubGraph> bodies_sg, const std::vector<kc::ks_ptr<PhysicalBody>> &indep_bodies)#

Constructs a CECompoundBody with list of independent coord indices. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance one of the classes derived from this.

Parameters:
  • name – instance name

  • parent_sg – the parent SubGraph this the body will belong to

  • bodies_sgSubGraph with bodies being embedded

  • indep_bodies – the bodies whose coordinates should be independent

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<CELoopKinematicsBase> loopSolver() const#

Return the CELoopKinematicsSolver for the compound body.

Returns:

the CE loop solver

virtual const CECompoundBodyVars &getVars() const override#

Get the vars member as a CECompoundBodyVars.

Returns:

The CECompoundBodyVars for this CECompoundBody.

Public Static Functions

static kc::ks_ptr<CECompoundBody> create(std::string_view name, kc::ks_ptr<SubGraph> parent_subtree, kc::ks_ptr<SubGraph> component_bodies, const std::vector<kc::ks_ptr<PhysicalBody>> &indep_bodies)#

Constructs a CECompoundBody with list of independent bodies.

Parameters:
  • name – instance name

  • parent_subtree – the parent SubGraph this the body will belong to

  • component_bodiesSubGraph with bodies being embedded

  • indep_bodies – the bodies whose coordinates should be independent

Returns:

a CECompoundBody instance

static kc::ks_ptr<CECompoundBody> create(std::string_view name, kc::ks_ptr<SubGraph> parent_subtree, kc::ks_ptr<SubGraph> component_bodies, const km::VecInt &indep_indices_U, const km::VecInt &indep_indices_Q = {})#

Constructs a CECompoundBody with list of independent coord indices.

The option of specifying independent coordinates at the indices level gives finer-grain control than the other create() method. Also, this method allows specifying different values for the independent Q and U coordinates. The U coordinates are used if the Q list is empty. If empty indices are specified, then the required number of independent coordinate indices will be auto picked.

Parameters:
  • name – instance name

  • parent_subtree – the parent SubGraph this the body will belong to

  • component_bodiesSubGraph with bodies being embedded

  • indep_indices_U – the list of independent U coordinate indices

  • indep_indices_Q – the list of independent Q coordinate indices

Returns:

a CECompoundBody instance

Protected Functions

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.

virtual kc::ks_ptr<CompoundSubhinge> _createSubhinge(kc::ks_ptr<CompoundHinge> hinge) override#

Create the compound subhinge.

Parameters:

hinge – the parent compound hinge

Returns:

the new compound subhinge

km::Mat _matX() const#

Return the X matrix that maps the min independent U to the dependent U (without constraint dofs) for the compound body.

Returns:

the non-constraint X matrix

const km::Mat &_constraintX() const#

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

Returns:

the full constraint X matrix

const km::Vec &_constraintXdotU() const#

Return the Xdot*U product vector where Xdot is the time derivative of the X constraint matrix

Returns:

the Xdot*U product

virtual km::Vec _getFprimeTreeFwdDyn() const override#

Get the f’ values from tree forward dynamics for all of the embedded bodies stacked into a single vector.

Returns:

the stacked vector with f’ values

Protected Attributes

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

the data cache for the constraint X matrix

kc::ks_ptr<kc::DataCache<km::Vec>> _cache_XdotU = nullptr#

the data cache for the constraint Xdot*U product

kc::ks_ptr<CELoopKinematicsBase> _ce_loop_solver = nullptr#

The CE loop constraints solver for the compound body