gtsam
Loading...
Searching...
No Matches
Rot3.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, 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
22// \callgraph
23
24#pragma once
25
26#include <gtsam/base/concepts.h>
27#include <gtsam/config.h> // Get GTSAM_USE_QUATERNIONS macro
29#include <gtsam/geometry/SO3.h>
30#include <gtsam/geometry/Unit3.h>
31
32#include <random>
33#include <stdexcept>
34#include <utility>
35
36// You can override the default coordinate mode using this flag
37#ifndef ROT3_DEFAULT_COORDINATES_MODE
38 #ifdef GTSAM_USE_QUATERNIONS
39 // Exponential map is very cheap for quaternions
40 #define ROT3_DEFAULT_COORDINATES_MODE Rot3::EXPMAP
41 #else
42 // If user doesn't require GTSAM_ROT3_EXPMAP in cmake when building
43 #ifndef GTSAM_ROT3_EXPMAP
44 // For rotation matrices, the Cayley transform is a fast retract alternative
45 #define ROT3_DEFAULT_COORDINATES_MODE Rot3::CAYLEY
46 #else
47 #define ROT3_DEFAULT_COORDINATES_MODE Rot3::EXPMAP
48 #endif
49 #endif
50#endif
51
52namespace gtsam {
53
54namespace internal {
55template <typename G>
57} // namespace internal
58
65class GTSAM_EXPORT Rot3 : public MatrixLieGroup<Rot3, 3, 3> {
66 public:
67 static constexpr size_t MatrixM = 3;
68 private:
69
70#ifdef GTSAM_USE_QUATERNIONS
72 gtsam::Quaternion quaternion_;
73#else
74 SO3 rot_;
75#endif
76
77 public:
80
82 Rot3();
83
90 Rot3(const Point3& col1, const Point3& col2, const Point3& col3);
91
93 Rot3(double R11, double R12, double R13,
94 double R21, double R22, double R23,
95 double R31, double R32, double R33);
96
104 template <typename Derived>
105#ifdef GTSAM_USE_QUATERNIONS
106 explicit Rot3(const Eigen::MatrixBase<Derived>& R) {
107 quaternion_ = Matrix3(R);
108 }
109#else
110 explicit Rot3(const Eigen::MatrixBase<Derived>& R) : rot_(R) {
111 }
112#endif
113
118#ifdef GTSAM_USE_QUATERNIONS
119 explicit Rot3(const Matrix3& R) : quaternion_(R) {}
120#else
121 explicit Rot3(const Matrix3& R) : rot_(R) {}
122#endif
123
127#ifdef GTSAM_USE_QUATERNIONS
128 explicit Rot3(const SO3& R) : quaternion_(R.matrix()) {}
129#else
130 explicit Rot3(const SO3& R) : rot_(R) {}
131#endif
132
137 Rot3(const Quaternion& q);
138 Rot3(double w, double x, double y, double z) : Rot3(Quaternion(w, x, y, z)) {}
139
146 static Rot3 Random(std::mt19937 & rng);
147
149 virtual ~Rot3() {}
150
152 static bool IsValid(const Matrix3& R, double tol = 1e-9);
153
154 /* Static member function to generate some well known rotations */
155
157 static Rot3 Rx(double t);
158
160 static Rot3 Ry(double t);
161
163 static Rot3 Rz(double t);
164
166 static Rot3 RzRyRx(double x, double y, double z,
168 OptionalJacobian<3, 1> Hy = {},
169 OptionalJacobian<3, 1> Hz = {});
170
172 inline static Rot3 RzRyRx(const Vector& xyz,
173 OptionalJacobian<3, 3> H = {}) {
174#ifndef NDEBUG
175 if (xyz.size() != 3) {
176 throw;
177 }
178#endif
179 Rot3 out;
180 if (H) {
181 Vector3 Hx, Hy, Hz;
182 out = RzRyRx(xyz(0), xyz(1), xyz(2), Hx, Hy, Hz);
183 (*H) << Hx, Hy, Hz;
184 } else
185 out = RzRyRx(xyz(0), xyz(1), xyz(2));
186 return out;
187 }
188
190 static Rot3 Yaw (double t) { return Rz(t); }
191
193 static Rot3 Pitch(double t) { return Ry(t); }
194
196 static Rot3 Roll (double t) { return Rx(t); }
197
212 static Rot3 Ypr(double y, double p, double r,
215 OptionalJacobian<3, 1> Hr = {}) {
216 return RzRyRx(r, p, y, Hr, Hp, Hy);
217 }
218
220 static Rot3 Quaternion(double w, double x, double y, double z) {
221 gtsam::Quaternion q(w, x, y, z);
222 return Rot3(q);
223 }
224
231 static Rot3 AxisAngle(const Point3& axis, double angle) {
232 // Convert to unit vector.
233 Vector3 unitAxis = Unit3(axis).unitVector();
234#ifdef GTSAM_USE_QUATERNIONS
235 return gtsam::Quaternion(Eigen::AngleAxis<double>(angle, unitAxis));
236#else
237 return Rot3(SO3::AxisAngle(unitAxis,angle));
238#endif
239 }
240
247 static Rot3 AxisAngle(const Unit3& axis, double angle) {
248 return AxisAngle(axis.unitVector(),angle);
249 }
250
256 static Rot3 Rodrigues(const Vector3& w) {
257 return Rot3::Expmap(w);
258 }
259
267 static Rot3 Rodrigues(double wx, double wy, double wz) {
268 return Rodrigues(Vector3(wx, wy, wz));
269 }
270
272 static Rot3 AlignPair(const Unit3& axis, const Unit3& a_p, const Unit3& b_p);
273
275 static Rot3 AlignTwoPairs(const Unit3& a_p, const Unit3& b_p, //
276 const Unit3& a_q, const Unit3& b_q);
277
287 static Rot3 ClosestTo(const Matrix3& M) { return Rot3(SO3::ClosestTo(M)); }
288
299 Rot3 normalized() const;
300
304
306 void print(const std::string& s="") const;
307
309 bool equals(const Rot3& p, double tol = 1e-9) const;
310
314
316 inline static Rot3 Identity() {
317 return Rot3();
318 }
319
321 Rot3 operator*(const Rot3& R2) const;
322
324 Rot3 inverse() const {
325#ifdef GTSAM_USE_QUATERNIONS
326 return Rot3(quaternion_.inverse());
327#else
328 return Rot3(rot_.matrix().transpose());
329#endif
330 }
331
337 Rot3 conjugate(const Rot3& cRb) const {
338 // TODO: do more efficiently by using Eigen or quaternion properties
339 return cRb * (*this) * cRb.inverse();
340 }
341
345
357#ifndef GTSAM_USE_QUATERNIONS
359#endif
360 };
361
362#ifndef GTSAM_USE_QUATERNIONS
363
364 // Cayley chart around origin
365 struct GTSAM_EXPORT CayleyChart {
366 static Rot3 Retract(const Vector3& v, OptionalJacobian<3, 3> H = {});
367 static Vector3 Local(const Rot3& r, OptionalJacobian<3, 3> H = {});
368 };
369
371 Rot3 retractCayley(const Vector& omega) const {
372 return compose(CayleyChart::Retract(omega));
373 }
374
376 Vector3 localCayley(const Rot3& other) const {
377 return CayleyChart::Local(between(other));
378 }
379
380#endif
381
385
386 using LieAlgebra = Matrix3;
387
392 static Rot3 Expmap(const Vector3& v, OptionalJacobian<3,3> H = {});
393
398 static Vector3 Logmap(const Rot3& R, OptionalJacobian<3,3> H = {});
399
401 static Matrix3 ExpmapDerivative(const Vector3& x);
402
404 static Matrix3 LogmapDerivative(const Vector3& x);
405
407 Matrix3 AdjointMap() const { return matrix(); }
408
410 static Matrix3 adjointMap(const Vector3& xi) { return Hat(xi); }
411
412 // Chart at origin, depends on compile-time flag ROT3_DEFAULT_COORDINATES_MODE
413 struct GTSAM_EXPORT ChartAtOrigin {
414 static Rot3 Retract(const Vector3& v, ChartJacobian H = {});
415 static Vector3 Local(const Rot3& r, ChartJacobian H = {});
416 };
417
418 using LieGroup<Rot3, 3>::inverse; // version with derivative
419
421 static inline Matrix3 Hat(const Vector3& xi) { return SO3::Hat(xi); }
422
424 static inline Vector3 Vee(const Matrix3& X) { return SO3::Vee(X); }
425
429
433 Point3 rotate(const Point3& p, OptionalJacobian<3,3> H1 = {},
434 OptionalJacobian<3,3> H2 = {}) const;
435
437 Point3 operator*(const Point3& p) const;
438
440 Point3 unrotate(const Point3& p, OptionalJacobian<3,3> H1 = {},
441 OptionalJacobian<3,3> H2={}) const;
442
446
448 Unit3 rotate(const Unit3& p, OptionalJacobian<2,3> HR = {},
449 OptionalJacobian<2,2> Hp = {}) const;
450
452 Unit3 unrotate(const Unit3& p, OptionalJacobian<2,3> HR = {},
453 OptionalJacobian<2,2> Hp = {}) const;
454
456 Unit3 operator*(const Unit3& p) const;
457
461
463 Matrix3 matrix() const;
464
468 Matrix3 transpose() const;
469
470 Point3 r1() const;
471 Point3 r2() const;
472 Point3 r3() const;
473
478 Vector3 xyz(OptionalJacobian<3, 3> H = {}) const;
479
484 Vector3 ypr(OptionalJacobian<3, 3> H = {}) const;
485
490 Vector3 rpy(OptionalJacobian<3, 3> H = {}) const;
491
498 double roll(OptionalJacobian<1, 3> H = {}) const;
499
506 double pitch(OptionalJacobian<1, 3> H = {}) const;
507
514 double yaw(OptionalJacobian<1, 3> H = {}) const;
515
519
528 std::pair<Unit3, double> axisAngle() const;
529
533 gtsam::Quaternion toQuaternion() const;
534
540 Rot3 slerp(double t, const Rot3& other) const;
541
543 inline Vector9 vec(OptionalJacobian<9, 3> H = {}) const { return SO3(matrix()).vec(H); }
544
546 GTSAM_EXPORT friend std::ostream &operator<<(std::ostream &os, const Rot3& p);
547
551
552#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
554 Point3 column(int index) const;
555#endif
556
558
559 private:
560#if GTSAM_ENABLE_BOOST_SERIALIZATION
562 friend class boost::serialization::access;
563 template <class ARCHIVE>
564 void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
565#ifndef GTSAM_USE_QUATERNIONS
566 Matrix3& M = rot_.matrix_;
567 ar& boost::serialization::make_nvp("rot11", M(0, 0));
568 ar& boost::serialization::make_nvp("rot12", M(0, 1));
569 ar& boost::serialization::make_nvp("rot13", M(0, 2));
570 ar& boost::serialization::make_nvp("rot21", M(1, 0));
571 ar& boost::serialization::make_nvp("rot22", M(1, 1));
572 ar& boost::serialization::make_nvp("rot23", M(1, 2));
573 ar& boost::serialization::make_nvp("rot31", M(2, 0));
574 ar& boost::serialization::make_nvp("rot32", M(2, 1));
575 ar& boost::serialization::make_nvp("rot33", M(2, 2));
576#else
577 ar& boost::serialization::make_nvp("w", quaternion_.w());
578 ar& boost::serialization::make_nvp("x", quaternion_.x());
579 ar& boost::serialization::make_nvp("y", quaternion_.y());
580 ar& boost::serialization::make_nvp("z", quaternion_.z());
581#endif
582 }
583#endif
584 };
585
587 using Rot3Vector = std::vector<Rot3, Eigen::aligned_allocator<Rot3>>;
588
599 GTSAM_EXPORT std::pair<Matrix3, Vector3> RQ(
600 const Matrix3& A, OptionalJacobian<3, 9> H = {});
601
602template <>
603struct traits<Rot3> : public internal::MatrixLieGroup<Rot3, 3> {
605 inline constexpr static int QcqpVectorDim = 10;
606
615 template <int D = 1>
616 static Matrix QcqpValue(const Rot3& value) {
617 if constexpr (D == 1) {
618 const Matrix3 R = value.matrix();
619 Vector10 X;
620 X(0, 0) = 1.0; // Homogenization entry.
621 X.bottomRows(9) = Eigen::Map<const Matrix>(R.data(), 9, 1);
622 return X;
623 } else if constexpr (D >= 3) {
624 Matrix X = Matrix::Zero(3, D);
625 X.template leftCols<3>() = value.matrix().transpose();
626 return X;
627 } else {
628 throw std::invalid_argument(
629 "traits<Rot3>::QcqpValue only supports D=1 and D>=3.");
630 }
631 }
632
640 template <int D = 1>
641 static std::vector<std::pair<Matrix, double>> QcqpConstraints() {
642 if constexpr (D == 1) {
643 // The homogenized Rot3 lifted vector is
644 // x = [1, r00, r10, r20, r01, r11, r21, r02, r12, r22].
645 std::vector<std::pair<Matrix, double>> constraints;
646 constraints.reserve(10);
647
648 Matrix A = Matrix::Zero(10, 10);
649
650 // The quadratic lift fixes x(0)^2 = 1.
651 A(0, 0) = 1.0;
652 constraints.emplace_back(A, 1.0);
653
654 // cross(R.col(1), R.col(2)) = x(0) * R.col(0).
655 A.setZero();
656 A(5, 9) = 0.5;
657 A(9, 5) = 0.5;
658 A(6, 8) = -0.5;
659 A(8, 6) = -0.5;
660 A(0, 1) = -0.5;
661 A(1, 0) = -0.5;
662 constraints.emplace_back(A, 0.0);
663
664 A.setZero();
665 A(6, 7) = 0.5;
666 A(7, 6) = 0.5;
667 A(4, 9) = -0.5;
668 A(9, 4) = -0.5;
669 A(0, 2) = -0.5;
670 A(2, 0) = -0.5;
671 constraints.emplace_back(A, 0.0);
672
673 A.setZero();
674 A(4, 8) = 0.5;
675 A(8, 4) = 0.5;
676 A(5, 7) = -0.5;
677 A(7, 5) = -0.5;
678 A(0, 3) = -0.5;
679 A(3, 0) = -0.5;
680 constraints.emplace_back(A, 0.0);
681
682 // RR^T = I supplies the six row-orthonormality constraints.
683 A.setZero();
684 A(1, 1) = 1.0;
685 A(4, 4) = 1.0;
686 A(7, 7) = 1.0;
687 constraints.emplace_back(A, 1.0);
688
689 A.setZero();
690 A(1, 2) = 0.5;
691 A(2, 1) = 0.5;
692 A(4, 5) = 0.5;
693 A(5, 4) = 0.5;
694 A(7, 8) = 0.5;
695 A(8, 7) = 0.5;
696 constraints.emplace_back(A, 0.0);
697
698 A.setZero();
699 A(1, 3) = 0.5;
700 A(3, 1) = 0.5;
701 A(4, 6) = 0.5;
702 A(6, 4) = 0.5;
703 A(7, 9) = 0.5;
704 A(9, 7) = 0.5;
705 constraints.emplace_back(A, 0.0);
706
707 A.setZero();
708 A(2, 2) = 1.0;
709 A(5, 5) = 1.0;
710 A(8, 8) = 1.0;
711 constraints.emplace_back(A, 1.0);
712
713 A.setZero();
714 A(2, 3) = 0.5;
715 A(3, 2) = 0.5;
716 A(5, 6) = 0.5;
717 A(6, 5) = 0.5;
718 A(8, 9) = 0.5;
719 A(9, 8) = 0.5;
720 constraints.emplace_back(A, 0.0);
721
722 A.setZero();
723 A(3, 3) = 1.0;
724 A(6, 6) = 1.0;
725 A(9, 9) = 1.0;
726 constraints.emplace_back(A, 1.0);
727
728 return constraints;
729 } else if constexpr (D >= 3) {
730 std::vector<std::pair<Matrix, double>> constraints;
731 constraints.reserve(6);
732
733 // 3 row-unit-norm: ||row r||^2 = 1.
734 for (int r = 0; r < 3; ++r) {
735 Matrix A = Matrix::Zero(3, 3);
736 A(r, r) = 1.0;
737 constraints.emplace_back(A, 1.0);
738 }
739
740 // 3 row-orthogonality: row r1 . row r2 = 0.
741 for (int r1 = 0; r1 < 3; ++r1) {
742 for (int r2 = r1 + 1; r2 < 3; ++r2) {
743 Matrix A = Matrix::Zero(3, 3);
744 A(r1, r2) = 0.5;
745 A(r2, r1) = 0.5;
746 constraints.emplace_back(A, 0.0);
747 }
748 }
749 return constraints;
750 } else {
751 throw std::invalid_argument(
752 "traits<Rot3>::QcqpConstraints only supports D=1 and D>=3.");
753 }
754 }
755
763 template <int D>
764 static Rot3 FromQcqpValue(const Matrix& X) {
765 if constexpr (D == 1) {
766 if (X.rows() != QcqpVectorDim || X.cols() != 1 ||
767 std::abs(X(0, 0)) < 1e-9) {
768 throw std::invalid_argument(
769 "traits<Rot3>::FromQcqpValue requires a 10-by-1 vector with a "
770 "nonzero homogenization entry.");
771 }
772 const Vector x = X.col(0) / X(0, 0);
773 Matrix3 R;
774 R.col(0) = x.segment<3>(1);
775 R.col(1) = x.segment<3>(4);
776 R.col(2) = x.segment<3>(7);
777 return Rot3::ClosestTo(R);
778 } else {
779 static_assert(D >= 3,
780 "traits<Rot3>::FromQcqpValue requires D >= 3.");
781 if (X.rows() != 3 || X.cols() != D) {
782 throw std::invalid_argument(
783 "traits<Rot3>::FromQcqpValue requires a 3-by-D matrix.");
784 }
785 return Rot3::ClosestTo(X.template leftCols<3>().transpose());
786 }
787 }
788};
789
790template <>
791struct traits<const Rot3> : public traits<Rot3> {};
792
793namespace internal {
794
803template <>
805 static constexpr bool available = true;
806 static constexpr bool expmapAvailable = true;
807
815 static std::pair<Rot3, Vector3> expmap(
816 const Vector3& omega, const Vector3& v,
817 OptionalJacobian<6, 6> derivative = {}) {
818 const so3::DexpFunctor local(omega);
819#ifdef GTSAM_USE_QUATERNIONS
820 const Rot3 rotation = traits<gtsam::Quaternion>::Expmap(omega);
821#else
822 const Rot3 rotation(local.expmap());
823#endif
824 const Vector3 transported =
825 local.tangentExpmap(v, rotation.matrix(), derivative);
826 return {rotation, transported};
827 }
828
829 static Matrix6 rightJacobian(const Vector3& omega, const Vector3& v) {
830 Matrix6 derivative;
831 expmap(omega, v, derivative);
832 return derivative;
833 }
834};
835
836} // namespace internal
837
838} // namespace gtsam
P rotate(const T &r, const P &pt)
rotation functions
Definition lieProxies.h:47
Lie Group wrapper for Eigen Quaternions.
3*3 matrix representation of SO(3)
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Expression< T > expmap(const Expression< T > &origin, const Expression< typename traits< T >::TangentVector > &tangent)
Apply an exponential-map increment to a Lie-group expression.
Definition expressions.h:43
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
Point2 operator*(double s, const Point2 &p)
multiply with scalar
Definition Point2.h:52
std::vector< Rot3, Eigen::aligned_allocator< Rot3 > > Rot3Vector
std::vector of Rot3s, used in Matlab wrapper
Definition Rot3.h:587
pair< Matrix3, Vector3 > RQ(const Matrix3 &A, OptionalJacobian< 3, 9 > H)
[RQ] receives a 3 by 3 matrix and returns an upper triangular matrix R and 3 rotation angles correspo...
Definition Rot3.cpp:255
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A CRTP helper class that implements Lie group methods Prerequisites: methods operator*,...
Definition Lie.h:114
A CRTP helper class that implements matrix Lie group methods.
Definition MatrixLieGroup.h:51
Both LieGroupTraits and Testable.
Definition MatrixLieGroup.h:350
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
Optional closed-form kernels used by TangentLieGroup::Expmap() and its private rightJacobian() helper...
Definition TangentLieGroup.h:51
Template to create a binary predicate.
Definition Testable.h:112
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
static Rot3 Identity()
identity rotation for group operation
Definition Rot3.h:316
Vector9 vec(OptionalJacobian< 9, 3 > H={}) const
Vee maps from Lie algebra to tangent vector.
Definition Rot3.h:543
static Vector3 Vee(const Matrix3 &X)
Vee maps from Lie algebra to tangent vector.
Definition Rot3.h:424
static Rot3 Roll(double t)
Positive roll is to right (increasing yaw in aircraft).
Definition Rot3.h:196
Rot3 retractCayley(const Vector &omega) const
Retraction from R^3 to Rot3 manifold using the Cayley transform.
Definition Rot3.h:371
Matrix3 AdjointMap() const
Calculate Adjoint map.
Definition Rot3.h:407
static Rot3 ClosestTo(const Matrix3 &M)
Static, named constructor that finds Rot3 element closest to M in Frobenius norm.
Definition Rot3.h:287
virtual ~Rot3()
Virtual destructor.
Definition Rot3.h:149
static Rot3 Yaw(double t)
Positive yaw is to right (as in aircraft heading). See ypr.
Definition Rot3.h:190
static Rot3 Expmap(const Vector3 &v, OptionalJacobian< 3, 3 > H={})
Exponential map - create a rotation from canonical coordinates using Rodrigues' formula.
Definition Rot3M.cpp:173
static Rot3 AxisAngle(const Unit3 &axis, double angle)
Convert from axis/angle representation.
Definition Rot3.h:247
static Matrix3 Hat(const Vector3 &xi)
Hat maps from tangent vector to Lie algebra.
Definition Rot3.h:421
Rot3(const Matrix3 &R)
Constructor from a rotation matrix Overload version for Matrix3 to avoid casting in quaternion mode.
Definition Rot3.h:121
static Matrix3 adjointMap(const Vector3 &xi)
Matrix representation of the Lie-algebra adjoint operator ad_xi on so(3).
Definition Rot3.h:410
static Rot3 Rodrigues(const Vector3 &w)
Rodrigues' formula to compute an incremental rotation.
Definition Rot3.h:256
Rot3()
default constructor, unit rotation
Definition Rot3M.cpp:52
static Rot3 RzRyRx(const Vector &xyz, OptionalJacobian< 3, 3 > H={})
Rotations around Z, Y, then X axes as in http://en.wikipedia.org/wiki/Rotation_matrix,...
Definition Rot3.h:172
static Rot3 Ry(double t)
Rotation around Y axis as in http://en.wikipedia.org/wiki/Rotation_matrix, counterclockwise when look...
Definition Rot3M.cpp:82
static Rot3 AxisAngle(const Point3 &axis, double angle)
Convert from axis/angle representation.
Definition Rot3.h:231
Vector3 xyz(OptionalJacobian< 3, 3 > H={}) const
Use RQ to calculate xyz angle representation.
Definition Rot3.cpp:169
static Rot3 Pitch(double t)
Positive pitch is up (increasing aircraft altitude).See ypr.
Definition Rot3.h:193
Vector3 localCayley(const Rot3 &other) const
Inverse of retractCayley.
Definition Rot3.h:376
static Rot3 Quaternion(double w, double x, double y, double z)
Create from Quaternion coefficients.
Definition Rot3.h:220
static Rot3 Rx(double t)
Rotation around X axis as in http://en.wikipedia.org/wiki/Rotation_matrix, counterclockwise when look...
Definition Rot3M.cpp:73
Rot3 conjugate(const Rot3 &cRb) const
Conjugation: given a rotation acting in frame B, compute rotation c1Rc2 acting in a frame C.
Definition Rot3.h:337
static Rot3 Rodrigues(double wx, double wy, double wz)
Rodrigues' formula to compute an incremental rotation.
Definition Rot3.h:267
Rot3 inverse() const
inverse of a rotation
Definition Rot3.h:324
Rot3(const SO3 &R)
Constructor from an SO3 instance.
Definition Rot3.h:130
static Rot3 Ypr(double y, double p, double r, OptionalJacobian< 3, 1 > Hy={}, OptionalJacobian< 3, 1 > Hp={}, OptionalJacobian< 3, 1 > Hr={})
Returns rotation nRb from body to nav frame.
Definition Rot3.h:212
static Rot3 Rz(double t)
Rotation around Z axis as in http://en.wikipedia.org/wiki/Rotation_matrix, counterclockwise when look...
Definition Rot3M.cpp:91
CoordinatesMode
The method retract() is used to map from the tangent space back to the manifold.
Definition Rot3.h:355
@ CAYLEY
Retract and localCoordinates using the Cayley transform.
Definition Rot3.h:358
@ EXPMAP
Use the Lie group exponential map to retract.
Definition Rot3.h:356
Rot3(const Eigen::MatrixBase< Derived > &R)
Constructor from a rotation matrix Version for generic matrices.
Definition Rot3.h:110
Matrix3 matrix() const
return 3*3 rotation matrix
Definition Rot3M.cpp:261
Definition Rot3.h:365
Definition Rot3.h:413
static constexpr int QcqpVectorDim
Dimension of the D=1 homogenized QCQP vector.
Definition Rot3.h:605
static std::vector< std::pair< Matrix, double > > QcqpConstraints()
Return row-space QCQP equality constraints A, b such that trace(X' A X) = b.
Definition Rot3.h:641
static Matrix QcqpValue(const Rot3 &value)
Return a matrix-valued QCQP variable for Rot3.
Definition Rot3.h:616
static Rot3 FromQcqpValue(const Matrix &X)
Project a D=1 vector or canonical 3-by-D lift back to Rot3.
Definition Rot3.h:764
static std::pair< Rot3, Vector3 > expmap(const Vector3 &omega, const Vector3 &v, OptionalJacobian< 6, 6 > derivative={})
Evaluate the complete TSO(3) exponential from one SO(3) kernel.
Definition Rot3.h:815
Functor that implements Exponential map and its derivatives Math extends Ethan theme of elegant I + a...
Definition SO3.h:184
static TangentVector Vee(const MatrixNN &X)
MatrixNN matrix_
Rotation matrix.
Definition SOn.h:66
static SO AxisAngle(const Vector3 &axis, double theta)
Definition SO3.cpp:254
static MatrixNN Hat(const TangentVector &xi)
static SO ClosestTo(const MatrixNN &M)
Represents a 3D point on a unit sphere.
Definition Unit3.h:44
Vector3 unitVector(OptionalJacobian< 3, 2 > H={}) const
Return unit-norm Vector.
Definition Unit3.cpp:151