38 typedef _Scalar Scalar;
43 typedef Eigen::Matrix<Scalar, 3, 1, Options> Vector3;
44 typedef Eigen::Matrix<Scalar, 6, 1, Options> Vector6;
45 typedef Eigen::Matrix<Scalar, 4, 4, Options> Matrix4;
46 typedef Eigen::Matrix<Scalar, 6, 6, Options> Matrix6;
47 typedef typename PINOCCHIO_EIGEN_REF_CONST_TYPE(Vector6) ToVectorConstReturnType;
48 typedef typename PINOCCHIO_EIGEN_REF_TYPE(Vector6) ToVectorReturnType;
49 typedef Vector3 AngularType;
50 typedef Vector3 LinearType;
51 typedef const Vector3 ConstAngularType;
52 typedef const Vector3 ConstLinearType;
53 typedef Matrix6 ActionMatrixType;
54 typedef Matrix4 HomogeneousMatrixType;
56 typedef MotionPlain PlainReturnType;
65 struct MotionSphericalTpl :
MotionBase<MotionSphericalTpl<_Scalar, _Options>>
67 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
69 MOTION_TYPEDEF_TPL(MotionSphericalTpl);
75 template<
typename Vector3Like>
76 MotionSphericalTpl(
const Eigen::MatrixBase<Vector3Like> & w)
85 const Vector3 & operator()()
const 95 template<
typename MotionDerived>
98 other.angular() += m_w;
101 template<
typename Derived>
104 other.linear().setZero();
105 other.angular() = m_w;
108 MotionSphericalTpl __plus__(
const MotionSphericalTpl & other)
const 110 return MotionSphericalTpl(m_w + other.m_w);
113 bool isEqual_impl(
const MotionSphericalTpl & other)
const 115 return internal::comparison_eq(m_w, other.m_w);
118 template<
typename MotionDerived>
121 return internal::comparison_eq(other.angular(), m_w) && other.linear().isZero(0);
124 template<
typename S2,
int O2,
typename D2>
128 v.angular().noalias() = m.rotation() * m_w;
131 v.linear().noalias() = m.translation().cross(v.angular());
134 template<
typename S2,
int O2>
138 se3Action_impl(m, res);
142 template<
typename S2,
int O2,
typename D2>
148 v3_tmp.noalias() = m_w.cross(m.translation());
149 v.linear().noalias() = m.rotation().transpose() * v3_tmp;
152 v.angular().noalias() = m.rotation().transpose() * m_w;
155 template<
typename S2,
int O2>
159 se3ActionInverse_impl(m, res);
163 template<
typename M1,
typename M2>
167 mout.linear().noalias() = v.linear().cross(m_w);
170 mout.angular().noalias() = v.angular().cross(m_w);
173 template<
typename M1>
177 motionAction(v, res);
181 const Vector3 & angular()
const 207 typedef _Scalar Scalar;
218 typedef Eigen::Matrix<Scalar, 3, 1, Options> JointForce;
219 typedef Eigen::Matrix<Scalar, 6, 3, Options> DenseBase;
220 typedef Eigen::Matrix<Scalar, 3, 3, Options> ReducedSquaredMatrix;
222 typedef DenseBase MatrixReturnType;
223 typedef const DenseBase ConstMatrixReturnType;
225 typedef typename ReducedSquaredMatrix::IdentityReturnType StDiagonalMatrixSOperationReturnType;
229 struct JointMotionSubspaceSphericalTpl
232 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
234 PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(JointMotionSubspaceSphericalTpl)
236 JointMotionSubspaceSphericalTpl()
250 template<
typename Vector3Like>
251 JointMotion __mult__(
const Eigen::MatrixBase<Vector3Like> & w)
const 253 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like, 3);
259 template<
typename Derived>
266 template<
typename MatrixDerived>
268 operator*(
const Eigen::MatrixBase<MatrixDerived> & F)
const 270 assert(F.rows() == 6);
271 return F.derived().template middleRows<3>(Inertia::ANGULAR);
283 S.template block<3, 3>(LINEAR, 0).setZero();
284 S.template block<3, 3>(ANGULAR, 0).setIdentity();
288 template<
typename S1,
int O1>
289 Eigen::Matrix<S1, 6, 3, O1> se3Action(
const SE3Tpl<S1, O1> & m)
const 291 Eigen::Matrix<S1, 6, 3, O1> X_subspace;
292 cross(m.translation(), m.rotation(), X_subspace.template middleRows<3>(LINEAR));
293 X_subspace.template middleRows<3>(ANGULAR) = m.rotation();
298 template<
typename S1,
int O1>
299 Eigen::Matrix<S1, 6, 3, O1> se3ActionInverse(
const SE3Tpl<S1, O1> & m)
const 301 Eigen::Matrix<S1, 6, 3, O1> X_subspace;
302 XAxis::cross(m.translation(), X_subspace.template middleRows<3>(ANGULAR).col(0));
303 YAxis::cross(m.translation(), X_subspace.template middleRows<3>(ANGULAR).col(1));
304 ZAxis::cross(m.translation(), X_subspace.template middleRows<3>(ANGULAR).col(2));
306 X_subspace.template middleRows<3>(LINEAR).noalias() =
307 m.rotation().transpose() * X_subspace.template middleRows<3>(ANGULAR);
308 X_subspace.template middleRows<3>(ANGULAR) = m.rotation().transpose();
313 template<
typename MotionDerived>
314 DenseBase motionAction(
const MotionDense<MotionDerived> & m)
const 316 const typename MotionDerived::ConstLinearType v = m.linear();
317 const typename MotionDerived::ConstAngularType w = m.angular();
320 skew(v, res.template middleRows<3>(LINEAR));
321 skew(w, res.template middleRows<3>(ANGULAR));
326 bool isEqual(
const JointMotionSubspaceSphericalTpl &)
const 388 typedef _Scalar Scalar;
401 typedef Eigen::Matrix<Scalar, 6, NV, Options> U_t;
402 typedef Eigen::Matrix<Scalar, NV, NV, Options> D_t;
403 typedef Eigen::Matrix<Scalar, 6, NV, Options> UD_t;
405 typedef Eigen::Matrix<Scalar, NQ, 1, Options> ConfigVector_t;
406 typedef Eigen::Matrix<Scalar, NV, 1, Options> TangentVector_t;
408 typedef boost::mpl::false_ is_mimicable_t;
410 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
428 struct JointDataSphericalTpl :
public JointDataBase<JointDataSphericalTpl<_Scalar, _Options>>
430 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
433 PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(JointDerived);
434 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
436 ConfigVector_t joint_q;
437 TangentVector_t joint_v;
450 JointDataSphericalTpl()
452 , joint_v(TangentVector_t::Zero())
453 , M(Transformation_t::Identity())
454 , v(Motion_t::Vector3::Zero())
457 , UDinv(UD_t::Zero())
462 static std::string classname()
464 return std::string(
"JointDataSpherical");
466 std::string shortname()
const 477 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
480 PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(JointDerived);
486 using Base::idx_vExtended;
487 using Base::setIndexes;
489 JointDataDerived createData()
const 491 return JointDataDerived();
494 const std::vector<bool> hasConfigurationLimit()
const 496 return {
false,
false,
false,
false};
499 const std::vector<bool> hasConfigurationLimitInTangent()
const 501 return {
false,
false,
false};
504 template<
typename ConfigVectorLike>
505 inline void forwardKinematics(
506 Transformation_t & M,
const Eigen::MatrixBase<ConfigVectorLike> & q_joint)
const 508 typedef typename ConfigVectorLike::Scalar
Scalar;
509 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(ConfigVector_t, ConfigVectorLike);
511 typename Eigen::Quaternion<
Scalar, PINOCCHIO_EIGEN_PLAIN_TYPE(ConfigVectorLike)::Options>
513 typedef Eigen::Map<const Quaternion> ConstQuaternionMap;
515 ConstQuaternionMap quat(q_joint.derived().data());
518 assert(math::fabs(
static_cast<Scalar>(quat.coeffs().squaredNorm() - 1)) <= 1e-4);
520 M.rotation(quat.matrix());
521 M.translation().setZero();
524 template<
typename QuaternionDerived>
526 JointDataDerived & data,
const typename Eigen::QuaternionBase<QuaternionDerived> & quat)
const 528 data.joint_q = quat.coeffs();
529 data.M.rotation(quat.matrix());
532 template<
typename ConfigVector>
533 PINOCCHIO_DONT_INLINE
void 534 calc(JointDataDerived & data,
const typename Eigen::PlainObjectBase<ConfigVector> & qs)
const 536 typedef typename Eigen::Quaternion<typename ConfigVector::Scalar, ConfigVector::Options>
538 typedef Eigen::Map<const Quaternion> ConstQuaternionMap;
540 ConstQuaternionMap quat(qs.template segment<NQ>(idx_q()).data());
544 template<
typename ConfigVector>
545 PINOCCHIO_DONT_INLINE
void 546 calc(JointDataDerived & data,
const typename Eigen::MatrixBase<ConfigVector> & qs)
const 548 typedef typename Eigen::Quaternion<Scalar, Options> Quaternion;
550 const Quaternion quat(qs.template segment<NQ>(idx_q()));
554 template<
typename TangentVector>
556 calc(JointDataDerived & data,
const Blank,
const typename Eigen::MatrixBase<TangentVector> & vs)
559 data.joint_v = vs.template segment<NV>(idx_v());
560 data.v.angular() = data.joint_v;
563 template<
typename ConfigVector,
typename TangentVector>
565 JointDataDerived & data,
566 const typename Eigen::MatrixBase<ConfigVector> & qs,
567 const typename Eigen::MatrixBase<TangentVector> & vs)
const 569 calc(data, qs.derived());
570 data.joint_v = vs.template segment<NV>(idx_v());
571 data.v.angular() = data.joint_v;
574 template<
typename VectorLike,
typename Matrix6Like>
576 JointDataDerived & data,
577 const Eigen::MatrixBase<VectorLike> & armature,
578 const Eigen::MatrixBase<Matrix6Like> & I,
579 const bool update_I)
const 581 data.U = I.template block<6, 3>(0, Inertia::ANGULAR);
582 data.StU = data.U.template middleRows<3>(Inertia::ANGULAR);
583 data.StU.diagonal() += armature;
585 internal::PerformStYSInversion<Scalar>::run(data.StU, data.Dinv);
586 data.UDinv.noalias() = data.U * data.Dinv;
589 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
592 static std::string classname()
594 return std::string(
"JointModelSpherical");
596 std::string shortname()
const 602 template<
typename NewScalar>
607 res.setIndexes(
id(), idx_q(), idx_v(), idx_vExtended());