template class sophus::Se2Base¶
Overview¶
Se2 base type - implements Se2 class but is storage agnostic. More…
#include <se2.h> template <class TDerived> class Se2Base { public: // typedefs using Scalar = typename Eigen::internal::traits<TDerived>::Scalar ; using TranslationType = typename Eigen::internal::traits<TDerived>::TranslationType ; using So2Type = typename Eigen::internal::traits<TDerived>::So2Type ; using Transformation = Eigen::Matrix<Scalar, kMatrixDim, kMatrixDim> ; using Point = Eigen::Vector2<Scalar> ; using HomogeneousPoint = Eigen::Vector3<Scalar> ; using Line = Eigen::ParametrizedLine<Scalar, 2> ; using Hyperplane = Eigen::Hyperplane<Scalar, 2> ; using Tangent = Eigen::Vector<Scalar, kDoF> ; using Adjoint = Eigen::Matrix<Scalar, kDoF, kDoF> ; using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<Scalar, typename TOtherDerived::Scalar>::ReturnType ; using Se2Product = Se2<ReturnScalar<TOtherDerived>> ; using PointProduct = Eigen::Vector2<ReturnScalar<TPointDerived>> ; using HomogeneousPointProduct = Eigen::Vector3<ReturnScalar<THPointDerived>> ; // fields static constexpr int kDoF = 3; static constexpr int kNumParameters = 4; static constexpr int kMatrixDim = 3; static constexpr int kPointDim = 2; // methods SOPHUS_FUNC Adjoint adj() const; template <class TNewScalarType> SOPHUS_FUNC Se2<TNewScalarType> cast() const; SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxThisMulExpXAt0() const; SOPHUS_FUNC Eigen::Matrix<Scalar, kDoF, kNumParameters> dxLogThisInvTimesXAtThis() const; SOPHUS_FUNC Se2<Scalar> inverse() const; SOPHUS_FUNC Tangent log() const; SOPHUS_FUNC void normalize(); SOPHUS_FUNC Transformation matrix() const; SOPHUS_FUNC Eigen::Matrix<Scalar, 2, 3> matrix2x3() const; template <class TOtherDerived> SOPHUS_FUNC Se2Base<TDerived>& operator=(Se2Base<TOtherDerived> const& other); template <class TOtherDerived> SOPHUS_FUNC Se2Product<TOtherDerived> operator*(Se2Base<TOtherDerived> const& other) const; template < typename TPointDerived, typename = typename std::enable_if<IsFixedSizeVector<TPointDerived, 2>::value>::type > SOPHUS_FUNC PointProduct<TPointDerived> operator*(Eigen::MatrixBase<TPointDerived> const& p) const; template < typename THPointDerived, typename = typename std::enable_if<IsFixedSizeVector<THPointDerived, 3>::value>::type > SOPHUS_FUNC HomogeneousPointProduct<THPointDerived> operator*(Eigen::MatrixBase<THPointDerived> const& p) const; SOPHUS_FUNC Line operator*(Line const& l) const; SOPHUS_FUNC Hyperplane operator*(Hyperplane const& p) const; template < typename TOtherDerived, typename = typename std::enable_if<std::is_same<Scalar, ReturnScalar<TOtherDerived>>::value>::type > SOPHUS_FUNC Se2Base<TDerived>& operator*=(Se2Base<TOtherDerived> const& other); SOPHUS_FUNC Eigen::Vector<Scalar, kNumParameters> params() const; SOPHUS_FUNC Eigen::Matrix<Scalar, 2, 2> rotationMatrix() const; SOPHUS_FUNC void setComplex(Eigen::Vector2<Scalar> const& complex); SOPHUS_FUNC void setRotationMatrix(Eigen::Matrix<Scalar, 2, 2> const& r); SOPHUS_FUNC So2Type& so2(); SOPHUS_FUNC So2Type const& so2() const; SOPHUS_FUNC TranslationType& translation(); SOPHUS_FUNC TranslationType const& translation() const; SOPHUS_FUNC Eigen::internal::traits<TDerived>::So2Type::ComplexT const& unitComplex() const; }; // direct descendants template <class TScalar, int kOptions> class Map<sophus::Se2<TScalar> const, kOptions>; template <class TScalar, int kOptions> class Map<sophus::Se2<TScalar>, kOptions>;
Detailed Documentation¶
Se2 base type - implements Se2 class but is storage agnostic.
SE(2) is the group of rotations and translation in 2d. It is the semi-direct product of SO(2) and the 2d Euclidean vector space. The class is represented using a composition of SO2Group for rotation and a 2-vector for translation.
SE(2) is neither compact, nor a commutative group.
3x3 Eigen::Matrix representation:
| R t | | o 1 |
where R
is a 2x2 rotation matrix, t
a translation 2-vector and o
a 2-column vector of zeros.
Tangent 3-vector: [upsilon, theta],
where upsilon
is the translational velocity 2-vector and theta
the rotational velocity.
Internal 4-vector representation: [t0, t1, zr, zi],
with t0, t1
are the translational components, and zr
the real part and zi
the imaginary part of a unit length complex number.
See SO2Group for more details of the rotation representation in 2d.
Typedefs¶
using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<Scalar, typename TOtherDerived::Scalar>::ReturnType
For binary operations the return type is determined with the ScalarBinaryOpTraits feature of Eigen. This allows mixing concrete and Map types, as well as other compatible scalar types such as Ceres::Jet and double scalars with Se2 operations.
Fields¶
static constexpr int kDoF = 3
Degrees of freedom of manifold, number of dimensions in tangent space (two for translation, three for rotation).
static constexpr int kNumParameters = 4
Number of internal parameters used (tuple for complex, two for translation).
static constexpr int kMatrixDim = 3
Group transformations are 3x3 matrices.
static constexpr int kPointDim = 2
Points are 2-dimensional.
Methods¶
SOPHUS_FUNC Adjoint adj() const
Adjoint transformation.
This function return the adjoint transformation Ad
of the group element A
such that for all x
it holds that hat(Ad_A * x) = A * hat(x) A^{-1}
. See hat-operator below.
template <class TNewScalarType> SOPHUS_FUNC Se2<TNewScalarType> cast() const
Returns copy of instance casted to NewScalarType.
SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxThisMulExpXAt0() const
Returns derivative of this * exp(x) wrt x at x=0.
SOPHUS_FUNC Eigen::Matrix<Scalar, kDoF, kNumParameters> dxLogThisInvTimesXAtThis() const
Returns derivative of log(this^{-1} * x) by x at x=this.
SOPHUS_FUNC Se2<Scalar> inverse() const
Returns group inverse.
SOPHUS_FUNC Tangent log() const
Logarithmic map.
Computes the logarithm, the inverse of the group exponential which maps element of the group (rigid body transformations) to elements of the tangent space (twist).
To be specific, this function computes vee(logmat(.))
with logmat(.)
being the matrix logarithm and vee(.)
the vee-operator of SE(2).
SOPHUS_FUNC void normalize()
Normalize So2 element.
It re-normalizes the So2 element.
SOPHUS_FUNC Transformation matrix() const
Returns 3x3 matrix representation of the instance.
It has the following form:
| R t | | o 1 |
where R
is a 2x2 rotation matrix, t
a translation 2-vector and o
a 2-column vector of zeros.
SOPHUS_FUNC Eigen::Matrix<Scalar, 2, 3> matrix2x3() const
Returns the significant first two rows of the matrix above.
template <class TOtherDerived> SOPHUS_FUNC Se2Base<TDerived>& operator=(Se2Base<TOtherDerived> const& other)
Assignment-like operator from OtherDerived.
template <class TOtherDerived> SOPHUS_FUNC Se2Product<TOtherDerived> operator*(Se2Base<TOtherDerived> const& other) const
Group multiplication, which is rotation concatenation.
template < typename TPointDerived, typename = typename std::enable_if<IsFixedSizeVector<TPointDerived, 2>::value>::type > SOPHUS_FUNC PointProduct<TPointDerived> operator*(Eigen::MatrixBase<TPointDerived> const& p) const
Group action on 2-points.
This function rotates and translates a two dimensional point p
by the SE(2) element bar_transform_foo = (bar_R_foo, t_bar)
(= rigid body transformation):
p_bar = bar_R_foo * p_foo + t_bar
.
template < typename THPointDerived, typename = typename std::enable_if<IsFixedSizeVector<THPointDerived, 3>::value>::type > SOPHUS_FUNC HomogeneousPointProduct<THPointDerived> operator*(Eigen::MatrixBase<THPointDerived> const& p) const
Group action on homogeneous 2-points. See above for more details.
SOPHUS_FUNC Line operator*(Line const& l) const
Group action on lines.
This function rotates and translates a parametrized line l(t) = o + t * d
by the SE(2) element:
Origin o
is rotated and translated using SE(2) action Direction d
is rotated using SO(2) action
SOPHUS_FUNC Hyperplane operator*(Hyperplane const& p) const
Group action on hyper-planes.
This function rotates a hyper-plane n.x + d = 0
by the Se2 element:
Normal vector n
is rotated Offset d
is adjusted for translation
Note that in 2d-case hyper-planes are just another parametrization of lines
template < typename TOtherDerived, typename = typename std::enable_if<std::is_same<Scalar, ReturnScalar<TOtherDerived>>::value>::type > SOPHUS_FUNC Se2Base<TDerived>& operator*=(Se2Base<TOtherDerived> const& other)
In-place group multiplication. This method is only valid if the return type of the multiplication is compatible with this So2 ‘s Scalar type.
SOPHUS_FUNC Eigen::Vector<Scalar, kNumParameters> params() const
Returns internal parameters of SE(2).
It returns (c[0], c[1], t[0], t[1]), with c being the unit complex number, t the translation 3-vector.
SOPHUS_FUNC Eigen::Matrix<Scalar, 2, 2> rotationMatrix() const
Returns rotation matrix.
SOPHUS_FUNC void setComplex(Eigen::Vector2<Scalar> const& complex)
Takes in complex number, and normalizes it.
Precondition: The complex number must not be close to zero.
SOPHUS_FUNC void setRotationMatrix(Eigen::Matrix<Scalar, 2, 2> const& r)
Sets so3
using rotation_matrix
.
Precondition: R
must be orthogonal and det(R)=1
.
SOPHUS_FUNC So2Type& so2()
Mutator of So3 group.
SOPHUS_FUNC So2Type const& so2() const
Accessor of So3 group.
SOPHUS_FUNC TranslationType& translation()
Mutator of translation vector.
SOPHUS_FUNC TranslationType const& translation() const
Accessor of translation vector.
SOPHUS_FUNC Eigen::internal::traits<TDerived>::So2Type::ComplexT const& unitComplex() const
Accessor of unit complex number.