Program Listing for File Algorithms.h

Program Listing for File Algorithms.h#

Return to documentation for file (include/Karana/SOADyn/Algorithms.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/Math/StateSpace.h"
#include"Karana/SOADyn/SubGraph.h"

namespaceKarana::Dynamics{
namespacekc=Karana::Core;

classSubGraph;
classSubTree;
classConstraintKinematicsSolver;
classMultiJacobianGenerator;
classPhysicalSubhinge;

classAlgorithms{

public:
staticdoubleevalKineticEnergy(constSubTree&st);

statickm::Vec3evalCmLocation(constSubTree&st);

statickm::SpatialVectorevalSpatialMomentum(constSubTree&st);

statickm::SpatialVectorevalCentroidalMomentum(SubTree&st);

statickm::MatevalCentroidalMomentumMatrix(SubTree&st);

statickm::MatevalTreeMassMatrixCRB(SubTree&st,
kc::ks_ptr<CoordData>coord_data=nullptr);

statickm::MatevalTreeMassMatrixInvDyn(SubTree&st,
kc::ks_ptr<CoordData>coord_data=nullptr);

statickm::MatevalTreeMassMatrixInvFwdDyn(SubTree&st,kc::ks_ptr<CoordData>coord_data);

statickm::MatevalSerialChainMassMatrixInverse(SubTree&st,
kc::ks_ptr<CoordData>coord_data=nullptr);
statickm::MatevalTreeMassMatrixInverse(SubTree&st,
kc::ks_ptr<CoordData>coord_data=nullptr);

staticvoidevalInverseDynamics(SubTree&st);

staticvoidevalTreeForwardDynamics(SubTree&st);

staticvoidevalTAForwardDynamics(SubGraph&sg);

staticvoidevalBaumgarteForwardDynamics(SubGraph&sg,doublestiffness,doubledamping);

statickm::VecevalComputedTorque(SubTree&st);

statickm::VecevalGravityCompensation(SubTree&st);

statickm::MatevalVelocityConstraintMatrix(SubGraph&sg,boolwith_constraints);

staticstd::vector<unsignedint>
evalIndepPoseCoordIndices(SubGraph&sg,
conststd::vector<unsignedint>&available_indices={});

staticstd::vector<unsignedint>evalIndepPoseConstraintIndices(SubGraph&sg);

staticstd::pair<std::vector<unsignedint>,std::vector<unsignedint>>
evalIndepVelConstraintCoordIndices(SubGraph&sg,
conststd::vector<unsignedint>&available_indices={});

staticstd::pair<std::vector<unsignedint>,km::Mat>
evalVelCoordinatePartitioning(SubGraph&sg,
conststd::vector<unsignedint>&available_indices={});

statickm::MatevalDependentVelCoordinatesMatrix(
SubGraph&sg,conststd::vector<unsignedint>&indep_indices,boolfull=false);

statickm::MatevalSqueezeMatrix(SubGraph&sg);

statickm::StateSpace
stateSpaceGenerator(SubGraph&sg,
size_tn_inputs,
size_tn_outputs,
std::function<void(constkm::Vec&x,constkm::Vec&u)>u_fn,
km::lin_fny_fn);

statickm::SpatialInertiaevalSpatialInertia(constSubTree&st,
kc::ks_ptr<kf::Frame>ref_frame=nullptr);

statickc::ks_ptr<MultiJacobianGenerator>
jacobianGenerator(conststd::vector<kc::ks_ptr<kf::FrameToFrame>>&f2fs,
kc::ks_ptr<CoordData>cd);

statickc::ks_ptr<ConstraintKinematicsSolver>constraintKinematicsSolver(SubGraph&sg);

structModalAnalysis{
km::Vecw;

km::Matphi;
};

staticModalAnalysis
modalAnalysis(SubTree&st,std::function<void()>deriv_fn,doubletol=1e-3);

statickm::Mat
evalFramesOSCM(SubTree&st,
conststd::vector<kc::ks_ptr<kf::Frame>>&body_frames,
conststd::vector<kc::ks_ptr<PhysicalSubhinge>>&subhinges={});
};

}//namespaceKarana::Dynamics