template class sophus::CartesianBase¶
Overview¶
Cartesian base type - implements Cartesian class but is storage agnostic. More…
#include <cartesian.h> template <class TDerived, int kM> class CartesianBase { public: // typedefs using Scalar = typename Eigen::internal::traits<TDerived>::Scalar ; using ParamsType = typename Eigen::internal::traits<TDerived>::ParamsType ; using Transformation = Eigen::Matrix<Scalar, kMatrixDim, kMatrixDim> ; using Point = Eigen::Vector<Scalar, kM> ; using HomogeneousPoint = Eigen::Vector<Scalar, kMatrixDim> ; using Line = Eigen::ParametrizedLine<Scalar, kM> ; using Hyperplane = Eigen::Hyperplane<Scalar, kM> ; using Tangent = Eigen::Vector<Scalar, kDoF> ; using Adjoint = Eigen::Matrix<Scalar, kDoF, kDoF> ; using ReturnScalar = typename Eigen::ScalarBinaryOpTraits<Scalar, typename TOtherDerived::Scalar>::ReturnType ; using CartesianSum = Cartesian<ReturnScalar<TOtherDerived>, kM> ; using PointProduct = Eigen::Vector<ReturnScalar<TPointDerived>, kM> ; using HomogeneousPointProduct = Eigen::Vector<ReturnScalar<THPointDerived>, kMatrixDim> ; // fields static constexpr int kDoF = kM; static constexpr int kNumParameters = kM; static constexpr int kMatrixDim = kM + 1; static constexpr int kPointDim = kM; // methods SOPHUS_FUNC Adjoint adj() const; template <class TNewScalarType> SOPHUS_FUNC Cartesian<TNewScalarType, kM> cast() const; SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxThisMulExpXAt0() const; SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxLogThisInvTimesXAtThis() const; SOPHUS_FUNC Cartesian<Scalar, kM> inverse() const; SOPHUS_FUNC Tangent log() const; SOPHUS_FUNC Transformation matrix() const; template <class TOtherDerived> SOPHUS_FUNC CartesianBase<TDerived, kM>& operator=(CartesianBase<TOtherDerived, kM> const& other); template <class TOtherDerived> SOPHUS_FUNC CartesianSum<TOtherDerived> operator*(CartesianBase<TOtherDerived, kM> const& other) const; template < typename TPointDerived, typename = typename std::enable_if<IsFixedSizeVector<TPointDerived, kM>::value>::type > SOPHUS_FUNC PointProduct<TPointDerived> operator*(Eigen::MatrixBase<TPointDerived> const& p) const; template < typename THPointDerived, typename = typename std::enable_if<IsFixedSizeVector<THPointDerived, kMatrixDim>::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 CartesianBase<TDerived, kM>& operator*=(CartesianBase<TOtherDerived, kM> const& other); SOPHUS_FUNC ParamsType& params(); SOPHUS_FUNC ParamsType const& params() const; }; // direct descendants template <class TScalar, int kM, int kOptions> class Map<sophus::Cartesian<TScalar, kM> const, kOptions>;
Detailed Documentation¶
Cartesian base type - implements Cartesian class but is storage agnostic.
Euclidean vector space as Lie group.
Lie groups can be seen as a generalization over the Euclidean vector space R^M. Here a kMatrixDim-dimensional vector p
is represented as a | I p | | o 1 |
On the other hand, Cartesian(M) can be seen as a special case of SE(M) with identity rotation, and hence represents pure translation.
The purpose of this class is two-fold:
for educational purpose, to highlight how Lie groups generalize over Euclidean vector spaces.
to be used in templated/generic algorithms (such as sophus::Spline) which are implemented against the Lie group interface.
Obviously, Cartesian(M) can just be represented as a M-tuple.
Cartesian is not compact, but a commutative group. For vector additions it holds a+b = b+a
.
See Cartesian class for more details below.
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 Cartesian operations.
Fields¶
static constexpr int kDoF = kM
Degrees of freedom of manifold, equals to number of Cartesian coordinates.
static constexpr int kNumParameters = kM
Number of internal parameters used, also M.
static constexpr int kMatrixDim = kM + 1
Group transformations are (M+1)x(M+1) matrices.
Methods¶
SOPHUS_FUNC Adjoint adj() const
Adjoint transformation.
Always identity of commutative groups.
template <class TNewScalarType> SOPHUS_FUNC Cartesian<TNewScalarType, kM> 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, kNumParameters, kDoF> dxLogThisInvTimesXAtThis() const
Returns derivative of log(this^{-1} * x) by x at x=this.
SOPHUS_FUNC Cartesian<Scalar, kM> inverse() const
Returns group inverse.
The additive inverse.
SOPHUS_FUNC Tangent log() const
Logarithmic map.
For Euclidean vector space, just the identity. Or to be more precise it just extracts the significant M-vector from the NxN matrix.
SOPHUS_FUNC Transformation matrix() const
Returns 4x4 matrix representation of the instance.
It has the following form:
| I p | | o 1 |
template <class TOtherDerived> SOPHUS_FUNC CartesianBase<TDerived, kM>& operator=(CartesianBase<TOtherDerived, kM> const& other)
Group multiplication, are vector additions.
template <class TOtherDerived> SOPHUS_FUNC CartesianSum<TOtherDerived> operator*(CartesianBase<TOtherDerived, kM> const& other) const
Group multiplication, are vector additions.
template < typename TPointDerived, typename = typename std::enable_if<IsFixedSizeVector<TPointDerived, kM>::value>::type > SOPHUS_FUNC PointProduct<TPointDerived> operator*(Eigen::MatrixBase<TPointDerived> const& p) const
Group action on points, again just vector addition.
template < typename THPointDerived, typename = typename std::enable_if<IsFixedSizeVector<THPointDerived, kMatrixDim>::value>::type > SOPHUS_FUNC HomogeneousPointProduct<THPointDerived> operator*(Eigen::MatrixBase<THPointDerived> const& p) const
Group action on homogeneous points. See above for more details.
SOPHUS_FUNC Line operator*(Line const& l) const
Group action on lines.
SOPHUS_FUNC Hyperplane operator*(Hyperplane const& p) const
Group action on planes.
template < typename TOtherDerived, typename = typename std::enable_if<std::is_same<Scalar, ReturnScalar<TOtherDerived>>::value>::type > SOPHUS_FUNC CartesianBase<TDerived, kM>& operator*=(CartesianBase<TOtherDerived, kM> const& other)
In-place group multiplication. This method is only valid if the return type of the multiplication is compatible with this Cartesian ‘s Scalar type.
SOPHUS_FUNC ParamsType& params()
Mutator of params vector.
SOPHUS_FUNC ParamsType const& params() const
Accessor of params vector.