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 MotionPlanarTpl :
MotionBase<MotionPlanarTpl<_Scalar, _Options>>
67 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
68 MOTION_TYPEDEF_TPL(MotionPlanarTpl);
78 m_data << x_dot, y_dot, theta_dot;
81 template<
typename Vector3Like>
82 MotionPlanarTpl(
const Eigen::MatrixBase<Vector3Like> & vj)
85 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like, 3);
91 typename PlainReturnType::Vector3(vx(), vy(),
Scalar(0)),
92 typename PlainReturnType::Vector3(
Scalar(0),
Scalar(0), wz()));
95 template<
typename Derived>
98 other.linear()[0] += vx();
99 other.linear()[1] += vy();
100 other.angular()[2] += wz();
103 template<
typename MotionDerived>
106 other.linear() << vx(), vy(), (
Scalar)0;
110 template<
typename S2,
int O2,
typename D2>
113 v.angular().noalias() = m.rotation().col(2) * wz();
114 v.linear().noalias() = m.rotation().template leftCols<2>() * m_data.template head<2>();
115 v.linear() += m.translation().cross(v.angular());
118 template<
typename S2,
int O2>
122 se3Action_impl(m, res);
126 template<
typename S2,
int O2,
typename D2>
132 ZAxis::alphaCross(wz(), m.translation(), v3_tmp);
135 v.linear().noalias() = m.rotation().transpose() * v3_tmp;
138 v.angular().noalias() = m.rotation().transpose().col(2) * wz();
141 template<
typename S2,
int O2>
145 se3ActionInverse_impl(m, res);
149 template<
typename M1,
typename M2>
153 ZAxis::alphaCross(-wz(), v.linear(), mout.linear());
155 typename M1::ConstAngularType w_in = v.angular();
156 typename M2::LinearType v_out = mout.linear();
158 v_out[0] -= w_in[2] * vy();
159 v_out[1] += w_in[2] * vx();
160 v_out[2] += -w_in[1] * vx() + w_in[0] * vy();
163 ZAxis::alphaCross(-wz(), v.angular(), mout.angular());
166 template<
typename M1>
170 motionAction(v, res);
210 bool isEqual_impl(
const MotionPlanarTpl & other)
const 212 return internal::comparison_eq(m_data, other.m_data);
239 typedef _Scalar Scalar;
250 typedef Eigen::Matrix<Scalar, 3, 1, Options> JointForce;
251 typedef Eigen::Matrix<Scalar, 6, 3, Options> DenseBase;
252 typedef Eigen::Matrix<Scalar, 3, 3, Options> ReducedSquaredMatrix;
254 typedef DenseBase MatrixReturnType;
255 typedef const DenseBase ConstMatrixReturnType;
257 typedef typename ReducedSquaredMatrix::IdentityReturnType StDiagonalMatrixSOperationReturnType;
261 struct JointMotionSubspacePlanarTpl
264 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
265 PINOCCHIO_CONSTRAINT_TYPEDEF_TPL(JointMotionSubspacePlanarTpl)
272 JointMotionSubspacePlanarTpl() {};
274 template<
typename Vector3Like>
275 JointMotion __mult__(
const Eigen::MatrixBase<Vector3Like> & vj)
const 277 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like, 3);
288 const JointMotionSubspacePlanarTpl & ref;
289 ConstraintTranspose(
const JointMotionSubspacePlanarTpl & ref)
294 template<
typename Derived>
302 template<
typename Derived>
303 friend typename Eigen::
304 Matrix<typename Eigen::MatrixBase<Derived>::Scalar, 3, Derived::ColsAtCompileTime>
305 operator*(
const ConstraintTranspose &,
const Eigen::MatrixBase<Derived> & F)
307 typedef typename Eigen::MatrixBase<Derived>::Scalar
Scalar;
308 typedef Eigen::Matrix<Scalar, 3, Derived::ColsAtCompileTime>
MatrixReturnType;
309 assert(F.rows() == 6);
312 result.template topRows<2>() = F.template topRows<2>();
313 result.template bottomRows<1>() = F.template bottomRows<1>();
327 S.template block<3, 3>(Inertia::LINEAR, 0).setZero();
328 S.template block<3, 3>(Inertia::ANGULAR, 0).setZero();
329 S(Inertia::LINEAR + 0, 0) =
Scalar(1);
330 S(Inertia::LINEAR + 1, 1) =
Scalar(1);
331 S(Inertia::ANGULAR + 2, 2) =
Scalar(1);
335 template<
typename S1,
int O1>
336 DenseBase se3Action(
const SE3Tpl<S1, O1> & m)
const 338 DenseBase X_subspace;
341 X_subspace.template block<3, 2>(Motion::LINEAR, 0) = m.rotation().template leftCols<2>();
342 X_subspace.template block<3, 1>(Motion::LINEAR, 2).noalias() =
343 m.translation().cross(m.rotation().template rightCols<1>());
346 X_subspace.template block<3, 2>(Motion::ANGULAR, 0).setZero();
347 X_subspace.template block<3, 1>(Motion::ANGULAR, 2) = m.rotation().template rightCols<1>();
352 template<
typename S1,
int O1>
353 DenseBase se3ActionInverse(
const SE3Tpl<S1, O1> & m)
const 355 DenseBase X_subspace;
358 X_subspace.template block<3, 2>(Motion::LINEAR, 0) =
359 m.rotation().transpose().template leftCols<2>();
360 X_subspace.template block<3, 1>(Motion::ANGULAR, 2).noalias() =
361 m.rotation().transpose() * m.translation();
362 X_subspace.template block<3, 1>(Motion::LINEAR, 2).noalias() =
363 -X_subspace.template block<3, 1>(Motion::ANGULAR, 2)
364 .cross(m.rotation().transpose().template rightCols<1>());
367 X_subspace.template block<3, 2>(Motion::ANGULAR, 0).setZero();
368 X_subspace.template block<3, 1>(Motion::ANGULAR, 2) =
369 m.rotation().transpose().template rightCols<1>();
374 template<
typename MotionDerived>
375 DenseBase motionAction(
const MotionDense<MotionDerived> & m)
const 377 const typename MotionDerived::ConstLinearType v = m.linear();
378 const typename MotionDerived::ConstAngularType w = m.angular();
379 DenseBase res(DenseBase::Zero());
393 bool isEqual(
const JointMotionSubspacePlanarTpl &)
const 481 typedef _Scalar Scalar;
490 typedef Eigen::Matrix<Scalar, 6, NV, Options> U_t;
491 typedef Eigen::Matrix<Scalar, NV, NV, Options> D_t;
492 typedef Eigen::Matrix<Scalar, 6, NV, Options> UD_t;
494 typedef Eigen::Matrix<Scalar, NQ, 1, Options> ConfigVector_t;
495 typedef Eigen::Matrix<Scalar, NV, 1, Options> TangentVector_t;
497 typedef boost::mpl::false_ is_mimicable_t;
499 PINOCCHIO_JOINT_DATA_BASE_ACCESSOR_DEFAULT_RETURN_TYPE
516 struct JointDataPlanarTpl :
public JointDataBase<JointDataPlanarTpl<_Scalar, _Options>>
518 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
520 PINOCCHIO_JOINT_DATA_TYPEDEF_TEMPLATE(JointDerived);
521 PINOCCHIO_JOINT_DATA_BASE_DEFAULT_ACCESSOR
523 ConfigVector_t joint_q;
524 TangentVector_t joint_v;
539 , joint_v(TangentVector_t::Zero())
540 , M(Transformation_t::Identity())
541 , v(Motion_t::Vector3::Zero())
544 , UDinv(UD_t::Zero())
549 static std::string classname()
551 return std::string(
"JointDataPlanar");
553 std::string shortname()
const 564 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
566 PINOCCHIO_JOINT_TYPEDEF_TEMPLATE(JointDerived);
572 using Base::idx_vExtended;
573 using Base::setIndexes;
575 JointDataDerived createData()
const 577 return JointDataDerived();
580 const std::vector<bool> hasConfigurationLimit()
const 582 return {
true,
true,
false,
false};
585 const std::vector<bool> hasConfigurationLimitInTangent()
const 587 return {
true,
true,
false};
590 template<
typename ConfigVector>
592 forwardKinematics(Transformation_t & M,
const Eigen::MatrixBase<ConfigVector> & q_joint)
const 594 const Scalar &c_theta = q_joint(2), &s_theta = q_joint(3);
596 M.rotation().template topLeftCorner<2, 2>() << c_theta, -s_theta, s_theta, c_theta;
597 M.translation().template head<2>() = q_joint.template head<2>();
600 template<
typename ConfigVector>
601 void calc(JointDataDerived & data,
const typename Eigen::MatrixBase<ConfigVector> & qs)
const 603 data.joint_q = qs.template segment<NQ>(idx_q());
605 const Scalar &c_theta = data.joint_q(2), &s_theta = data.joint_q(3);
607 data.M.rotation().template topLeftCorner<2, 2>() << c_theta, -s_theta, s_theta, c_theta;
608 data.M.translation().template head<2>() = data.joint_q.template head<2>();
611 template<
typename TangentVector>
613 calc(JointDataDerived & data,
const Blank,
const typename Eigen::MatrixBase<TangentVector> & vs)
616 data.joint_v = vs.template segment<NV>(idx_v());
618#define q_dot data.joint_v 619 data.v.vx() = q_dot(0);
620 data.v.vy() = q_dot(1);
621 data.v.wz() = q_dot(2);
625 template<
typename ConfigVector,
typename TangentVector>
627 JointDataDerived & data,
628 const typename Eigen::MatrixBase<ConfigVector> & qs,
629 const typename Eigen::MatrixBase<TangentVector> & vs)
const 631 calc(data, qs.derived());
633 data.joint_v = vs.template segment<NV>(idx_v());
635#define q_dot data.joint_v 636 data.v.vx() = q_dot(0);
637 data.v.vy() = q_dot(1);
638 data.v.wz() = q_dot(2);
642 template<
typename VectorLike,
typename Matrix6Like>
644 JointDataDerived & data,
645 const Eigen::MatrixBase<VectorLike> & armature,
646 const Eigen::MatrixBase<Matrix6Like> & I,
647 const bool update_I)
const 649 data.U.template leftCols<2>() = I.template leftCols<2>();
650 data.U.template rightCols<1>() = I.template rightCols<1>();
652 data.StU.template leftCols<2>() = data.U.template topRows<2>().transpose();
653 data.StU.template rightCols<1>() = data.U.template bottomRows<1>();
655 data.StU.diagonal() += armature;
656 internal::PerformStYSInversion<Scalar>::run(data.StU, data.Dinv);
658 data.UDinv.noalias() = data.U * data.Dinv;
661 PINOCCHIO_EIGEN_CONST_CAST(Matrix6Like, I).noalias() -= data.UDinv * data.U.transpose();
664 static std::string classname()
666 return std::string(
"JointModelPlanar");
668 std::string shortname()
const 674 template<
typename NewScalar>
679 res.setIndexes(
id(), idx_q(), idx_v(), idx_vExtended());