6 #ifndef __pinocchio_multibody_constraint_generic_hpp__
7 #define __pinocchio_multibody_constraint_generic_hpp__
12 template<
int _Dim,
typename _Scalar,
int _Options,
int _MaxDim>
15 typedef _Scalar Scalar;
25 typedef Eigen::Matrix<Scalar, Dim, 1, Options, _MaxDim, 1> JointForce;
26 typedef Eigen::Matrix<Scalar, 6, Dim, Options, 6, _MaxDim> DenseBase;
27 typedef Eigen::Matrix<Scalar, Dim, Dim, Options, _MaxDim, _MaxDim> ReducedSquaredMatrix;
29 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(DenseBase) ConstMatrixReturnType;
30 typedef typename PINOCCHIO_EIGEN_REF_TYPE(DenseBase) MatrixReturnType;
32 typedef ReducedSquaredMatrix StDiagonalMatrixSOperationReturnType;
35 template<
int Dim,
typename Scalar,
int Options,
int _MaxDim>
38 typedef Eigen::Matrix<Scalar, 6, Dim, Options, 6, _MaxDim> ReturnType;
41 template<
int Dim,
typename Scalar,
int Options,
int MaxDim,
typename MotionDerived>
44 typedef Eigen::Matrix<Scalar, 6, Dim, Options, 6, MaxDim> ReturnType;
47 template<
int Dim,
typename Scalar,
int Options,
int MaxDim,
typename ForceDerived>
52 typedef Eigen::Matrix<Scalar, Dim, Dim, Options, MaxDim, MaxDim> ReturnType;
55 template<
int Dim,
typename Scalar,
int Options,
int MaxDim,
typename ForceSet>
64 template<
int _Dim,
typename _Scalar,
int _Options,
int _MaxDim>
68 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
80 constexpr
static int MaxNV = NV < 0 ? _MaxDim : NV;
91 EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(DenseBase, D);
98 _Dim != Eigen::Dynamic, YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR)
106 _Dim == Eigen::Dynamic, YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR);
107 assert(_MaxDim < 0 || dim <= _MaxDim);
111 template<
int D,
int MD>
113 : S(subspace.matrix())
116 _Dim == Eigen::Dynamic, YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR);
117 assert(_MaxDim < 0 || subspace.matrix().cols() <= _MaxDim);
125 template<
typename VectorLike>
126 JointMotion __mult__(
const Eigen::MatrixBase<VectorLike> & vj)
const
128 return JointMotion(S * vj);
139 template<
typename ForceDerived>
140 typename ConstraintForceOp<JointMotionSubspaceTpl, ForceDerived>::ReturnType
143 return (ref.S.transpose() * f.
toVector()).eval();
146 template<
typename ForceSet>
147 typename ConstraintForceSetOp<JointMotionSubspaceTpl, ForceSet>::ReturnType
148 operator*(
const Eigen::MatrixBase<ForceSet> & F)
150 return ref.S.transpose() * F.derived();
159 MatrixReturnType matrix_impl()
163 ConstMatrixReturnType matrix_impl()
const
170 return (
int)S.cols();
173 template<
typename S2,
int O2>
174 friend typename JointMotionSubspaceTpl<_Dim, _Scalar, _Options, _MaxDim>::DenseBase
175 operator*(
const InertiaTpl<S2, O2> & Y,
const JointMotionSubspaceTpl & S)
177 typedef typename JointMotionSubspaceTpl::DenseBase ReturnType;
178 ReturnType res(6, S.nv());
183 template<
typename S2,
int O2>
184 friend Eigen::Matrix<_Scalar, 6, _Dim, _Options, 6, _MaxDim>
185 operator*(
const Eigen::Matrix<S2, 6, 6, O2> & Ymatrix,
const JointMotionSubspaceTpl & S)
187 typedef Eigen::Matrix<_Scalar, 6, _Dim, _Options, 6, _MaxDim> ReturnType;
188 return ReturnType(Ymatrix * S.matrix());
191 DenseBase se3Action(
const SE3Tpl<Scalar, Options> & m)
const
193 DenseBase res(6, nv());
198 DenseBase se3ActionInverse(
const SE3Tpl<Scalar, Options> & m)
const
200 DenseBase res(6, nv());
205 template<
typename MotionDerived>
206 DenseBase motionAction(
const MotionDense<MotionDerived> & v)
const
208 DenseBase res(6, nv());
213 void disp_impl(std::ostream & os)
const
215 os <<
"S =\n" << S << std::endl;
218 bool isEqual(
const JointMotionSubspaceTpl & other)
const
229 template<
int Dim,
typename Scalar,
int Options,
int MaxDim>
237 return constraint.matrix().transpose() * constraint.matrix();
ToVectorConstReturnType toVector() const
Return the force as an Eigen vector.
static void inertiaAction(const InertiaTpl< Scalar, Options > &I, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Action of an Inertia matrix on a set of motions, represented by a 6xN matrix whose columns represent ...
static void se3ActionInverse(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iV, Eigen::MatrixBase< MatRet > const &jV)
Inverse SE3 action on a set of motions, represented by a 6xN matrix whose column represent a spatial ...
static void se3Action(const SE3Tpl< Scalar, Options > &m, const Eigen::MatrixBase< Mat > &iV, Eigen::MatrixBase< MatRet > const &jV)
SE3 action on a set of motions, represented by a 6xN matrix whose column represent a spatial motion.
static void motionAction(const MotionDense< MotionDerived > &v, const Eigen::MatrixBase< Mat > &iF, Eigen::MatrixBase< MatRet > const &jF)
Action of a motion on a set of motions, represented by a 6xN matrix whose columns represent a spatial...
Main pinocchio namespace.
Return type of the Constraint::Transpose * Force operation.
Return type of the Constraint::Transpose * ForceSet operation.
Return type of the ation of a Motion onto an object of type D.
Common traits structure to fully define base classes for CRTP.