6 #ifndef __pinocchio_joint_revolute_unaligned_hpp__ 7 #define __pinocchio_joint_revolute_unaligned_hpp__ 9 #include "pinocchio/fwd.hpp" 10 #include "pinocchio/multibody/joint/joint-base.hpp" 11 #include "pinocchio/multibody/constraint.hpp" 12 #include "pinocchio/spatial/inertia.hpp" 13 #include "pinocchio/math/matrix.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< MotionRevoluteUnalignedTpl<_Scalar,_Options> >
60 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
65 template<
typename Vector3Like,
typename OtherScalar>
67 const OtherScalar &
w)
72 inline PlainReturnType
plain()
const 74 return PlainReturnType(PlainReturnType::Vector3::Zero(),
78 template<
typename OtherScalar>
84 template<
typename MotionDerived>
90 template<
typename Derived>
94 other.
angular().noalias() = m_axis*m_w;
97 template<
typename S2,
int O2,
typename D2>
107 template<
typename S2,
int O2>
111 se3Action_impl(m,res);
115 template<
typename S2,
int O2,
typename D2>
130 template<
typename S2,
int O2>
134 se3ActionInverse_impl(m,res);
138 template<
typename M1,
typename M2>
150 template<
typename M1>
160 return m_axis == other.
m_axis && m_w == other.
m_w;
166 const Vector3 &
axis()
const {
return m_axis; }
167 Vector3 &
axis() {
return m_axis; }
175 template<
typename S1,
int O1,
typename MotionDerived>
176 inline typename MotionDerived::MotionPlain
180 typename MotionDerived::MotionPlain
res(m2);
185 template<
typename MotionDerived,
typename S2,
int O2>
186 inline typename MotionDerived::MotionPlain
195 template<
typename _Scalar,
int _Options>
210 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
213 template<
typename Scalar,
int Options>
217 template<
typename Scalar,
int Options,
typename MotionDerived>
221 template<
typename Scalar,
int Options,
typename ForceDerived>
225 typedef Eigen::Matrix<typename PINOCCHIO_EIGEN_DOT_PRODUCT_RETURN_TYPE(Vector3,typename ForceDense<ForceDerived>::ConstAngularType),1,1,
Options>
ReturnType;
228 template<
typename Scalar,
int Options,
typename ForceSet>
233 typename Eigen::MatrixBase<const ForceSet>::template NRowsBlockXpr<3>::Type
237 template<
typename _Scalar,
int _Options>
239 :
ConstraintBase< ConstraintRevoluteUnalignedTpl<_Scalar,_Options> >
241 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
250 template<
typename Vector3Like>
255 template<
typename Vector1Like>
256 JointMotion
__mult__(
const Eigen::MatrixBase<Vector1Like> &
v)
const 258 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector1Like,1);
259 return JointMotion(m_axis,v[0]);
262 template<
typename S1,
int O1>
270 res.template segment<3>(ANGULAR).noalias() = m.
rotation() * m_axis;
271 res.template segment<3>(LINEAR).noalias() = m.
translation().cross(res.template segment<3>(ANGULAR));
275 template<
typename S1,
int O1>
282 res.template segment<3>(ANGULAR).noalias() = m.
rotation().transpose() * m_axis;
283 res.template segment<3>(LINEAR).noalias() = -m.
rotation().transpose() * m.
translation().cross(m_axis);
294 template<
typename ForceDerived>
305 template<
typename ForceSet>
309 EIGEN_STATIC_ASSERT(ForceSet::RowsAtCompileTime==6,THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE)
311 return ref.
axis().transpose() * F.template middleRows<3>(ANGULAR);
327 S.template segment<3>(LINEAR).setZero();
328 S.template segment<3>(ANGULAR) = m_axis;
332 template<
typename MotionDerived>
336 const typename MotionDerived::ConstLinearType
v = m.
linear();
337 const typename MotionDerived::ConstAngularType
w = m.
angular();
340 res.template segment<3>(LINEAR).noalias() = v.cross(m_axis);
341 res.template segment<3>(ANGULAR).noalias() = w.cross(m_axis);
346 const Vector3 &
axis()
const {
return m_axis; }
347 Vector3 &
axis() {
return m_axis; }
351 return m_axis == other.
m_axis;
360 template<
typename S1,
int O1,
typename S2,
int O2>
369 template<
typename S1,
int O1,
typename S2,
int O2>
375 static inline ReturnType
run(
const Inertia & Y,
376 const Constraint & cru)
382 const typename Inertia::Vector3 &
c = Y.
lever();
385 res.template segment<3>(Inertia::LINEAR) = -m*c.cross(cru.
axis());
386 res.template segment<3>(Inertia::ANGULAR).noalias() = I*cru.
axis();
387 res.template segment<3>(Inertia::ANGULAR) += c.cross(res.template segment<3>(Inertia::LINEAR));
394 template<
typename M6Like,
typename Scalar,
int Options>
408 template<
typename M6Like,
typename Scalar,
int Options>
414 static inline ReturnType
run(
const Eigen::MatrixBase<M6Like> & Y,
415 const Constraint & cru)
417 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(M6Like,6,6);
418 return Y.derived().template middleCols<3>(Constraint::ANGULAR) * cru.
axis();
425 template<
typename _Scalar,
int _Options>
442 typedef Eigen::Matrix<Scalar,6,NV,Options>
U_t;
443 typedef Eigen::Matrix<Scalar,NV,NV,Options>
D_t;
444 typedef Eigen::Matrix<Scalar,6,NV,Options>
UD_t;
453 template<
typename Scalar,
int Options>
457 template<
typename Scalar,
int Options>
461 template<
typename _Scalar,
int _Options>
463 :
public JointDataBase< JointDataRevoluteUnalignedTpl<_Scalar,_Options> >
465 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
481 : M(Transformation_t::Identity())
482 , S(Constraint_t::Vector3::Zero())
483 , v(Constraint_t::Vector3::Zero(),(
Scalar)0)
486 , UDinv(UD_t::Zero())
489 template<
typename Vector3Like>
491 : M(Transformation_t::Identity())
496 , UDinv(UD_t::Zero())
499 static std::string
classname() {
return std::string(
"JointDataRevoluteUnaligned"); }
505 template<
typename _Scalar,
int _Options>
507 :
public JointModelBase< JointModelRevoluteUnalignedTpl<_Scalar,_Options> >
509 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
512 typedef Eigen::Matrix<Scalar,3,1,_Options>
Vector3;
531 template<
typename Vector3Like>
535 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Vector3Like);
536 assert(
isUnitary(axis) &&
"Rotation axis is not unitary");
547 template<
typename ConfigVector>
548 void calc(JointDataDerived & data,
549 const typename Eigen::MatrixBase<ConfigVector> & qs)
const 552 typedef Eigen::AngleAxis<Scalar> AngleAxis;
554 const OtherScalar &
q = qs[
idx_q()];
559 template<
typename ConfigVector,
typename TangentVector>
560 void calc(JointDataDerived & data,
561 const typename Eigen::MatrixBase<ConfigVector> & qs,
562 const typename Eigen::MatrixBase<TangentVector> & vs)
const 564 calc(data,qs.derived());
566 data.v.angularRate() =
static_cast<Scalar>(vs[
idx_v()]);
569 template<
typename Matrix6Like>
570 void calc_aba(JointDataDerived & data,
const Eigen::MatrixBase<Matrix6Like> & I,
const bool update_I)
const 572 data.U.noalias() = I.template middleCols<3>(Motion::ANGULAR) *
axis;
573 data.Dinv[0] = (
Scalar)(1)/
axis.dot(data.U.template segment<3>(Motion::ANGULAR));
574 data.UDinv.noalias() = data.U * data.Dinv;
580 static std::string
classname() {
return std::string(
"JointModelRevoluteUnaligned"); }
584 template<
typename NewScalar>
588 ReturnType
res(
axis.template cast<NewScalar>());
603 #include <boost/type_traits.hpp> 607 template<
typename Scalar,
int Options>
609 :
public integral_constant<bool,true> {};
611 template<
typename Scalar,
int Options>
613 :
public integral_constant<bool,true> {};
615 template<
typename Scalar,
int Options>
617 :
public integral_constant<bool,true> {};
619 template<
typename Scalar,
int Options>
621 :
public integral_constant<bool,true> {};
625 #endif // ifndef __pinocchio_joint_revolute_unaligned_hpp__ JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > const Eigen::MatrixBase< TangentVectorType > & v
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
MotionTpl< Scalar, Options > ReturnType
void se3Action_impl(const SE3Tpl< S2, O2 > &m, MotionDense< D2 > &v) const
Forward declaration of the multiplication operation return type. Should be overloaded, otherwise it will procude a compilation error.
DenseBase matrix_impl() const
traits< ConstraintRevoluteUnalignedTpl< Scalar, Options > >::Vector3 Vector3
InertiaTpl< S1, O1 > Inertia
int idx_q(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxQVisitor to get the index in the full model configuration space...
JointDataRevoluteUnalignedTpl()
const Scalar & angularRate() const
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...
ConstraintForceOp< ConstraintRevoluteUnalignedTpl, ForceDerived >::ReturnType operator*(const ForceDense< ForceDerived > &f) const
Return type of the Constraint::Transpose * ForceSet operation.
ConstraintRevoluteUnalignedTpl< Scalar, Options > Constraint_t
MatrixMatrixProduct< Eigen::Transpose< const Vector3 >, typename Eigen::MatrixBase< const ForceSet >::template NRowsBlockXpr< 3 >::Type >::type ReturnType
Eigen::Matrix< Scalar, NV, 1, Options > TangentVector_t
Return type of the ation of a Motion onto an object of type D.
#define MOTION_TYPEDEF_TPL(Derived)
const Vector3 & axis() const
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
void setTo(MotionDense< Derived > &other) const
void addTo(MotionDense< MotionDerived > &v) const
Eigen::Matrix< Scalar, 6, 1, Options > Vector6
PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE typedef Eigen::Matrix< Scalar, NQ, 1, Options > ConfigVector_t
MotionRevoluteUnalignedTpl()
static ReturnType run(const Eigen::MatrixBase< M6Like > &Y, const Constraint &cru)
JointModelRevoluteUnalignedTpl()
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, 6, 1, Options > DenseBase
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
void calc_aba(JointDataDerived &data, const Eigen::MatrixBase< Matrix6Like > &I, const bool update_I) const
JointRevoluteUnalignedTpl< Scalar, Options > JointDerived
MultiplicationOp< Inertia, Constraint >::ReturnType ReturnType
Eigen::Matrix< Scalar, 3, 1, _Options > Vector3
MotionAlgebraAction< ConstraintRevoluteUnalignedTpl, MotionDerived >::ReturnType motionAction(const MotionDense< MotionDerived > &m) const
Eigen::Matrix< Scalar, NV, NV, Options > D_t
static std::string classname()
Eigen::Matrix< Scalar, 6, NV, Options > UD_t
ConstAngularType angular() const
Return the angular part of the force vector.
MotionRevoluteUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis, const OtherScalar &w)
bool isEqual(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel_generic, const JointModelBase< JointModelDerived > &jmodel)
Visit a JointModelTpl<Scalar,...> to compare it to JointModelDerived.
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
#define PINOCCHIO_EIGEN_CONST_CAST(TYPE, OBJ)
Macro for an automatic const_cast.
bool isUnitary(const Eigen::MatrixBase< MatrixLike > &mat, const typename MatrixLike::RealScalar &prec=Eigen::NumTraits< typename MatrixLike::Scalar >::dummy_precision())
Check whether the input matrix is Unitary within the given precision.
MotionRevoluteUnalignedTpl< Scalar, Options > JointMotion
MotionDerived::MotionPlain operator+(const MotionPlanarTpl< Scalar, Options > &m1, const MotionDense< MotionDerived > &m2)
void se3ActionInverse_impl(const SE3Tpl< S2, O2 > &m, MotionDense< D2 > &v) const
Eigen::internal::remove_const< M6LikeCols >::type M6LikeColsNonConst
SE3GroupAction< ConstraintRevoluteUnalignedTpl >::ReturnType se3Action(const SE3Tpl< S1, O1 > &m) const
MotionPlain motionAction(const MotionDense< M1 > &v) const
Vector3 axis
3d main axis of the joint.
const Vector3 ConstLinearType
traits< ConstraintRevoluteUnalignedTpl< Scalar, Options > >::Vector3 Vector3
#define PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
ConstraintRevoluteUnalignedTpl< Scalar, Options > Constraint
Eigen::Matrix< Scalar, 6, 1, Options > ReturnType
void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs, const typename Eigen::MatrixBase< TangentVector > &vs) const
const Symmetric3 & inertia() const
const Vector3 ConstAngularType
const Vector3 & lever() const
JointModelBase< JointModelRevoluteUnalignedTpl > Base
ConstLinearType linear() const
Constraint::Vector3 Vector3
static ReturnType run(const Inertia &Y, const Constraint &cru)
#define PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(Joint)
SE3GroupAction< ConstraintRevoluteUnalignedTpl >::ReturnType se3ActionInverse(const SE3Tpl< S1, O1 > &m) const
ConstraintRevoluteUnalignedTpl< Scalar, Options > Constraint
ConstraintRevoluteUnalignedTpl< S2, O2 > Constraint
MotionRevoluteUnalignedTpl< double > MotionRevoluteUnaligned
MotionPlain se3ActionInverse_impl(const SE3Tpl< S2, O2 > &m) const
ConstLinearRef translation() const
PINOCCHIO_JOINT_CAST_TYPE_SPECIALIZATION(JointModelFreeFlyerTpl)
void motionAction(const MotionDense< M1 > &v, MotionDense< M2 > &mout) const
bool isEqual_impl(const MotionRevoluteUnalignedTpl &other) const
const DenseBase ConstMatrixReturnType
MotionPlain se3Action_impl(const SE3Tpl< S2, O2 > &m) const
DenseBase MatrixReturnType
#define PINOCCHIO_EIGEN_REF_TYPE(D)
ConstraintRevoluteUnalignedTpl()
JointModelRevoluteUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis)
PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR Transformation_t M
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
JointModelRevoluteUnalignedTpl(const Scalar &x, const Scalar &y, const Scalar &z)
Main pinocchio namespace.
ReturnTypeNotDefined ReturnType
Eigen::Matrix< typename PINOCCHIO_EIGEN_DOT_PRODUCT_RETURN_TYPE(Vector3, typename ForceDense< ForceDerived >::ConstAngularType), 1, 1, Options > ReturnType
bool isEqual(const JointModelRevoluteUnalignedTpl &other) const
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...
PlainReturnType plain() const
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointRevoluteUnalignedTpl< _Scalar, _Options > JointDerived
Eigen::Matrix< Scalar, 6, NV, Options > U_t
TransposeConst transpose() const
Common traits structure to fully define base classes for CRTP.
MultiplicationOp< Eigen::MatrixBase< M6Like >, Constraint >::ReturnType ReturnType
Symmetric3Tpl< double, 0 > Symmetric3
Eigen::Matrix< S2, 6, 1, O2 > ReturnType
static std::string classname()
std::string shortname() const
Eigen::Matrix< Scalar, 1, 1, Options > JointForce
JointMotion __mult__(const Eigen::MatrixBase< Vector1Like > &v) const
MotionTpl< Scalar, Options > ReturnType
void toRotationMatrix(const Eigen::MatrixBase< Vector3 > &axis, const Scalar &cos_value, const Scalar &sin_value, const Eigen::MatrixBase< Matrix3 > &res)
Computes a rotation matrix from a vector and values of sin and cos orientations values.
#define PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(DERIVED)
MotionRevoluteUnalignedTpl __mult__(const OtherScalar &alpha) const
const MatrixMatrixProduct< M6LikeColsNonConst, Vector3 >::type ReturnType
Eigen::Matrix< Scalar, 6, 1, Options > ReturnType
ConstraintForceSetOp< ConstraintRevoluteUnalignedTpl, ForceSet >::ReturnType operator*(const Eigen::MatrixBase< ForceSet > &F)
Eigen::ProductReturnType< M1, M2 >::Type type
traits< ConstraintRevoluteUnalignedTpl >::Vector3 Vector3
JointModelRevoluteUnalignedTpl< Scalar, Options > JointModelDerived
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...
JointDataRevoluteUnalignedTpl< Scalar, Options > JointDataDerived
TransposeConst(const ConstraintRevoluteUnalignedTpl &ref)
JointDataDerived createData() const
JointModelRevoluteUnalignedTpl< NewScalar, Options > cast() const
MotionDerived::MotionPlain operator^(const MotionDense< MotionDerived > &m1, const MotionPlanarTpl< S2, O2 > &m2)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef JointRevoluteUnalignedTpl< _Scalar, _Options > JointDerived
SE3Tpl< Scalar, Options > Transformation_t
std::string shortname() const
MotionZeroTpl< Scalar, Options > Bias_t
Return type of the Constraint::Transpose * Force operation.
void calc(JointDataDerived &data, const typename Eigen::MatrixBase< ConfigVector > &qs) const
JointDataRevoluteUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis)
ConstAngularRef rotation() const
MotionRevoluteUnalignedTpl< Scalar, Options > Motion_t
ReturnTypeNotDefined ReturnType
ConstraintRevoluteUnalignedTpl(const Eigen::MatrixBase< Vector3Like > &axis)
SizeDepType< 3 >::ColsReturn< M6Like >::ConstType M6LikeCols
const Vector3 & axis() const
bool isEqual(const ConstraintRevoluteUnalignedTpl &other) const
JointRevoluteUnalignedTpl< Scalar, Options > JointDerived
const ConstraintRevoluteUnalignedTpl & ref
#define PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(Joint)