13 #include <boost/fusion/container/vector.hpp>
15 #include "pinocchio/macros.hpp"
16 #include "pinocchio/eigen-common.hpp"
18 #include "pinocchio/src/utils/check.hxx"
20 #include "pinocchio/math.hpp"
22 #include "pinocchio/spatial.hpp"
24 #include "pinocchio/multibody.hpp"
25 #include "pinocchio/multibody/joint.hpp"
26 #include "pinocchio/multibody/visitor.hpp"
28 #include "pinocchio/algorithm/check.hpp"
29 #include "pinocchio/algorithm/kinematics.hpp"
43 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
44 inline Scalar
computeTotalMass(
const ModelTpl<Scalar, Options, JointCollectionTpl> & model);
57 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
59 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
60 DataTpl<Scalar, Options, JointCollectionTpl> & data);
72 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
74 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
75 DataTpl<Scalar, Options, JointCollectionTpl> & data);
98 template<
typename,
int>
class JointCollectionTpl,
99 typename ConfigVectorType>
100 const typename DataTpl<Scalar, Options, JointCollectionTpl>::Vector3 &
centerOfMass(
101 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
102 DataTpl<Scalar, Options, JointCollectionTpl> & data,
103 const Eigen::MatrixBase<ConfigVectorType> & q,
104 const bool computeSubtreeComs =
true);
130 template<
typename,
int>
class JointCollectionTpl,
131 typename ConfigVectorType,
132 typename TangentVectorType>
133 const typename DataTpl<Scalar, Options, JointCollectionTpl>::Vector3 &
centerOfMass(
134 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
135 DataTpl<Scalar, Options, JointCollectionTpl> & data,
136 const Eigen::MatrixBase<ConfigVectorType> & q,
137 const Eigen::MatrixBase<TangentVectorType> & v,
138 const bool computeSubtreeComs =
true);
166 template<
typename,
int>
class JointCollectionTpl,
167 typename ConfigVectorType,
168 typename TangentVectorType1,
169 typename TangentVectorType2>
170 const typename DataTpl<Scalar, Options, JointCollectionTpl>::Vector3 &
centerOfMass(
171 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
172 DataTpl<Scalar, Options, JointCollectionTpl> & data,
173 const Eigen::MatrixBase<ConfigVectorType> & q,
174 const Eigen::MatrixBase<TangentVectorType1> & v,
175 const Eigen::MatrixBase<TangentVectorType2> & a,
176 const bool computeSubtreeComs =
true);
194 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
195 const typename DataTpl<Scalar, Options, JointCollectionTpl>::Vector3 &
centerOfMass(
196 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
197 DataTpl<Scalar, Options, JointCollectionTpl> & data,
198 KinematicLevel kinematic_level,
199 const bool computeSubtreeComs =
true);
215 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
216 const typename DataTpl<Scalar, Options, JointCollectionTpl>::Vector3 &
centerOfMass(
217 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
218 DataTpl<Scalar, Options, JointCollectionTpl> & data,
219 const bool computeSubtreeComs =
true)
221 return centerOfMass(model, data, ACCELERATION, computeSubtreeComs);
247 template<
typename,
int>
class JointCollectionTpl,
248 typename ConfigVectorType>
250 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
251 DataTpl<Scalar, Options, JointCollectionTpl> & data,
252 const Eigen::MatrixBase<ConfigVectorType> & q,
253 const bool computeSubtreeComs =
true);
275 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
277 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
278 DataTpl<Scalar, Options, JointCollectionTpl> & data,
279 const bool computeSubtreeComs =
true);
301 template<
typename,
int>
class JointCollectionTpl,
302 typename ConfigVectorType,
303 typename Matrix3xLike>
305 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
306 DataTpl<Scalar, Options, JointCollectionTpl> & data,
307 const Eigen::MatrixBase<ConfigVectorType> & q,
308 const JointIndex & rootSubtreeId,
309 const Eigen::MatrixBase<Matrix3xLike> & res);
328 template<
typename,
int>
class JointCollectionTpl,
329 typename Matrix3xLike>
331 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
332 DataTpl<Scalar, Options, JointCollectionTpl> & data,
333 const JointIndex & rootSubtreeId,
334 const Eigen::MatrixBase<Matrix3xLike> & res);
354 template<
typename,
int>
class JointCollectionTpl,
355 typename Matrix3xLike>
357 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
358 const DataTpl<Scalar, Options, JointCollectionTpl> & data,
359 const JointIndex & rootSubtreeId,
360 const Eigen::MatrixBase<Matrix3xLike> & res);
380 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
381 const typename DataTpl<Scalar, Options, JointCollectionTpl>::Vector3 &
getComFromCrba(
382 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
383 DataTpl<Scalar, Options, JointCollectionTpl> & data);
400 template<
typename Scalar,
int Options,
template<
typename,
int>
class JointCollectionTpl>
402 const ModelTpl<Scalar, Options, JointCollectionTpl> & model,
403 DataTpl<Scalar, Options, JointCollectionTpl> & data);
408 #include "pinocchio/src/algorithm/center-of-mass.hxx"
Main pinocchio namespace.
void computeSubtreeMasses(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Compute the mass of each kinematic subtree and store it in data.mass. The element mass[0] corresponds...
Scalar computeTotalMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model)
Compute the total mass of the model and return it.
void jacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Computes the Jacobian of the center of mass of the given subtree according to a particular joint conf...
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix3x & jacobianCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool computeSubtreeComs=true)
Computes both the jacobian and the the center of mass position of a given model according to a partic...
const DataTpl< Scalar, Options, JointCollectionTpl >::Vector3 & centerOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool computeSubtreeComs=true)
Computes the center of mass position of a given model according to a particular joint configuration....
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix3x & getJacobianComFromCrba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Extracts both the jacobian of the center of mass (CoM), the total mass of the system and the CoM posi...
const DataTpl< Scalar, Options, JointCollectionTpl >::Vector3 & getComFromCrba(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data)
Extracts the center of mass position from the joint space inertia matrix (also called the mass matrix...
void getJacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Retrieves the Jacobian of the center of mass of the given subtree according to the current value stor...