template class sophus::RxSo3

Overview

RxSo3 using storage; derived from RxSo3Base. More…

#include <rxso3.h>

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

    using Base = RxSo3Base<RxSo3<TScalar, kOptions>> ;
    using Scalar = TScalar ;
    using Transformation = typename Base::Transformation ;
    using Point = typename Base::Point ;
    using HomogeneousPoint = typename Base::HomogeneousPoint ;
    using Tangent = typename Base::Tangent ;
    using Adjoint = typename Base::Adjoint ;
    using QuaternionMember = Eigen::Quaternion<Scalar, kOptions> ;

    // structs

    struct RxSo3AndTheta;

    // fields

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

    // construction

    RxSo3();
    RxSo3(RxSo3 const& other);

    template <class TOtherDerived>
    RxSo3(RxSo3Base<TOtherDerived> const& other);

    RxSo3(Transformation const& s_r);
    RxSo3(Scalar const& scale, Transformation const& r);
    RxSo3(Scalar const& scale, So3<Scalar> const& so3);

    template <class TD>
    RxSo3(Eigen::QuaternionBase<TD> const& quat);

    template <class TD>
    RxSo3(Scalar const& scale, Eigen::QuaternionBase<TD> const& unit_quat);

    // methods

    SOPHUS_FUNC RxSo3& operator=(RxSo3 const& other);
    SOPHUS_FUNC QuaternionMember const& quaternion() const;

    template <class TOtherDerived>
    SOPHUS_FUNC RxSo3Base<TDerived>& operator=(RxSo3Base<TOtherDerived> const& other);

    static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpXAt0();
    static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpX(Tangent const& a);
    static SOPHUS_FUNC Eigen::Matrix<Scalar, 3, kDoF> dxExpXTimesPointAt0(Point const& point);
    static SOPHUS_FUNC Transformation dxiExpmatXAt0(int i);
    static SOPHUS_FUNC RxSo3<Scalar> exp(Tangent const& a);
    static SOPHUS_FUNC RxSo3AndTheta expAndTheta(Tangent const& vec_a);
    static SOPHUS_FUNC Transformation generator(int i);
    static SOPHUS_FUNC Transformation hat(Tangent const& a);
    static SOPHUS_FUNC Tangent lieBracket(Tangent const& a, Tangent const& b);

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

    static SOPHUS_FUNC Tangent vee(Transformation const& omega);

protected:
    // fields

    QuaternionMember quaternion_;

    // methods

    SOPHUS_FUNC QuaternionMember& quaternionNonconst();
};

Detailed Documentation

RxSo3 using storage; derived from RxSo3Base.

Construction

RxSo3()

Default constructor initializes quaternion to identity rotation and scale to 1.

RxSo3(RxSo3 const& other)

Copy constructor.

template <class TOtherDerived>
RxSo3(RxSo3Base<TOtherDerived> const& other)

Copy-like constructor from OtherDerived.

RxSo3(Transformation const& s_r)

Constructor from scaled rotation matrix.

Precondition: rotation matrix need to be scaled orthogonal with determinant of s^3.

RxSo3(Scalar const& scale, Transformation const& r)

Constructor from scale factor and rotation matrix R.

Precondition: Rotation matrix R must to be orthogonal with determinant of 1 and scale must not be close to either zero or infinity.

RxSo3(Scalar const& scale, So3<Scalar> const& so3)

Constructor from scale factor and So3.

Precondition: scale must not to be close to either zero or infinity.

template <class TD>
RxSo3(Eigen::QuaternionBase<TD> const& quat)

Constructor from quaternion.

Precondition: quaternion must not be close to either zero or infinity.

template <class TD>
RxSo3(
    Scalar const& scale,
    Eigen::QuaternionBase<TD> const& unit_quat
    )

Constructor from scale factor and unit quaternion.

Precondition: quaternion must not be close to zero.

Methods

SOPHUS_FUNC RxSo3& operator=(RxSo3 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 QuaternionMember const& quaternion() const

Accessor of quaternion.

template <class TOtherDerived>
SOPHUS_FUNC RxSo3Base<TDerived>& operator=(RxSo3Base<TOtherDerived> const& other)

Assignment-like operator from OtherDerived.

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

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

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

Returns derivative of exp(x) wrt. x.

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

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 RxSo3<Scalar> exp(Tangent const& a)

Group exponential.

This functions takes in an element of tangent space (= rotation 3-vector plus logarithm of scale) and returns the corresponding element of the group RxSo3.

To be more specific, thixs function computes expmat(hat(omega)) with expmat(.) being the matrix exponential and hat(.) being the hat() -operator of RSO3.

static SOPHUS_FUNC RxSo3AndTheta expAndTheta(Tangent const& vec_a)

As above, but also returns theta = |omega|.

static SOPHUS_FUNC Transformation generator(int i)

Returns the ith infinitesimal generators of R+ x SO(3).

The infinitesimal generators of RxSo3 are:

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

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

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

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

Precondition: i must be 0, 1, 2 or 3.

static SOPHUS_FUNC Transformation hat(Tangent const& a)

hat-operator

It takes in the 4-vector representation a (= rotation vector plus logarithm of scale) and returns the corresponding matrix representation of Lie algebra element.

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

hat(.): R^4 -> R^{3x3}, hat(a) = sum_i a_i * G_i (for i=0,1,2,3)

with G_i being the ith infinitesimal generator of RxSo3.

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

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

Lie bracket.

It computes the Lie bracket of RxSO(3). To be more specific, it computes

[omega_1, omega_2]_rxso3 := vee([hat(omega_1), hat(omega_2)])

with [A,B] := AB-BA being the matrix commutator, hat(.) the hat() -operator and vee(.) the vee() -operator of RxSo3.

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

Draw uniform sample from RxSO(3) manifold.

The scale factor is drawn uniformly in log2-space from [-1, 1], hence the scale is in [0.5, 2].

static SOPHUS_FUNC Tangent vee(Transformation const& omega)

vee-operator

It takes the 3x3-matrix representation Omega and maps it to the corresponding vector representation of Lie algebra.

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

Precondition: Omega must have the following structure:

|  d -c  b |
|  c  d -a |
| -b  a  d |