6 #ifndef __pinocchio_se3_tpl_hpp__ 7 #define __pinocchio_se3_tpl_hpp__ 9 #include "pinocchio/spatial/fwd.hpp" 10 #include "pinocchio/spatial/se3-base.hpp" 12 #include "pinocchio/math/quaternion.hpp" 13 #include "pinocchio/math/rotation.hpp" 14 #include "pinocchio/spatial/cartesian-axis.hpp" 16 #include <Eigen/Geometry> 20 template<
typename _Scalar,
int _Options>
29 typedef Eigen::Matrix<Scalar,3,1,Options>
Vector3;
30 typedef Eigen::Matrix<Scalar,4,1,Options>
Vector4;
31 typedef Eigen::Matrix<Scalar,6,1,Options>
Vector6;
32 typedef Eigen::Matrix<Scalar,3,3,Options>
Matrix3;
33 typedef Eigen::Matrix<Scalar,4,4,Options>
Matrix4;
34 typedef Eigen::Matrix<Scalar,6,6,Options>
Matrix6;
46 template<
typename _Scalar,
int _Options>
49 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
64 template<
typename QuaternionLike,
typename Vector3Like>
65 SE3Tpl(
const Eigen::QuaternionBase<QuaternionLike> & quat,
66 const Eigen::MatrixBase<Vector3Like> & trans)
67 : rot(quat.matrix()), trans(trans)
69 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3)
72 template<
typename Matrix3Like,
typename Vector3Like>
73 SE3Tpl(
const Eigen::MatrixBase<Matrix3Like> & R,
74 const Eigen::MatrixBase<Vector3Like> & trans)
75 : rot(R), trans(trans)
77 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Vector3Like,3)
78 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix3Like,3,3)
81 template<
typename Matrix4Like>
82 explicit SE3Tpl(
const Eigen::MatrixBase<Matrix4Like> & m)
83 : rot(m.template block<3,3>(LINEAR,LINEAR))
84 , trans(m.template block<3,1>(LINEAR,ANGULAR))
86 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix4Like,4,4);
90 : rot(AngularType::Identity())
91 , trans(LinearType::Zero())
112 { rot.
setIdentity (); trans.setZero ();
return *
this;}
117 return SE3Tpl(rot.transpose(), -rot.transpose()*trans);
136 HomogeneousMatrixType
M;
137 M.template block<3,3>(LINEAR,LINEAR) = rot;
138 M.template block<3,1>(LINEAR,ANGULAR) = trans;
139 M.template block<1,3>(ANGULAR,LINEAR).
setZero();
147 typedef Eigen::Block<ActionMatrixType,3,3> Block3;
149 M.template block<3,3>(ANGULAR,ANGULAR)
150 = M.template block<3,3>(LINEAR,LINEAR) = rot;
151 M.template block<3,3>(ANGULAR,LINEAR).
setZero();
152 Block3
B = M.template block<3,3>(LINEAR,ANGULAR);
154 B.col(0) = trans.cross(rot.col(0));
155 B.col(1) = trans.cross(rot.col(1));
156 B.col(2) = trans.cross(rot.col(2));
162 typedef Eigen::Block<ActionMatrixType,3,3> Block3;
164 M.template block<3,3>(ANGULAR,ANGULAR)
165 = M.template block<3,3>(LINEAR,LINEAR) = rot.transpose();
166 Block3
C = M.template block<3,3>(ANGULAR,LINEAR);
167 Block3
B = M.template block<3,3>(LINEAR,ANGULAR);
169 #define PINOCCHIO_INTERNAL_COMPUTATION(axis_id,v3_in,v3_out,R,res) \ 170 CartesianAxis<axis_id>::cross(v3_in,v3_out); \ 171 res.col(axis_id).noalias() = R.transpose() * v3_out; 177 #undef PINOCCHIO_INTERNAL_COMPUTATION 185 typedef Eigen::Block<ActionMatrixType,3,3> Block3;
187 M.template block<3,3>(ANGULAR,ANGULAR)
188 = M.template block<3,3>(LINEAR,LINEAR) = rot;
189 M.template block<3,3>(LINEAR,ANGULAR).
setZero();
190 Block3
B = M.template block<3,3>(ANGULAR,LINEAR);
192 B.col(0) = trans.cross(rot.col(0));
193 B.col(1) = trans.cross(rot.col(1));
194 B.col(2) = trans.cross(rot.col(2));
201 <<
" R =\n" << rot << std::endl
202 <<
" p = " << trans.transpose() << std::endl;
212 return d.se3Action(*
this);
219 return d.se3ActionInverse(*
this);
222 template<
typename EigenDerived>
223 typename EigenDerived::PlainObject
227 template<
typename MapDerived>
231 template<
typename EigenDerived>
232 typename EigenDerived::PlainObject
236 template<
typename MapDerived>
258 {
return this->act_impl(m2);}
268 const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision())
const 287 template<
typename NewScalar>
291 ReturnType
res(rot.template cast<NewScalar>(),
292 trans.template cast<NewScalar>());
307 rot = orthogonalProjection(rot);
312 PlainType
res(*
this); res.normalize();
327 template<
typename OtherScalar>
338 template<
typename Scalar,
int Options>
345 template<
typename Scalar,
int Options,
typename NewScalar>
351 if(pinocchio::cast<NewScalar>(Eigen::NumTraits<Scalar>::epsilon()) > Eigen::NumTraits<NewScalar>::epsilon())
360 #endif // ifndef __pinocchio_se3_tpl_hpp__ #define PINOCCHIO_SE3_TYPEDEF_TPL(Derived)
void translation_impl(const LinearType &p)
bool isNormalized(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
PlainType normalized() const
bool isEqual(const SE3Tpl< Scalar, O2 > &m2) const
bool isApprox_impl(const SE3Tpl< Scalar, O2 > &m2, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
Eigen::Matrix< Scalar, 4, 1, Options > Vector4
SE3Base< SE3Tpl< _Scalar, _Options > > Base
virtual CollisionGeometry * clone() const=0
PINOCCHIO_EIGEN_REF_CONST_TYPE(Matrix6Like) operator*(const Eigen
Vector3 actInv_impl(const Vector3 &p) const
SE3Tpl< Scalar, Options > PlainType
SE3Tpl(const Eigen::MatrixBase< Matrix3Like > &R, const Eigen::MatrixBase< Vector3Like > &trans)
Vector3 actInvOnEigenObject(const Eigen::MapBase< MapDerived > &p) const
HomogeneousMatrixType toHomogeneousMatrix_impl() const
bool isIdentity(const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision()) const
void disp_impl(std::ostream &os) const
ActionMatrixType toActionMatrix_impl() const
Vb.toVector() = bXa.toMatrix() * Va.toVector()
EigenDerived::PlainObject actInvOnEigenObject(const Eigen::MatrixBase< EigenDerived > &p) const
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
SE3Tpl(const Eigen::QuaternionBase< QuaternionLike > &quat, const Eigen::MatrixBase< Vector3Like > &trans)
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.
SE3Tpl act_impl(const SE3Tpl< Scalar, O2 > &m2) const
Vector3 act_impl(const Vector3 &p) const
SE3Tpl & operator=(const SE3Tpl< Scalar, O2 > &other)
Eigen::Quaternion< Scalar, Options > Quaternion
ConstAngularRef rotation_impl() const
ActionMatrixType toActionMatrixInverse_impl() const
SE3Tpl< NewScalar, Options > cast() const
ActionMatrixType toDualActionMatrix_impl() const
SE3Tpl inverse() const
aXb = bXa.inverse()
traits< SE3Tpl >::Matrix6 Matrix6
AngularRef rotation_impl()
SE3Tpl(const Eigen::MatrixBase< Matrix4Like > &m)
SE3GroupAction< D >::ReturnType act_impl(const D &d) const
— GROUP ACTIONS ON M6, F6 and I6 —
Eigen::Matrix< Scalar, 4, 4, Options > Matrix4
traits< SE3Tpl >::Matrix4 Matrix4
traits< SE3Tpl >::Vector3 Vector3
void uniformRandom(const Eigen::QuaternionBase< Derived > &q)
Uniformly random quaternion sphere.
traits< SE3Tpl >::Vector4 Vector4
#define PINOCCHIO_EIGEN_REF_TYPE(D)
ConstAngularRef rotation() const
SE3GroupAction< D >::ReturnType actInv_impl(const D &d) const
by = aXb.actInv(ay)
Main pinocchio namespace.
Base class for rigid transformation.
SE3Tpl __mult__(const SE3Tpl< Scalar, O2 > &m2) const
Vector3 actOnEigenObject(const Eigen::MapBase< MapDerived > &p) const
Eigen::Matrix< Scalar, 6, 1, Options > Vector6
LinearRef translation_impl()
#define PINOCCHIO_INTERNAL_COMPUTATION(axis_id, v3_in, v3_out, R, res)
void setZero(std::vector< MatType, Eigen::aligned_allocator< MatType > > &Ms)
Common traits structure to fully define base classes for CRTP.
SE3Tpl actInv_impl(const SE3Tpl< Scalar, O2 > &m2) const
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
Eigen::Matrix< Scalar, 3, 3, Options > Matrix3
Matrix4 HomogeneousMatrixType
SE3Tpl(const SE3Tpl< Scalar, O2 > &clone)
traits< SE3Tpl >::Matrix3 Matrix3
Eigen::Matrix< Scalar, 6, 6, Options > Matrix6
EigenDerived::PlainObject actOnEigenObject(const Eigen::MatrixBase< EigenDerived > &p) const
void rotation_impl(const AngularType &R)
ConstLinearRef translation() const
ConstLinearRef translation_impl() const