6#ifdef ALIGATOR_WITH_PINOCCHIO
7#include <proxsuite-nlp/modelling/spaces/multibody.hpp>
8#include <pinocchio/multibody/data.hpp>
12template <
typename Scalar>
struct MultibodyFreeFwdDataTpl;
24template <
typename _Scalar>
25struct MultibodyFreeFwdDynamicsTpl : ODEAbstractTpl<_Scalar> {
26 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
27 using Scalar = _Scalar;
29 using Base = ODEAbstractTpl<Scalar>;
30 using BaseData = ContinuousDynamicsDataTpl<Scalar>;
31 using ContDataAbstract = ContinuousDynamicsDataTpl<Scalar>;
32 using Data = MultibodyFreeFwdDataTpl<Scalar>;
33 using Manifold = proxsuite::nlp::MultibodyPhaseSpace<Scalar>;
34 using ManifoldPtr = xyz::polymorphic<Manifold>;
39 MatrixXs actuation_matrix_;
41 const Manifold &space()
const {
return space_; }
42 int ntau()
const {
return space_.getModel().nv; }
44 MultibodyFreeFwdDynamicsTpl(
const Manifold &state,
const MatrixXs &actuation);
45 MultibodyFreeFwdDynamicsTpl(
const Manifold &state);
52 bool isUnderactuated()
const {
53 long nv = space().getModel().nv;
54 return act_matrix_rank < nv;
57 Eigen::Index getActuationMatrixRank()
const {
return act_matrix_rank; }
59 virtual void forward(
const ConstVectorRef &x,
const ConstVectorRef &u,
60 BaseData &data)
const;
61 virtual void dForward(
const ConstVectorRef &x,
const ConstVectorRef &u,
62 BaseData &data)
const;
64 shared_ptr<ContDataAbstract> createData()
const;
67 Eigen::FullPivLU<MatrixXs> lu_decomp_;
68 Eigen::Index act_matrix_rank;
71template <
typename Scalar>
72struct MultibodyFreeFwdDataTpl : ContinuousDynamicsDataTpl<Scalar> {
73 using Base = ContinuousDynamicsDataTpl<Scalar>;
74 using VectorXs =
typename math_types<Scalar>::VectorXs;
75 using MatrixXs =
typename math_types<Scalar>::MatrixXs;
76 using PinDataType = pinocchio::DataTpl<Scalar>;
80 PinDataType pin_data_;
81 MultibodyFreeFwdDataTpl(
const MultibodyFreeFwdDynamicsTpl<Scalar> *cont_dyn);
87#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
88#include "aligator/modelling/dynamics/multibody-free-fwd.txx"
#define ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
Defines a class representing ODEs.