78 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
88 typedef Eigen::Matrix<Scalar, 6, 3, Options> Matrix63;
91 template<
typename Vector3Like>
92 JointMotion __mult__(
const Eigen::MatrixBase<Vector3Like> & v)
const 94 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like, 3);
96 Eigen::Matrix<Scalar, 6, 1> result = S.template leftCols<2>() * v.template head<2>();
104 template<
typename S1,
int O1>
105 typename SE3GroupAction<JointMotionSubspaceEllipsoidTpl>::ReturnType
108 typedef typename SE3GroupAction<JointMotionSubspaceEllipsoidTpl>::ReturnType
ReturnType;
113 res.template block<3, 1>(LINEAR, 2).noalias() = m.translation().cross(m.rotation().col(2));
114 res.template block<3, 1>(ANGULAR, 2) = m.rotation().col(2);
119 template<
typename S1,
int O1>
120 typename SE3GroupAction<JointMotionSubspaceEllipsoidTpl>::ReturnType
123 typedef typename SE3GroupAction<JointMotionSubspaceEllipsoidTpl>::ReturnType
ReturnType;
129 res.template block<3, 1>(LINEAR, 2).noalias() =
130 m.rotation().transpose() * AxisRotZ::CartesianAxis3::cross(m.translation());
131 res.template block<3, 1>(ANGULAR, 2) = m.rotation().transpose().col(2);
149 template<
typename ForceDerived>
150 typename ConstraintForceOp<JointMotionSubspaceEllipsoidTpl, ForceDerived>::ReturnType
154 typename ConstraintForceOp<JointMotionSubspaceEllipsoidTpl, ForceDerived>::ReturnType
159 res.template head<2>().noalias() = ref.S.template leftCols<2>().transpose() * f.
toVector();
167 template<
typename ForceSet>
168 typename ConstraintForceSetOp<JointMotionSubspaceEllipsoidTpl, ForceSet>::ReturnType
169 operator*(
const Eigen::MatrixBase<ForceSet> & F)
171 assert(F.rows() == 6);
172 return ref.S.transpose() * F.derived();
192 template<
typename MotionDerived>
193 typename MotionAlgebraAction<JointMotionSubspaceEllipsoidTpl, MotionDerived>::ReturnType
194 motionAction(
const MotionDense<MotionDerived> & m)
const 197 typename MotionAlgebraAction<JointMotionSubspaceEllipsoidTpl, MotionDerived>::ReturnType
205 MotionRef<typename ReturnType::ColXpr> v_col2(res.col(2));
206 v_col2 = m.cross(AxisRotZ());
211 bool isEqual(
const JointMotionSubspaceEllipsoidTpl & other)
const 391 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
393 PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(JointDerived);
399 using Base::idx_vExtended;
400 using Base::setIndexes;
402 typedef typename Transformation_t::Vector3 Vector3;
408 JointDataDerived createData()
const 410 return JointDataDerived();
435 return {
true,
true,
true};
438 const std::vector<bool> hasConfigurationLimitInTangent()
const 440 return {
true,
true,
true};
455 JointDataDerived & data)
const 458 data.M.rotation() << c1 * c2 , -c1 * s2 , s1 ,
459 c0 * s2 + c2 * s0 * s1 , c0 * c2 - s0 * s1 * s2 ,-c1 * s0 ,
460 -c0 * c2 * s1 + s0 * s2 , c0 * s1 * s2 + c2 * s0 , c0 * c1;
467 data.M.translation() << radius_x * nx, radius_y * ny, radius_z * nz;
470 template<
typename ConfigVector>
471 void calc(JointDataDerived & data,
const typename Eigen::MatrixBase<ConfigVector> & qs)
const 473 data.joint_q = qs.template segment<NQ>(
idx_q());
476 SINCOS(data.joint_q(0), &s0, &c0);
478 SINCOS(data.joint_q(1), &s1, &c1);
480 SINCOS(data.joint_q(2), &s2, &c2);
484 computeMotionSubspace(s0, c0, s1, c1, s2, c2, data);
487 template<
typename TangentVector>
489 calc(JointDataDerived & data,
const Blank,
const typename Eigen::MatrixBase<TangentVector> & vs)
492 data.joint_v = vs.template segment<NV>(idx_v());
496 SINCOS(data.joint_q(0), &s0, &c0);
498 SINCOS(data.joint_q(1), &s1, &c1);
500 SINCOS(data.joint_q(2), &s2, &c2);
502 Scalar dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0, dndotz_dqdot1;
504 dndoty_dqdot0 = -c0 * c1;
505 dndoty_dqdot1 = s0 * s1;
506 dndotz_dqdot0 = -c1 * s0;
507 dndotz_dqdot1 = -c0 * s1;
509 computeMotionSubspace(
510 s0, c0, s1, c1, s2, c2, dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0,
511 dndotz_dqdot1, data);
514 data.v.toVector().noalias() = data.S.matrix() * data.joint_v;
517 s0, c0, s1, c1, s2, c2, dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0,
518 dndotz_dqdot1, data);
521 template<
typename ConfigVector,
typename TangentVector>
523 JointDataDerived & data,
524 const typename Eigen::MatrixBase<ConfigVector> & qs,
525 const typename Eigen::MatrixBase<TangentVector> & vs)
const 527 data.joint_q = qs.template segment<NQ>(idx_q());
530 SINCOS(data.joint_q(0), &s0, &c0);
532 SINCOS(data.joint_q(1), &s1, &c1);
534 SINCOS(data.joint_q(2), &s2, &c2);
538 Scalar dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0, dndotz_dqdot1;
540 dndoty_dqdot0 = -c0 * c1;
541 dndoty_dqdot1 = s0 * s1;
542 dndotz_dqdot0 = -c1 * s0;
543 dndotz_dqdot1 = -c0 * s1;
545 computeMotionSubspace(
546 s0, c0, s1, c1, s2, c2, dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0,
547 dndotz_dqdot1, data);
550 data.joint_v = vs.template segment<NV>(idx_v());
551 data.v.toVector().noalias() = data.S.matrix() * data.joint_v;
554 s0, c0, s1, c1, s2, c2, dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0,
555 dndotz_dqdot1, data);
558 template<
typename VectorLike,
typename Matrix6Like>
560 JointDataDerived & data,
561 const Eigen::MatrixBase<VectorLike> & armature,
562 const Eigen::MatrixBase<Matrix6Like> & I,
563 const bool update_I)
const 565 data.U.noalias() = I * data.S.matrix();
566 data.StU.noalias() = data.S.transpose() * data.U;
567 data.StU.diagonal() += armature;
568 internal::PerformStYSInversion<Scalar>::run(data.StU, data.Dinv);
570 data.UDinv.noalias() = data.U * data.Dinv;
573 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
576 static std::string classname()
578 return std::string(
"JointModelEllipsoid");
580 std::string shortname()
const 586 template<
typename NewScalar>
591 ScalarCast<NewScalar, Scalar>::cast(radius_x),
592 ScalarCast<NewScalar, Scalar>::cast(radius_y),
593 ScalarCast<NewScalar, Scalar>::cast(radius_z)};
594 res.setIndexes(
id(), idx_q(), idx_v(), idx_vExtended());
598 void computeMotionSubspace(
605 JointDataDerived & data)
const 608 Scalar dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0, dndotz_dqdot1;
610 dndoty_dqdot0 = -c0 * c1;
611 dndoty_dqdot1 = s0 * s1;
612 dndotz_dqdot0 = -c1 * s0;
613 dndotz_dqdot1 = -c0 * s1;
615 computeMotionSubspace(
616 s0, c0, s1, c1, s2, c2, dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0,
617 dndotz_dqdot1, data);
619 void computeMotionSubspace(
626 const Scalar & dndotx_dqdot1,
627 const Scalar & dndoty_dqdot0,
628 const Scalar & dndoty_dqdot1,
629 const Scalar & dndotz_dqdot0,
630 const Scalar & dndotz_dqdot1,
631 JointDataDerived & data)
const 633 Scalar S_11, S_21, S_31, S_12, S_22, S_32;
635 S_11 = dndoty_dqdot0 * radius_y * (c0 * s2 + c2 * s0 * s1)
636 + dndotz_dqdot0 * radius_z * (-c0 * c2 * s1 + s0 * s2);
638 S_21 = -dndoty_dqdot0 * radius_y * (-c0 * c2 + s0 * s1 * s2)
639 + dndotz_dqdot0 * radius_z * (c0 * s1 * s2 + c2 * s0);
641 S_31 = c1 * (-dndoty_dqdot0 * radius_y * s0 + dndotz_dqdot0 * radius_z * c0);
643 S_12 = dndotx_dqdot1 * radius_x * c1 * c2
644 + dndoty_dqdot1 * radius_y * (c0 * s2 + c2 * s0 * s1)
645 + dndotz_dqdot1 * radius_z * (-c0 * c2 * s1 + s0 * s2);
647 S_22 = -dndotx_dqdot1 * radius_x * c1 * s2
648 - dndoty_dqdot1 * radius_y * (-c0 * c2 + s0 * s1 * s2)
649 + dndotz_dqdot1 * radius_z * (c0 * s1 * s2 + c2 * s0);
651 S_32 = dndotx_dqdot1 * radius_x * s1 - dndoty_dqdot1 * radius_y * c1 * s0
652 + dndotz_dqdot1 * radius_z * c0 * c1;
655 data.S.S << S_11 , S_12 , Scalar(0),
656 S_21 , S_22 , Scalar(0),
657 S_31 , S_32 , Scalar(0),
658 c1 * c2, s2 , Scalar(0),
659 -c1 * s2, c2 , Scalar(0),
660 s1 , Scalar(0), Scalar(1);
665 template<
typename ConfigVector,
typename TangentVector>
667 JointDataDerived & data,
668 const Eigen::MatrixBase<ConfigVector> & qs,
669 const Eigen::MatrixBase<TangentVector> &)
const 678 Scalar dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0, dndotz_dqdot1;
680 dndoty_dqdot0 = -c0 * c1;
681 dndoty_dqdot1 = s0 * s1;
682 dndotz_dqdot0 = -c1 * s0;
683 dndotz_dqdot1 = -c0 * s1;
686 s0, c0, s1, c1, s2, c2, dndotx_dqdot1, dndoty_dqdot0, dndoty_dqdot1, dndotz_dqdot0,
687 dndotz_dqdot1, data);
697 const Scalar & dndotx_dqdot1,
698 const Scalar & dndoty_dqdot0,
699 const Scalar & dndoty_dqdot1,
700 const Scalar & dndotz_dqdot0,
701 const Scalar & dndotz_dqdot1,
702 JointDataDerived & data)
const 705 Scalar qdot0, qdot1, qdot2;
706 qdot0 = data.joint_v(0);
707 qdot1 = data.joint_v(1);
708 qdot2 = data.joint_v(2);
712 Scalar Sdot_11, Sdot_21, Sdot_31, Sdot_41, Sdot_51, Sdot_61;
713 Scalar Sdot_12, Sdot_22, Sdot_32, Sdot_42, Sdot_52;
716 Scalar d_dndotx_dqdot1_dq1 = -s1;
718 Scalar d_dndoty_dqdot0_dq0 = s0 * c1;
719 Scalar d_dndoty_dqdot0_dq1 = c0 * s1;
721 Scalar d_dndoty_dqdot1_dq1 = s0 * c1;
723 Scalar d_dndotz_dqdot0_dq0 = -c1 * c0;
724 Scalar d_dndotz_dqdot0_dq1 = s0 * s1;
726 Scalar d_dndotz_dqdot1_dq1 = -c0 * c1;
732 * (-dndoty_dqdot0 * radius_y * (-c0 * c2 * s1 + s0 * s2) + dndotz_dqdot0 * radius_z * (c0 * s2 + c2 * s0 * s1) + radius_y * (c0 * s2 + c2 * s0 * s1) * d_dndoty_dqdot0_dq0 + radius_z * (-c0 * c2 * s1 + s0 * s2) * d_dndotz_dqdot0_dq0)
734 * (dndoty_dqdot0 * radius_y * c1 * c2 * s0 - dndotz_dqdot0 * radius_z * c0 * c1 * c2 + radius_y * (c0 * s2 + c2 * s0 * s1) * d_dndoty_dqdot0_dq1 + radius_z * (-c0 * c2 * s1 + s0 * s2) * d_dndotz_dqdot0_dq1)
736 * (dndoty_dqdot0 * radius_y * (-c0 * c2 + s0 * s1 * s2) - dndotz_dqdot0 * radius_z * (c0 * s1 * s2 + c2 * s0));
741 * (-dndoty_dqdot1 * radius_y * (-c0 * c2 * s1 + s0 * s2) + dndotz_dqdot1 * radius_z * (c0 * s2 + c2 * s0 * s1) + radius_y * (c0 * s2 + c2 * s0 * s1) * d_dndoty_dqdot0_dq1 + radius_z * (-c0 * c2 * s1 + s0 * s2) * d_dndotz_dqdot0_dq1)
742 + qdot1 * (-dndotx_dqdot1 * radius_x * c2 * s1 + dndoty_dqdot1 * radius_y * c1 * c2 * s0 - dndotz_dqdot1 * radius_z * c0 * c1 * c2 + radius_x * c1 * c2 * d_dndotx_dqdot1_dq1 + radius_y * (c0 * s2 + c2 * s0 * s1) * d_dndoty_dqdot1_dq1 + radius_z * (-c0 * c2 * s1 + s0 * s2) * d_dndotz_dqdot1_dq1) - qdot2 * (dndotx_dqdot1 * radius_x * c1 * s2 + dndoty_dqdot1 * radius_y * (-c0 * c2 + s0 * s1 * s2) - dndotz_dqdot1 * radius_z * (c0 * s1 * s2 + c2 * s0));
747 * (dndoty_dqdot0 * radius_y * (c0 * s1 * s2 + c2 * s0) + dndotz_dqdot0 * radius_z * (-c0 * c2 + s0 * s1 * s2) + radius_y * (-c0 * c2 + s0 * s1 * s2) * d_dndoty_dqdot0_dq0 - radius_z * (c0 * s1 * s2 + c2 * s0) * d_dndotz_dqdot0_dq0)
749 * (dndoty_dqdot0 * radius_y * c1 * s0 * s2 - dndotz_dqdot0 * radius_z * c0 * c1 * s2 + radius_y * (-c0 * c2 + s0 * s1 * s2) * d_dndoty_dqdot0_dq1 - radius_z * (c0 * s1 * s2 + c2 * s0) * d_dndotz_dqdot0_dq1)
751 * (dndoty_dqdot0 * radius_y * (c0 * s2 + c2 * s0 * s1) + dndotz_dqdot0 * radius_z * (-c0 * c2 * s1 + s0 * s2));
756 * (dndoty_dqdot1 * radius_y * (c0 * s1 * s2 + c2 * s0) + dndotz_dqdot1 * radius_z * (-c0 * c2 + s0 * s1 * s2) + radius_y * (-c0 * c2 + s0 * s1 * s2) * d_dndoty_dqdot0_dq1 - radius_z * (c0 * s1 * s2 + c2 * s0) * d_dndotz_dqdot0_dq1)
757 + qdot1 * (dndotx_dqdot1 * radius_x * s1 * s2 - dndoty_dqdot1 * radius_y * c1 * s0 * s2 + dndotz_dqdot1 * radius_z * c0 * c1 * s2 - radius_x * c1 * s2 * d_dndotx_dqdot1_dq1 - radius_y * (-c0 * c2 + s0 * s1 * s2) * d_dndoty_dqdot1_dq1 + radius_z * (c0 * s1 * s2 + c2 * s0) * d_dndotz_dqdot1_dq1) - qdot2 * (dndotx_dqdot1 * radius_x * c1 * c2 + dndoty_dqdot1 * radius_y * (c0 * s2 + c2 * s0 * s1) + dndotz_dqdot1 * radius_z * (-c0 * c2 * s1 + s0 * s2));
762 * (dndoty_dqdot0 * radius_y * c0 + dndotz_dqdot0 * radius_z * s0 + radius_y * s0 * d_dndoty_dqdot0_dq0 - radius_z * c0 * d_dndotz_dqdot0_dq0)
764 * (-c1 * (radius_y * s0 * d_dndoty_dqdot0_dq1 - radius_z * c0 * d_dndotz_dqdot0_dq1) + s1 * (dndoty_dqdot0 * radius_y * s0 - dndotz_dqdot0 * radius_z * c0));
769 * (dndoty_dqdot1 * radius_y * c0 + dndotz_dqdot1 * radius_z * s0 + radius_y * s0 * d_dndoty_dqdot0_dq1 - radius_z * c0 * d_dndotz_dqdot0_dq1)
771 * (dndotx_dqdot1 * radius_x * c1 + dndoty_dqdot1 * radius_y * s0 * s1 - dndotz_dqdot1 * radius_z * c0 * s1 + radius_x * s1 * d_dndotx_dqdot1_dq1 - radius_y * c1 * s0 * d_dndoty_dqdot1_dq1 + radius_z * c0 * c1 * d_dndotz_dqdot1_dq1);
774 Sdot_41 = -(qdot1 * c2 * s1 + qdot2 * c1 * s2);
775 Sdot_51 = qdot1 * s1 * s2 - qdot2 * c1 * c2;
776 Sdot_61 = qdot1 * c1;
778 Sdot_42 = qdot2 * c2;
779 Sdot_52 = -qdot2 * s2;
781 data.c.toVector() << Sdot_11 * qdot0 + Sdot_12 * qdot1, Sdot_21 * qdot0 + Sdot_22 * qdot1,
782 Sdot_31 * qdot0 + Sdot_32 * qdot1, Sdot_41 * qdot0 + Sdot_42 * qdot1,
783 Sdot_51 * qdot0 + Sdot_52 * qdot1, Sdot_61 * qdot0;