18 #ifndef __se3_energy_hpp__ 19 #define __se3_energy_hpp__ 21 #include "pinocchio/multibody/model.hpp" 22 #include "pinocchio/multibody/data.hpp" 23 #include "pinocchio/algorithm/kinematics.hpp" 24 #include "pinocchio/algorithm/check.hpp" 42 const Eigen::VectorXd & q,
43 const Eigen::VectorXd & v,
44 const bool update_kinematics =
true);
59 const Eigen::VectorXd & q,
60 const bool update_kinematics =
true);
72 const Eigen::VectorXd & q,
73 const Eigen::VectorXd & v,
74 const bool update_kinematics)
76 assert(model.
check(data) &&
"data is not consistent with model.");
80 if (update_kinematics)
83 for(Model::JointIndex i=1;i<(Model::JointIndex)(model.
njoints);++i)
93 const Eigen::VectorXd & q,
94 const bool update_kinematics)
96 assert(model.
check(data) &&
"data is not consistent with model.");
99 const Motion::ConstLinearType & g = model.
gravity.linear();
100 SE3::Vector3 com_global;
102 if (update_kinematics)
105 for(Model::JointIndex i=1;i<(Model::JointIndex)(model.
njoints);++i)
107 com_global = data.
oMi[i].translation() + data.
oMi[i].rotation() * model.
inertias[i].lever();
114 #endif // __se3_energy_hpp__ double potential_energy
Potential energy of the model.
double potentialEnergy(const Model &model, Data &data, const Eigen::VectorXd &q, const bool update_kinematics=true)
Computes the potential energy of the system, i.e. the potential energy linked to the gravity field...
double kineticEnergy(const Model &model, Data &data, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const bool update_kinematics=true)
Computes the kinetic energy of the system. The result is accessible through data.kinetic_energy.
double kinetic_energy
Kinetic energy of the model.
Motion gravity
Spatial gravity of the model.
void forwardKinematics(const Model &model, Data &data, const Eigen::VectorXd &q)
Update the joint placements according to the current joint configuration.
container::aligned_vector< SE3 > oMi
Vector of absolute joint placements (wrt the world).
bool check(const AlgorithmCheckerBase< D > &checker=AlgorithmCheckerBase< D >()) const
container::aligned_vector< Inertia > inertias
Spatial inertias of the body i expressed in the supporting joint frame i.
container::aligned_vector< Motion > v
Vector of joint velocities expressed at the centers of the joints.
int njoints
Number of joints.