6 #ifndef __pinocchio_multibody_constraint_base_hpp__
7 #define __pinocchio_multibody_constraint_base_hpp__
9 #include "pinocchio/macros.hpp"
10 #include "pinocchio/spatial/fwd.hpp"
11 #include "pinocchio/spatial/motion.hpp"
12 #include "pinocchio/spatial/act-on-set.hpp"
14 #include <boost/static_assert.hpp>
19 #define PINOCCHIO_CONSTRAINT_TYPEDEF_GENERIC(DERIVED, TYPENAME) \
20 typedef TYPENAME traits<DERIVED>::Scalar Scalar; \
21 typedef TYPENAME traits<DERIVED>::JointMotion JointMotion; \
22 typedef TYPENAME traits<DERIVED>::JointForce JointForce; \
23 typedef TYPENAME traits<DERIVED>::DenseBase DenseBase; \
24 typedef TYPENAME traits<DERIVED>::MatrixReturnType MatrixReturnType; \
25 typedef TYPENAME traits<DERIVED>::ConstMatrixReturnType ConstMatrixReturnType; \
28 LINEAR = traits<DERIVED>::LINEAR, \
29 ANGULAR = traits<DERIVED>::ANGULAR \
33 Options = traits<DERIVED>::Options \
36 #define PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(DERIVED) \
37 PINOCCHIO_CONSTRAINT_TYPEDEF_GENERIC(DERIVED, typename)
38 #define PINOCCHIO_CONSTRAINT_TYPEDEF(DERIVED) \
39 PINOCCHIO_CONSTRAINT_TYPEDEF_GENERIC(DERIVED, PINOCCHIO_EMPTY_ARG)
45 template<
class Constra
intDerived,
typename Force>
48 typedef ReturnTypeNotDefined ReturnType;
52 template<
class Constra
intDerived,
typename ForceSet>
55 typedef ReturnTypeNotDefined ReturnType;
58 template<
class Derived>
62 PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(Derived)
65 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69 return *
static_cast<Derived *
>(
this);
71 const Derived & derived()
const
73 return *
static_cast<const Derived *
>(
this);
76 template<
typename VectorLike>
77 JointMotion operator*(
const Eigen::MatrixBase<VectorLike> & vj)
const
79 return derived().__mult__(vj);
82 MatrixReturnType matrix()
84 return derived().matrix_impl();
86 ConstMatrixReturnType matrix()
const
88 return derived().matrix_impl();
93 return derived().nv_impl();
105 template<
class OtherDerived>
108 const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision())
const
110 return matrix().isApprox(other.matrix(), prec);
113 void disp(std::ostream & os)
const
115 derived().disp_impl(os);
125 return derived().se3Action(m);
128 typename SE3GroupAction<Derived>::ReturnType
131 return derived().se3ActionInverse(m);
134 template<
typename MotionDerived>
135 typename MotionAlgebraAction<Derived, MotionDerived>::ReturnType
138 return derived().motionAction(v);
143 return derived().isEqual(other.derived());
149 template<
typename Scalar,
int Options,
typename Constra
intDerived>
155 Y, constraint.derived());
159 template<
typename MatrixDerived,
typename Constra
intDerived>
160 typename MultiplicationOp<Eigen::MatrixBase<MatrixDerived>, ConstraintDerived>::ReturnType
162 const Eigen::MatrixBase<MatrixDerived> & Y,
166 Y.derived(), constraint.derived());
171 template<
typename Constra
int>
179 return ReducedSquaredMatrix::Identity(Constraint::NV, Constraint::NV);
184 template<
class Constra
intDerived>
188 StDiagonalMatrixSOperationReturnType;
191 template<
class Constra
intDerived>
192 typename JointMotionSubspaceTransposeBase<ConstraintDerived>::StDiagonalMatrixSOperationReturnType
Main pinocchio namespace.
Return type of the Constraint::Transpose * Force operation.
Return type of the Constraint::Transpose * ForceSet operation.
Forward declaration of the multiplication operation return type. Should be overloaded,...
Common traits structure to fully define base classes for CRTP.