39 typedef _Scalar Scalar;
44 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
45 typedef Eigen::Matrix<Scalar, 6, 1, Options> Vector6;
46 typedef Eigen::Matrix<Scalar, 4, 4, Options> Matrix4;
47 typedef Eigen::Matrix<Scalar, 6, 6, Options> Matrix6;
48 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6) ToVectorConstReturnType;
49 typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6) ToVectorReturnType;
50 typedef Vector3 AngularType;
51 typedef Vector3 LinearType;
52 typedef const Vector3 ConstAngularType;
53 typedef const Vector3 ConstLinearType;
54 typedef Matrix6 ActionMatrixType;
55 typedef Matrix4 HomogeneousMatrixType;
57 typedef MotionPlain PlainReturnType;
66 struct MotionRevoluteUnalignedTpl :
MotionBase<MotionRevoluteUnalignedTpl<_Scalar, _Options>>
68 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69 MOTION_TYPEDEF_TPL(MotionRevoluteUnalignedTpl);
71 MotionRevoluteUnalignedTpl()
75 template<
typename Vector3Like,
typename OtherScalar>
76 MotionRevoluteUnalignedTpl(
const Eigen::MatrixBase<Vector3Like> & axis,
const OtherScalar & w)
87 template<
typename OtherScalar>
88 MotionRevoluteUnalignedTpl __mult__(
const OtherScalar & alpha)
const 90 return MotionRevoluteUnalignedTpl(m_axis, alpha * m_w);
93 template<
typename MotionDerived>
96 v.angular() += m_axis * m_w;
99 template<
typename Derived>
102 other.linear().setZero();
103 other.angular().noalias() = m_axis * m_w;
106 template<
typename S2,
int O2,
typename D2>
110 v.angular().noalias() = m_w * m.rotation() * m_axis;
113 v.linear().noalias() = m.translation().cross(v.angular());
116 template<
typename S2,
int O2>
120 se3Action_impl(m, res);
124 template<
typename S2,
int O2,
typename D2>
130 v3_tmp.noalias() = m_axis.cross(m.translation());
132 v.linear().noalias() = m.rotation().transpose() * v3_tmp;
135 v.angular().noalias() = m.rotation().transpose() * m_axis;
139 template<
typename S2,
int O2>
143 se3ActionInverse_impl(m, res);
147 template<
typename M1,
typename M2>
151 mout.linear().noalias() = v.linear().cross(m_axis);
152 mout.linear() *= m_w;
155 mout.angular().noalias() = v.angular().cross(m_axis);
156 mout.angular() *= m_w;
159 template<
typename M1>
163 motionAction(v, res);
167 bool isEqual_impl(
const MotionRevoluteUnalignedTpl & other)
const 169 return internal::comparison_eq(m_axis, other.m_axis)
170 && internal::comparison_eq(m_w, other.m_w);
173 const Scalar & angularRate()
const 208 operator^(
const MotionDense<MotionDerived> & m1,
const MotionRevoluteUnalignedTpl<S2, O2> & m2)
219 typedef _Scalar Scalar;
231 typedef Eigen::Matrix<Scalar, 1, 1, Options> JointForce;
232 typedef Eigen::Matrix<Scalar, 6, 1, Options> DenseBase;
233 typedef Eigen::Matrix<Scalar, 1, 1, Options> ReducedSquaredMatrix;
235 typedef DenseBase MatrixReturnType;
236 typedef const DenseBase ConstMatrixReturnType;
238 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
240 typedef typename ReducedSquaredMatrix::IdentityReturnType StDiagonalMatrixSOperationReturnType;
282 struct JointMotionSubspaceRevoluteUnalignedTpl
285 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
286 PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(JointMotionSubspaceRevoluteUnalignedTpl)
295 JointMotionSubspaceRevoluteUnalignedTpl()
299 template<
typename Vector3Like>
300 JointMotionSubspaceRevoluteUnalignedTpl(
const Eigen::MatrixBase<Vector3Like> & axis)
305 template<
typename Vector1Like>
306 JointMotion __mult__(
const Eigen::MatrixBase<Vector1Like> & v)
const 308 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector1Like, 1);
312 template<
typename S1,
int O1>
313 typename SE3GroupAction<JointMotionSubspaceRevoluteUnalignedTpl>::ReturnType
317 typename SE3GroupAction<JointMotionSubspaceRevoluteUnalignedTpl>::ReturnType
ReturnType;
321 res.template segment<3>(ANGULAR).noalias() = m.rotation() * m_axis;
322 res.template segment<3>(LINEAR).noalias() =
323 m.translation().cross(res.template segment<3>(ANGULAR));
327 template<
typename S1,
int O1>
328 typename SE3GroupAction<JointMotionSubspaceRevoluteUnalignedTpl>::ReturnType
332 typename SE3GroupAction<JointMotionSubspaceRevoluteUnalignedTpl>::ReturnType
ReturnType;
335 res.template segment<3>(ANGULAR).noalias() = m.rotation().transpose() * m_axis;
336 res.template segment<3>(LINEAR).noalias() =
337 -m.rotation().transpose() * m.translation().cross(m_axis);
346 struct TransposeConst
349 const JointMotionSubspaceRevoluteUnalignedTpl & ref;
350 TransposeConst(
const JointMotionSubspaceRevoluteUnalignedTpl & ref)
355 template<
typename ForceDerived>
356 typename ConstraintForceOp<JointMotionSubspaceRevoluteUnalignedTpl, ForceDerived>::ReturnType
362 res[0] = ref.axis().dot(f.
angular());
367 template<
typename ForceSet>
368 typename ConstraintForceSetOp<JointMotionSubspaceRevoluteUnalignedTpl, ForceSet>::ReturnType
369 operator*(
const Eigen::MatrixBase<ForceSet> & F)
372 ForceSet::RowsAtCompileTime == 6, THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE)
374 return ref.axis().transpose() * F.template middleRows<3>(ANGULAR);
392 S.template segment<3>(LINEAR).setZero();
393 S.template segment<3>(ANGULAR) = m_axis;
397 template<
typename MotionDerived>
398 typename MotionAlgebraAction<JointMotionSubspaceRevoluteUnalignedTpl, MotionDerived>::ReturnType
399 motionAction(
const MotionDense<MotionDerived> & m)
const 401 const typename MotionDerived::ConstLinearType v = m.linear();
402 const typename MotionDerived::ConstAngularType w = m.angular();
405 res.template segment<3>(LINEAR).noalias() = v.cross(m_axis);
406 res.template segment<3>(ANGULAR).noalias() = w.cross(m_axis);
411 const Vector3 & axis()
const 420 bool isEqual(
const JointMotionSubspaceRevoluteUnalignedTpl & other)
const 422 return internal::comparison_eq(m_axis, other.m_axis);
445 static inline ReturnType run(
const Inertia & Y,
const Constraint & cru)
450 const typename Inertia::Scalar & m = Y.mass();
451 const typename Inertia::Vector3 & c = Y.lever();
452 const typename Inertia::Symmetric3 & I = Y.inertia();
454 res.template segment<3>(Inertia::LINEAR) = -m * c.cross(cru.axis());
455 res.template segment<3>(Inertia::ANGULAR).noalias() = I * cru.axis();
456 res.template segment<3>(Inertia::ANGULAR) +=
457 c.cross(res.template segment<3>(Inertia::LINEAR));
509 typedef _Scalar Scalar;
522 typedef Eigen::Matrix<Scalar, 6, NV, Options> U_t;
523 typedef Eigen::Matrix<Scalar, NV, NV, Options> D_t;
524 typedef Eigen::Matrix<Scalar, 6, NV, Options> UD_t;
526 typedef Eigen::Matrix<Scalar, NQ, 1, Options> ConfigVector_t;
527 typedef Eigen::Matrix<Scalar, NV, 1, Options> TangentVector_t;
529 typedef boost::mpl::true_ is_mimicable_t;
531 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
549 struct JointDataRevoluteUnalignedTpl
550 :
public JointDataBase<JointDataRevoluteUnalignedTpl<_Scalar, _Options>>
552 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
554 PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(JointDerived);
555 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
557 ConfigVector_t joint_q;
558 TangentVector_t joint_v;
571 JointDataRevoluteUnalignedTpl()
572 : joint_q(ConfigVector_t::Zero())
573 , joint_v(TangentVector_t::Zero())
574 , M(Transformation_t::Identity())
575 , S(Constraint_t::Vector3::Zero())
576 , v(Constraint_t::Vector3::Zero(), (
Scalar)0)
579 , UDinv(UD_t::Zero())
584 template<
typename Vector3Like>
585 JointDataRevoluteUnalignedTpl(
const Eigen::MatrixBase<Vector3Like> & axis)
586 : joint_q(ConfigVector_t::Zero())
587 , joint_v(TangentVector_t::Zero())
588 , M(Transformation_t::Identity())
593 , UDinv(UD_t::Zero())
598 static std::string classname()
600 return std::string(
"JointDataRevoluteUnaligned");
602 std::string shortname()
const 611 struct JointModelRevoluteUnalignedTpl
612 :
public JointModelBase<JointModelRevoluteUnalignedTpl<_Scalar, _Options>>
614 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
616 PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(JointDerived);
617 typedef Eigen::Matrix<Scalar, 3, 1, _Options> Vector3;
623 using Base::idx_vExtended;
624 using Base::setIndexes;
626 JointModelRevoluteUnalignedTpl()
627 :
axis(Vector3::UnitX())
638 template<
typename Vector3Like>
639 JointModelRevoluteUnalignedTpl(
const Eigen::MatrixBase<Vector3Like> &
axis)
642 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Vector3Like);
646 JointDataDerived createData()
const 648 return JointDataDerived(
axis);
652 bool isEqual(
const JointModelRevoluteUnalignedTpl & other)
const 654 return Base::isEqual(other) && internal::comparison_eq(
axis, other.
axis);
657 const std::vector<bool> hasConfigurationLimit()
const 662 const std::vector<bool> hasConfigurationLimitInTangent()
const 667 template<
typename ConfigVector>
668 void calc(JointDataDerived & data,
const typename Eigen::MatrixBase<ConfigVector> & qs)
const 670 data.joint_q[0] = qs[idx_q()];
675 template<
typename TangentVector>
677 calc(JointDataDerived & data,
const Blank,
const typename Eigen::MatrixBase<TangentVector> & vs)
680 data.v.angularRate() =
static_cast<Scalar>(vs[idx_v()]);
683 template<
typename ConfigVector,
typename TangentVector>
685 JointDataDerived & data,
686 const typename Eigen::MatrixBase<ConfigVector> & qs,
687 const typename Eigen::MatrixBase<TangentVector> & vs)
const 689 calc(data, qs.derived());
691 data.v.angularRate() =
static_cast<Scalar>(vs[idx_v()]);
694 template<
typename VectorLike,
typename Matrix6Like>
696 JointDataDerived & data,
697 const Eigen::MatrixBase<VectorLike> & armature,
698 const Eigen::MatrixBase<Matrix6Like> & I,
699 const bool update_I)
const 701 data.U.noalias() = I.template middleCols<3>(Motion::ANGULAR) *
axis;
703 Scalar(1) / (
axis.dot(data.U.template segment<3>(Motion::ANGULAR)) + armature[0]);
704 data.UDinv.noalias() = data.U * data.Dinv;
707 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
710 static std::string classname()
712 return std::string(
"JointModelRevoluteUnaligned");
714 std::string shortname()
const 720 template<
typename NewScalar>
721 JointModelRevoluteUnalignedTpl<NewScalar, Options>
cast()
const 723 typedef JointModelRevoluteUnalignedTpl<NewScalar, Options>
ReturnType;
725 res.setIndexes(
id(), idx_q(), idx_v(), idx_vExtended());
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.
void normalize(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const Eigen::MatrixBase< ConfigVectorType > &qout)
Normalize a configuration vector.
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.