6 #ifndef __pinocchio_joint_translation_hpp__ 7 #define __pinocchio_joint_translation_hpp__ 9 #include "pinocchio/macros.hpp" 10 #include "pinocchio/multibody/joint/joint-base.hpp" 11 #include "pinocchio/multibody/constraint.hpp" 12 #include "pinocchio/spatial/inertia.hpp" 13 #include "pinocchio/spatial/skew.hpp" 21 template<
typename Scalar,
int Options>
27 template<
typename Scalar,
int Options,
typename MotionDerived>
33 template<
typename _Scalar,
int _Options>
38 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
39 typedef Eigen::Matrix<Scalar,6,1,Options>
Vector6;
40 typedef Eigen::Matrix<Scalar,6,6,Options>
Matrix6;
56 template<
typename _Scalar,
int _Options>
58 :
MotionBase< MotionTranslationTpl<_Scalar,_Options> >
60 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
66 template<
typename Vector3Like>
78 inline PlainReturnType
plain()
const 80 return PlainReturnType(m_v,PlainReturnType::Vector3::Zero());
85 return m_v == other.
m_v;
94 template<
typename Derived>
100 template<
typename Derived>
107 template<
typename S2,
int O2,
typename D2>
114 template<
typename S2,
int O2>
118 se3Action_impl(m,res);
122 template<
typename S2,
int O2,
typename D2>
132 template<
typename S2,
int O2>
136 se3ActionInverse_impl(m,res);
140 template<
typename M1,
typename M2>
150 template<
typename M1>
158 const Vector3 &
linear()
const {
return m_v; }
167 template<
typename S1,
int O1,
typename MotionDerived>
168 inline typename MotionDerived::MotionPlain
177 template<
typename _Scalar,
int _Options>
187 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
188 typedef Eigen::Matrix<Scalar,3,3,Options>
Matrix3;
199 template<
typename Scalar,
int Options>
203 template<
typename _Scalar,
int _Options>
205 :
SE3Base< TransformTranslationTpl<_Scalar,_Options> >
207 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
213 template<
typename Vector3Like>
215 : m_translation(translation)
220 PlainType
res(PlainType::Identity());
221 res.rotation().setIdentity();
222 res.translation() = translation();
227 operator PlainType()
const {
return plain(); }
229 template<
typename S2,
int O2>
235 res.translation() += translation();
243 AngularType
rotation()
const {
return AngularType(3,3); }
257 template<
typename _Scalar,
int _Options>
263 enum { LINEAR = 0, ANGULAR = 3 };
273 template<
typename _Scalar,
int _Options>
277 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
289 template<
typename Vector3Like>
290 JointMotion
__mult__(
const Eigen::MatrixBase<Vector3Like> &
v)
const 292 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3);
293 return JointMotion(v);
303 template<
typename Derived>
311 template<
typename MatrixDerived>
313 operator*(
const Eigen::MatrixBase<MatrixDerived> & F)
const 316 return F.derived().template middleRows<3>(LINEAR);
326 S.template middleRows<3>(LINEAR).setIdentity();
327 S.template middleRows<3>(ANGULAR).setZero();
331 template<
typename S1,
int O1>
334 Eigen::Matrix<S1,6,3,O1>
M;
335 M.template middleRows<3>(LINEAR) = m.
rotation();
336 M.template middleRows<3>(ANGULAR).setZero();
341 template<
typename S1,
int O1>
344 Eigen::Matrix<S1,6,3,O1>
M;
345 M.template middleRows<3>(LINEAR) = m.
rotation().transpose();
346 M.template middleRows<3>(ANGULAR).setZero();
351 template<
typename MotionDerived>
354 const typename MotionDerived::ConstAngularType
w = m.
angular();
357 skew(w,res.template middleRows<3>(LINEAR));
358 res.template middleRows<3>(ANGULAR).setZero();
367 template<
typename MotionDerived,
typename S2,
int O2>
368 inline typename MotionDerived::MotionPlain
376 template<
typename S1,
int O1,
typename S2,
int O2>
377 inline Eigen::Matrix<S2,6,3,O2>
382 Eigen::Matrix<S2,6,3,O2>
M;
384 M.template middleRows<3>(Constraint::LINEAR).setZero();
385 M.template middleRows<3>(Constraint::LINEAR).diagonal().fill(Y.
mass ());
391 template<
typename M6Like,
typename S2,
int O2>
397 return Y.
derived().template middleCols<3>(Constraint::LINEAR);
400 template<
typename S1,
int O1>
404 template<
typename S1,
int O1,
typename MotionDerived>
410 template<
typename _Scalar,
int _Options>
427 typedef Eigen::Matrix<Scalar,6,NV,Options>
U_t;
428 typedef Eigen::Matrix<Scalar,NV,NV,Options>
D_t;
429 typedef Eigen::Matrix<Scalar,6,NV,Options>
UD_t;
437 template<
typename Scalar,
int Options>
441 template<
typename Scalar,
int Options>
445 template<
typename _Scalar,
int _Options>
447 :
public JointDataBase< JointDataTranslationTpl<_Scalar,_Options> >
449 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
466 : M(Transformation_t::Vector3::Zero())
467 , v(Motion_t::Vector3::Zero())
470 , UDinv(UD_t::Zero())
473 static std::string
classname() {
return std::string(
"JointDataTranslation"); }
478 template<
typename _Scalar,
int _Options>
480 :
public JointModelBase< JointModelTranslationTpl<_Scalar,_Options> >
482 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
493 JointDataDerived
createData()
const {
return JointDataDerived(); }
495 template<
typename ConfigVector>
496 void calc(JointDataDerived & data,
497 const typename Eigen::MatrixBase<ConfigVector> & qs)
const 499 data.M.translation() = this->jointConfigSelector(qs);
502 template<
typename ConfigVector,
typename TangentVector>
503 void calc(JointDataDerived & data,
504 const typename Eigen::MatrixBase<ConfigVector> & qs,
505 const typename Eigen::MatrixBase<TangentVector> & vs)
const 507 calc(data,qs.derived());
509 data.v.linear() = this->jointVelocitySelector(vs);
512 template<
typename Matrix6Like>
514 const Eigen::MatrixBase<Matrix6Like> & I,
515 const bool update_I)
const 517 data.U = I.template middleCols<3>(Inertia::LINEAR);
524 data.UDinv.template middleRows<3>(Inertia::LINEAR).setIdentity();
525 data.UDinv.template middleRows<3>(Inertia::ANGULAR).noalias() = data.U.template middleRows<3>(Inertia::ANGULAR) * data.Dinv;
530 I_.template block<3,3>(Inertia::ANGULAR,Inertia::ANGULAR)
531 -= data.UDinv.template middleRows<3>(Inertia::ANGULAR) * I_.template block<3,3>(Inertia::LINEAR, Inertia::ANGULAR);
532 I_.template middleCols<3>(Inertia::LINEAR).setZero();
533 I_.template block<3,3>(Inertia::LINEAR,Inertia::ANGULAR).setZero();
537 static std::string
classname() {
return std::string(
"JointModelTranslation"); }
541 template<
typename NewScalar>
554 #include <boost/type_traits.hpp> 558 template<
typename Scalar,
int Options>
560 :
public integral_constant<bool,true> {};
562 template<
typename Scalar,
int Options>
564 :
public integral_constant<bool,true> {};
566 template<
typename Scalar,
int Options>
568 :
public integral_constant<bool,true> {};
570 template<
typename Scalar,
int Options>
572 :
public integral_constant<bool,true> {};
575 #endif // ifndef __pinocchio_joint_translation_hpp__ JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
#define PINOCCHIO_SE3_TYPEDEF_TPL(Derived)
ConstraintTranslationTpl()
MotionTpl< Scalar, Options > ReturnType
void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs) const
const DenseBase ConstMatrixReturnType
int idx_q(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxQVisitor to get the index in the full model configuration space...
static std::string classname()
std::string shortname() const
MotionZeroTpl< Scalar, Options > Bias_t
MotionTpl< Scalar, Options > ReturnType
int idx_v(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxVVisitor to get the index in the full model tangent space corre...
Eigen::Matrix< Scalar, NV, NV, Options > D_t
Eigen::Matrix< S1, 6, 3, O1 > se3ActionInverse(const SE3Tpl< S1, O1 > &m) const
Return type of the ation of a Motion onto an object of type D.
#define MOTION_TYPEDEF_TPL(Derived)
JointDataTranslationTpl< Scalar, Options > JointDataDerived
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
void addTo(MotionDense< Derived > &other) const
JointIndex id(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdVisitor to get the index of the joint in the kinematic chain...
#define PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
Eigen::Matrix< Scalar, 3, 1, Options > JointForce
void se3Action_impl(const SE3Tpl< S2, O2 > &m, MotionDense< D2 > &v) const
const Vector3 & operator()() const
PlainReturnType plain() const
Eigen::Matrix< Scalar, 6, NV, Options > UD_t
MotionPlain se3Action_impl(const SE3Tpl< S2, O2 > &m) const
ConstraintTranspose(const ConstraintTranslationTpl &ref)
ConstraintTranspose transpose() const
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
Eigen::Matrix< Scalar, 6, 3, Options > DenseBase
MotionDerived::MotionPlain operator+(const MotionPlanarTpl< Scalar, Options > &m1, const MotionDense< MotionDerived > &m2)
JointModelTranslationTpl< Scalar, Options > JointModelDerived
const Vector3 ConstLinearType
TransformTranslationTpl< Scalar, Options > Transformation_t
PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR Constraint_t S
MotionTranslationTpl< Scalar, Options > Motion_t
#define PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
ConstLinearType linear() const
Return the linear part of the force vector.
Eigen::Matrix< S1, 6, 3, O1 > ReturnType
PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE typedef Eigen::Matrix< Scalar, NQ, 1, Options > ConfigVector_t
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointTranslationTpl< _Scalar, _Options > JointDerived
void se3ActionInverse_impl(const SE3Tpl< S2, O2 > &m, MotionDense< D2 > &v) const
const Vector3 & lever() const
MotionTranslationTpl< Scalar, Options > JointMotion
ConstLinearType linear() const
JointTranslationTpl< Scalar, Options > JointDerived
#define PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(Joint)
const SizeDepType< 3 >::RowsReturn< MatrixDerived >::ConstType operator*(const Eigen::MatrixBase< MatrixDerived > &F) const
const Vector3 ConstAngularType
DenseBase MatrixReturnType
const ConstraintTranslationTpl & ref
JointDataDerived createData() const
std::string shortname() const
ConstraintTranslationTpl< Scalar, Options > Constraint_t
PINOCCHIO_JOINT_CAST_TYPE_SPECIALIZATION(JointModelFreeFlyerTpl)
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
JointMotion __mult__(const Eigen::MatrixBase< Vector3Like > &v) const
void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs, const typename Eigen::MatrixBase< TangentVector > &vs) const
MotionTranslationTpl(const Eigen::MatrixBase< Vector3Like > &v)
MotionTranslationTpl< double > MotionTranslation
JointModelTranslationTpl< NewScalar, Options > cast() const
#define PINOCCHIO_EIGEN_REF_TYPE(D)
bool isEqual(const ConstraintTranslationTpl &) const
Main pinocchio namespace.
Base class for rigid transformation.
void setTo(MotionDense< Derived > &other) const
MotionPlain se3ActionInverse_impl(const SE3Tpl< S2, O2 > &m) const
Eigen::Matrix< Scalar, 6, 1, Options > Vector6
JointTranslationTpl< Scalar, Options > JointDerived
void setIndexes(JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel, JointIndex id, int q, int v)
Visit a JointModelTpl through JointSetIndexesVisitor to set the indexes of the joint in the kinematic...
JointDataTranslationTpl()
bool isEqual_impl(const MotionTranslationTpl &other) const
void alphaSkew(const Scalar alpha, const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3 > &M)
Computes the skew representation of a given 3d vector multiplied by a given scalar. i.e. the antisymmetric matrix representation of the cross product operator ( )
void calc_aba(JointDataDerived &data, const Eigen::MatrixBase< Matrix6Like > &I, const bool update_I) const
Common traits structure to fully define base classes for CRTP.
DenseBase motionAction(const MotionDense< MotionDerived > &m) const
Eigen::Matrix< Scalar, NV, 1, Options > TangentVector_t
Eigen::Matrix< S1, 6, 3, O1 > se3Action(const SE3Tpl< S1, O1 > &m) const
JointModelBase< JointModelTranslationTpl > Base
void skew(const Eigen::MatrixBase< Vector3 > &v, const Eigen::MatrixBase< Matrix3 > &M)
Computes the skew representation of a given 3d vector, i.e. the antisymmetric matrix representation o...
#define PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(DERIVED)
void motionAction(const MotionDense< M1 > &v, MotionDense< M2 > &mout) const
Eigen::Matrix< Scalar, 6, NV, Options > U_t
MotionTranslationTpl & operator=(const MotionTranslationTpl &other)
DenseBase matrix_impl() const
ConstAngularType angular() const
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 forces, represented by a 6xN matrix whose each column represent a spat...
MotionDerived::MotionPlain operator^(const MotionDense< MotionDerived > &m1, const MotionPlanarTpl< S2, O2 > &m2)
Eigen::Matrix< S1, 6, 3, O1 > ReturnType
MotionTranslationTpl(const MotionTranslationTpl &other)
static std::string classname()
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Derived & derived()
const Vector3 & linear() const
MatrixDerived plain(const Eigen::PlainObjectBase< MatrixDerived > &m)
ConstAngularRef rotation() const
MultiplicationOp< InertiaTpl< Scalar, Options >, ConstraintDerived >::ReturnType operator*(const InertiaTpl< Scalar, Options > &Y, const ConstraintBase< ConstraintDerived > &constraint)
.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointTranslationTpl< _Scalar, _Options > JointDerived
#define PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(Joint)
MotionPlain motionAction(const MotionDense< M1 > &v) const