Program Listing for File CECompoundBody.h

Program Listing for File CECompoundBody.h#

Return to documentation for file (include/Karana/SOADyn/CECompoundBody.h)

/*
*Copyright(c)2024-2025KaranaDynamicsPtyLtd.Allrightsreserved.
*
*NOTICETOUSER:
*
*Thissourcecodeand/ordocumentation(the"LicensedMaterials")is
*theconfidentialandproprietaryinformationofKaranaDynamicsInc.
*UseoftheseLicensedMaterialsisgovernedbythetermsandconditions
*ofaseparatesoftwarelicenseagreementbetweenKaranaDynamicsandthe
*Licensee("LicenseAgreement").Unlessexpresslypermittedunderthat
*agreement,anyreproduction,modification,distribution,ordisclosure
*oftheLicensedMaterials,inwholeorinpart,toanythirdparty
*withoutthepriorwrittenconsentofKaranaDynamicsisstrictlyprohibited.
*
*THELICENSEDMATERIALSAREPROVIDED"ASIS"WITHOUTWARRANTYOFANYKIND.
*KARANADYNAMICSDISCLAIMSALLWARRANTIES,EXPRESSORIMPLIED,INCLUDING
*BUTNOTLIMITEDTOWARRANTIESOFMERCHANTABILITY,NON-INFRINGEMENT,AND
*FITNESSFORAPARTICULARPURPOSE.
*
*INNOEVENTSHALLKARANADYNAMICSBELIABLEFORANYDAMAGESWHATSOEVER,
*INCLUDINGBUTNOTLIMITEDTOLOSSOFPROFITS,DATA,ORUSE,EVENIF
*ADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGES,WHETHERINCONTRACT,TORT,
*OROTHERWISEARISINGOUTOFORINCONNECTIONWITHTHELICENSEDMATERIALS.
*
*U.S.GovernmentEndUsers:TheLicensedMaterialsarea"commercialitem"
*asdefinedat48C.F.R.2.101,andareprovidedtotheU.S.Government
*onlyasacommercialenditemunderthetermsofthislicense.
*
*AnyuseoftheLicensedMaterialsinindividualorcommercialsoftwaremust
*include,intheuserdocumentationandinternalsourcecodecomments,
*thisNotice,Disclaimer,andU.S.GovernmentUseProvision.
*/


#pragmaonce

#include"Karana/SOADyn/CompoundBody.h"
#include<vector>

namespaceKarana::Dynamics{

namespacekc=Karana::Core;

classCoordData;
classSubGraph;
classConstraintKinematicsSolver;
classMultiJacobianGenerator;
classPhysicalSubhinge;

classCECompoundBody:publicCompoundBody{

/*togetaccessto_toDependentQ()etc*/
friendclassCECompoundSubhinge;

public:
CECompoundBody(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>component_bodies,
size_tindep_n_u);

virtual~CECompoundBody();

std::string_viewtypeString()constnoexceptoverride{
staticstd::stringtype_string="Karana::Dynamics::CECompoundBody";
returntype_string;
}

protected:
kc::ks_ptr<CompoundSubhinge>_createSubhinge(kc::ks_ptr<CompoundHinge>hinge)override;

virtualvoid
_updateDependentQ(constkm::Vec&min_Q,//NOLINT(readability-identifier-naming)
boolglobal)const=0;

virtualkm::Mat_constraintX()const=0;

virtualkm::Mat_matX()const;

virtualkm::Vec_constraintXdotU(constkm::Vec&U)const=0;

//virtualkm::Mat_invConstraintX()const=0;

protected:
std::vector<unsignedint>_indep_indices_U;
std::vector<unsignedint>_indep_indices_Q;

std::vector<std::pair<kc::ks_ptr<PhysicalSubhinge>,size_t>>_indep_cbs_U;
std::vector<std::pair<kc::ks_ptr<PhysicalSubhinge>,size_t>>_indep_cbs_Q;
};

classGearedCompoundBody:publicCECompoundBody{

public:
statickc::ks_ptr<GearedCompoundBody>create(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>component_bodies);

virtual~GearedCompoundBody();

std::string_viewtypeString()constnoexceptoverride{
staticstd::stringtype_string="Karana::Dynamics::GearedCompoundBody";
returntype_string;
}

GearedCompoundBody(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>bodies_tree);

voidsetGearRatio(doublegear_ratio){_gear_ratio=gear_ratio;}

protected:
void_updateDependentQ(constkm::Vec&min_Q,//NOLINT(readability-identifier-naming)
boolglobal)constoverride;

km::Mat_constraintX()constoverride;

km::Vec_constraintXdotU(constkm::Vec&U)constoverride;

//km::Mat_invConstraintX()constoverride;

protected:
double_gear_ratio;
};

classLoopsCompoundBody:publicCECompoundBody{

public:
statickc::ks_ptr<LoopsCompoundBody>
create(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>component_bodies,
conststd::vector<kc::ks_ptr<PhysicalBody>>&indep_bodies);

statickc::ks_ptr<LoopsCompoundBody>
create(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>component_bodies,
conststd::vector<unsignedint>
&indep_indices_U,//NOLINT(readability-identifier-naming)
conststd::vector<unsignedint>
&indep_indices_Q//NOLINT(readability-identifier-naming)
={});

virtual~LoopsCompoundBody();

std::string_viewtypeString()constnoexceptoverride{
staticstd::stringtype_string="Karana::Dynamics::LoopsCompoundBody";
returntype_string;
}

LoopsCompoundBody(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>bodies_tree,
conststd::vector<unsignedint>
&indep_indices_U,//NOLINT(readability-identifier-naming)
conststd::vector<unsignedint>
&indep_indices_Q//NOLINT(readability-identifier-naming)
={});

LoopsCompoundBody(std::string_viewname,
kc::ks_ptr<SubGraph>parent_subtree,
kc::ks_ptr<SubGraph>bodies_tree,
conststd::vector<kc::ks_ptr<PhysicalBody>>&indep_bodies);

protected:
void_updateDependentQ(constkm::Vec&min_q,boolglobal)constoverride;

km::Mat_constraintX()constoverride;

km::Vec_constraintXdotU(constkm::Vec&U)constoverride;

//km::Mat_invConstraintX()constoverride;

void_discard(kc::ks_ptr<Base>&base)override;

protected:
kc::ks_ptr<ConstraintKinematicsSolver>_cks=nullptr;

std::vector<unsignedint>_rows_Y;
std::vector<unsignedint>_rows_Ydot;

std::vector<unsignedint>_dep_indices_U;
};

}//namespaceKarana::Dynamics