energy.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2020 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_algorithm_energy_hpp__
6 #define __pinocchio_algorithm_energy_hpp__
7 
8 #include "pinocchio/multibody/model.hpp"
9 #include "pinocchio/multibody/data.hpp"
10 #include "pinocchio/algorithm/kinematics.hpp"
11 #include "pinocchio/algorithm/check.hpp"
12 
13 namespace pinocchio {
14 
26  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
27  inline Scalar
28  computeKineticEnergy(const ModelTpl<Scalar,Options,JointCollectionTpl> & model,
29  DataTpl<Scalar,Options,JointCollectionTpl> & data);
30 
46  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType, typename TangentVectorType>
47  inline Scalar
50  const Eigen::MatrixBase<ConfigVectorType> & q,
51  const Eigen::MatrixBase<TangentVectorType> & v)
52  {
53  forwardKinematics(model,data,q.derived(),v.derived());
54  return computeKineticEnergy(model,data);
55  }
56 
73  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType, typename TangentVectorType>
74  PINOCCHIO_DEPRECATED
75  inline Scalar
78  const Eigen::MatrixBase<ConfigVectorType> & q,
79  const Eigen::MatrixBase<TangentVectorType> & v,
80  const bool update_kinematics)
81  {
82  if(update_kinematics)
83  return computeKineticEnergy(model,data,q.derived(),v.derived());
84  else
85  return computeKineticEnergy(model,data);
86  }
87 
106  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl>
107  inline Scalar
110 
129  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
130  inline Scalar
133  const Eigen::MatrixBase<ConfigVectorType> & q)
134  {
135  forwardKinematics(model,data,q);
136  return computePotentialEnergy(model,data);
137  }
138 
153  template<typename Scalar, int Options, template<typename,int> class JointCollectionTpl, typename ConfigVectorType>
154  PINOCCHIO_DEPRECATED
155  inline Scalar
158  const Eigen::MatrixBase<ConfigVectorType> & q,
159  const bool update_kinematics)
160  {
161  if(update_kinematics)
162  return computePotentialEnergy(model,data,q);
163  else
164  return computePotentialEnergy(model,data);
165  }
166 }
167 
168 #include "pinocchio/algorithm/energy.hxx"
169 
170 #endif // __pinocchio_algorithm_energy_hpp__
Scalar computePotentialEnergy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Computes the potential energy of the system, i.e. the potential energy linked to the gravity field...
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
PINOCCHIO_DEPRECATED Scalar kineticEnergy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType > &v, const bool update_kinematics)
Computes the kinetic energy of the system. The result is accessible through data.kinetic_energy.
Definition: energy.hpp:76
data
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
SE3::Scalar Scalar
Definition: conversions.cpp:13
void forwardKinematics(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q)
Update the joint placements according to the current joint configuration.
Main pinocchio namespace.
Definition: timings.cpp:30
Scalar computeKineticEnergy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Computes the kinetic energy of the system. The result is accessible through data.kinetic_energy.
PINOCCHIO_DEPRECATED Scalar potentialEnergy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool update_kinematics)
Computes the potential energy of the system, i.e. the potential energy linked to the gravity field...
Definition: energy.hpp:156
JointCollectionTpl & model


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:02