template class sophus::Cartesian

Overview

Cartesian using default storage; derived from CartesianBase. More…

#include <cartesian.h>

template <class TScalar, int kM, int kOptions>
class Cartesian {
public:
    // typedefs

    using Scalar = TScalar ;
    using Transformation = typename Base::Transformation ;
    using Point = typename Base::Point ;
    using HomogeneousPoint = typename Base::HomogeneousPoint ;
    using Tangent = typename Base::Tangent ;
    using ParamsMember = Eigen::Matrix<Scalar, kM, 1, kOptions> ;

    // fields

    static constexpr int kDoF = Base::kDoF;
    static constexpr int kNumParameters = Base::kNumParameters;
    static constexpr int kMatrixDim = Base::kMatrixDim;
    static constexpr int kPointDim = Base::kPointDim;

    // construction

    Cartesian();
    Cartesian(Cartesian const& other);

    template <class TOtherDerived>
    Cartesian(CartesianBase<TOtherDerived, kM> const& other);

    template <class TD>
    Cartesian(Eigen::MatrixBase<TD> const& m);

    // methods

    SOPHUS_FUNC Cartesian& operator=(Cartesian const& other);
    SOPHUS_FUNC Scalar* data();
    SOPHUS_FUNC Scalar const* data() const;
    SOPHUS_FUNC ParamsMember& params();
    SOPHUS_FUNC ParamsMember const& params() const;

    template <class TOtherDerived>
    SOPHUS_FUNC CartesianBase<TDerived, kM>& operator=(CartesianBase<TOtherDerived, kM> const& other);

    static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpXAt0();
    static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpX(Tangent const&);
    static SOPHUS_FUNC Eigen::Matrix<Scalar, kPointDim, kDoF> dxExpXTimesPointAt0(Point const&);
    static SOPHUS_FUNC Transformation dxiExpmatXAt0(int i);
    static SOPHUS_FUNC Transformation generator(int i);
    static SOPHUS_FUNC Cartesian<Scalar, kM> exp(Tangent const& a);
    static SOPHUS_FUNC Transformation hat(Tangent const& a);
    static SOPHUS_FUNC Tangent lieBracket(Tangent const&, Tangent const&);

    template <class TUniformRandomBitGenerator>
    static Cartesian sampleUniform(TUniformRandomBitGenerator& generator);

    static SOPHUS_FUNC Tangent vee(Transformation const& m);

protected:
    // fields

    ParamsMember params_;
};

Detailed Documentation

Cartesian using default storage; derived from CartesianBase.

Construction

Cartesian()

Default constructor initializes to zero vector.

Cartesian(Cartesian const& other)

Copy constructor.

template <class TOtherDerived>
Cartesian(CartesianBase<TOtherDerived, kM> const& other)

Copy-like constructor from OtherDerived.

template <class TD>
Cartesian(Eigen::MatrixBase<TD> const& m)

Accepts either M-vector or (M+1)x(M+1) matrices.

Methods

SOPHUS_FUNC Cartesian& operator=(Cartesian const& other)

Define copy-assignment operator explicitly. The definition of implicit copy assignment operator is deprecated in presence of a user-declared copy constructor (-Wdeprecated-copy in clang >= 13).

SOPHUS_FUNC Scalar* data()

This provides unsafe read/write access to internal data.

SOPHUS_FUNC Scalar const* data() const

Const version of data() above.

SOPHUS_FUNC ParamsMember& params()

Mutator of params vector.

SOPHUS_FUNC ParamsMember const& params() const

Accessor of params vector.

template <class TOtherDerived>
SOPHUS_FUNC CartesianBase<TDerived, kM>& operator=(CartesianBase<TOtherDerived, kM> const& other)

Group multiplication, are vector additions.

static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpXAt0()

Returns derivative of exp(x) wrt. x.

static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpX(Tangent const&)

Returns derivative of exp(x) wrt. x_i at x=0.

static SOPHUS_FUNC Eigen::Matrix<Scalar, kPointDim, kDoF> dxExpXTimesPointAt0(Point const&)

Returns derivative of exp(x) * p wrt. x_i at x=0.

static SOPHUS_FUNC Transformation dxiExpmatXAt0(int i)

Returns derivative of expmat(x) wrt. x_i at x=0, with expmat(.) being the matrix exponential.

static SOPHUS_FUNC Transformation generator(int i)

Returns the ith infinitesimal generators of Cartesian(M).

The infinitesimal generators for e.g. the 3-dimensional case:

      |  0  0  0  1 |
G_0 = |  0  0  0  0 |
      |  0  0  0  0 |
      |  0  0  0  0 |

      |  0  0  0  0 |
G_1 = |  0  0  0  1 |
      |  0  0  0  0 |
      |  0  0  0  0 |

      |  0  0  0  0 |
G_2 = |  0  0  0  0 |
      |  0  0  0  1 |
      |  0  0  0  0 |

Precondition: i must be in [0, M-1].

static SOPHUS_FUNC Cartesian<Scalar, kM> exp(Tangent const& a)

Group exponential.

For Euclidean vector space, just the identity. Or to be more precise it just constructs the (M+1xM+1) homogeneous matrix representation

static SOPHUS_FUNC Transformation hat(Tangent const& a)

hat-operator

Formally, the hat() -operator of Cartesian(M) is defined as

hat(.): R^M -> R^{M+1xM+1}, hat(a) = sum_i a_i * G_i (for i=0,…,M-1)

with G_i being the ith infinitesimal generator of Cartesian(M).

The corresponding inverse is the vee() -operator, see below.

static SOPHUS_FUNC Tangent lieBracket(Tangent const&, Tangent const&)

Lie bracket.

Always 0 for commutative groups.

template <class TUniformRandomBitGenerator>
static Cartesian sampleUniform(TUniformRandomBitGenerator& generator)

Draws uniform samples in the range [-1, 1] per coordinates.

static SOPHUS_FUNC Tangent vee(Transformation const& m)

vee-operator

This is the inverse of the hat() -operator, see above.