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

Function Documentation

template<typename Scalar, int Options, template<typename, int> class JointCollectionTpl>
inline Scalar pinocchio::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. 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.

  • JointCollection – Collection of Joint types.

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

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

Returns:

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