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

inline std::vector<unsigned int> independentIndicesU() const#

Return the indices of the independent Q coordinates.

Returns:

the independent Q coordinate indices

inline std::vector<unsigned int> independentIndicesQ() const#

Return the indices of the independent U coordinates.

Returns:

the independent U coordinate indices

virtual ~CECompoundBody()#

Destructor.

CECompoundBody(std::string_view name, kc::ks_ptr<SubGraph> parent_sg, kc::ks_ptr<SubGraph> bodies_sg, const std::vector<unsigned int> &indep_indices_U, const std::vector<unsigned int> &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

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 std::vector<unsigned int> &indep_indices_U, const std::vector<unsigned int> &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.

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

void _discard(kc::ks_ptr<Base> &base) override#
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

void _updateDependentQ(const km::Vec &min_Q, bool global) const#

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 whether incoming coords are local or global Convert the input minimal coords Q into the full dependent Q for all the aggregated subhinges for the compound body

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

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::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

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

Cache callback to compute the X matrix that maps the min independent U to the full dependent U for the compound body.

Parameters:

val – the matrix to populate

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

Cache callback to compute the Xdot*U product.

Parameters:

val – the vector to populate

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

std::vector<unsigned int> _indep_indices_U#

indices of all independent U coords among the embedded coordinates

std::vector<unsigned int> _indep_indices_Q#

indices of all independent Q coords among the embedded coordinates

std::vector<std::pair<kc::ks_ptr<PhysicalSubhinge>, size_t>> _indep_cbs_U#

List contains the physical subhinge+offset value for each of the independent U indices

std::vector<std::pair<kc::ks_ptr<PhysicalSubhinge>, size_t>> _indep_cbs_Q#

List contains the physical subhinge+offset value for each of the independent Q indices

kc::ks_ptr<ConstraintKinematicsSolver> _cks = nullptr#

the CK solver used to solve for the dependent coordinates

std::vector<unsigned int> _rows_Y#

indices for non-redundant rows for the aggregation graphs constraint velocity error Jacobian

std::vector<unsigned int> _rows_Ydot#

same as _rows_Y

std::vector<unsigned int> _dep_indices_U#

indices of all dependent coords among the _bodies_tree coordinates