Template Function pinocchio::computePotentialEnergy(const ModelTpl<Scalar, Options, JointCollectionTpl>&, DataTpl<Scalar, Options, JointCollectionTpl>&, const Eigen::MatrixBase<ConfigVectorType>&)

Function Documentation

template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl, typename ConfigVectorType>
inline Scalar pinocchio::computePotentialEnergy(const ModelTpl<Scalar, Options, JointCollectionTpl> &model, DataTpl<Scalar, Options, JointCollectionTpl> &data, const Eigen::MatrixBase<ConfigVectorType> &q)

Computes the potential energy of the system, i.e. the potential energy linked to the gravity field. The result is accessible through data.potential_energy.

Note

This potential energy are of the for \( \sum_{i} - m_{i}gh_{i} \) where:

  • \( m_{i} \) is the mass of the body \( i \),

  • \( h_{i} \) is the height of the body \( i \),

  • \( g \) is the gravity value.

Template Parameters:
  • JointCollection – Collection of Joint types.

  • ConfigVectorType – Type of the joint configuration vector.

Parameters:
  • model[in] The model structure of the rigid body system.

  • data[in] The data structure of the rigid body system.

  • q[in] The joint configuration vector (dim model.nq).

Returns:

The potential energy of the system expressed in [J].