gtsam
Loading...
Searching...
No Matches
SOn-inl.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
12#pragma once
13
20
21#include <gtsam/base/Matrix.h>
22
23#include <iostream>
24
25namespace gtsam {
26
27// Implementation for N>=5 just uses dynamic version
28template <int N>
29typename SO<N>::MatrixNN SO<N>::Hat(const TangentVector& xi) {
30 return SOn::Hat(xi);
31}
32
33// Implementation for N>=5 just uses dynamic version
34template <int N>
35typename SO<N>::TangentVector SO<N>::Vee(const MatrixNN& X) {
36 return SOn::Vee(X);
37}
38
39template <int N>
40SO<N> SO<N>::ChartAtOrigin::Retract(const TangentVector& xi) {
41 const Matrix X = Hat(xi / 2.0);
42 size_t n = AmbientDim(xi.size());
43 const auto I = Eigen::MatrixXd::Identity(n, n);
44 // https://pdfs.semanticscholar.org/6165/0347b2ccac34b5f423081d1ce4dbc4d09475.pdf
45 return SO((I + X) * (I - X).inverse());
46}
47
48template <int N>
49typename SO<N>::TangentVector SO<N>::ChartAtOrigin::Local(const SO& R) {
50 const size_t n = R.rows();
51 const auto I = Eigen::MatrixXd::Identity(n, n);
52 const Matrix X = (I - R.matrix_) * (I + R.matrix_).inverse();
53 return -2 * Vee(X);
54}
55
56template <int N>
57SO<N> SO<N>::Expmap(const TangentVector& omega) {
58 throw std::runtime_error("SO<N>::Expmap only implemented for SO3 and SO4.");
59}
60
61template <int N>
62typename SO<N>::TangentVector SO<N>::Logmap(const SO& R) {
63 throw std::runtime_error("SO<N>::Logmap only implemented for SO3.");
64}
65
66template <int N>
67void SO<N>::print(const std::string& s) const {
68 std::cout << s << matrix_ << std::endl;
69}
70
71} // namespace gtsam
typedef and functions to augment Eigen's MatrixXd
Global functions in a separate testing namespace.
Definition chartTesting.h:28
SO inverse() const
inverse of a rotation = transpose
Definition SOn.h:197
static TangentVector Vee(const MatrixNN &X)
Inverse of Hat. See note about xi element order in Hat.
Definition SOn-inl.h:35
MatrixNN matrix_
Rotation matrix.
Definition SOn.h:66
static SO Expmap(const TangentVector &omega)
Exponential map at identity - create a rotation from canonical coordinates.
Definition SOn-inl.h:57
static MatrixNN Hat(const TangentVector &xi)
Hat operator creates Lie algebra element corresponding to d-vector, where d is the dimensionality of ...
Definition SOn-inl.h:29
SO()
Construct SO<N> identity for N >= 2.
Definition SOn.h:83
static TangentVector Logmap(const SO &R)
Log map at identity - returns the canonical coordinates of this rotation.
Definition SOn-inl.h:62
static TangentVector Local(const SO &R)
Inverse of Retract.
Definition SOn-inl.h:49
static SO Retract(const TangentVector &xi)
Retract uses Cayley map.
Definition SOn-inl.h:40