MROB
SO3.hpp
1 /* Copyright (c) 2022, Gonzalo Ferrer
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  *
16  * SO3.hpp
17  *
18  * Created on: Feb 12, 2018
19  * Author: Gonzalo Ferrer
20  * g.ferrer@skoltech.ru
21  * Mobile Robotics Lab, Skoltech
22  */
23 
24 
25 #ifndef SO3_HPP_
26 #define SO3_HPP_
27 
28 
29 #include "mrob/matrix_base.hpp"
30 
31 
32 
33 
46 namespace mrob{
47 
48 
49 class SO3
50 {
51 public:
56  SO3(const Mat3 &R = Mat3::Identity());
62  SO3(const Mat31 &w);
67  SO3(const SO3 &R);
72  template<typename OtherDerived>
73  SO3(const Eigen::MatrixBase<OtherDerived>& rhs);
77  SO3& operator=(const SO3& rhs);
78 
82  SO3 operator*(const SO3& rhs) const;
83 
87  SO3 mul(const SO3& rhs) const;
88 
94  void update_lhs(const Mat31 &dw);
99  void update_rhs(const Mat31 &dw);
105  void exp(const Mat3 &w_hat);
113  Mat3 ln(double *o = nullptr) const;
117  Mat31 ln_vee() const;
121  SO3 inv(void) const;
125  Mat3 adj() const;
129  Mat3 R() const;
133  Mat3& ref2R();
134 
135  double distance(const SO3 &rhs) const;
136 
137  void print(void) const;
138  void print_lie(void) const;
139 
140 
146  std::string toString() const;
147 
148 
149 protected:
150  Mat3 R_;
151 
152 public:
153  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
154 };
155 
156 
164 Mat3 hat3(const Mat31 &w);
170 Mat31 vee3(const Mat3 &w_hat);
171 
172 bool isSO3(const Mat3 &R);
173 
174 
180 Mat3 quat_to_so3(const Eigen::Ref<const Mat41> v);
181 
182 
187 Mat41 so3_to_quat(const Eigen::Ref<const Mat3> R);
188 
193 Mat3 rpy_to_so3(const Eigen::Ref<const Mat31> v);
194 
195 }// end namespace
196 #endif /* SO3_HPP_ */
Mat3 quat_to_so3(const Eigen::Ref< const Mat41 > v)
Definition: SO3.cpp:299
void update_lhs(const Mat31 &dw)
Definition: SO3.cpp:78
Mat41 so3_to_quat(const Eigen::Ref< const Mat3 > R)
Definition: SO3.cpp:308
void update_rhs(const Mat31 &dw)
Definition: SO3.cpp:84
SO3(const Mat3 &R=Mat3::Identity())
Definition: SO3.cpp:34
SO3 inv(void) const
Definition: SO3.cpp:249
Mat3 rpy_to_so3(const Eigen::Ref< const Mat31 > v)
Definition: SO3.cpp:316
Mat3 R() const
Definition: SO3.cpp:259
std::string toString() const
Generates string representation of the SO3 object.
Definition: SO3.cpp:90
SO3 operator*(const SO3 &rhs) const
Definition: SO3.cpp:67
Mat3 adj() const
Definition: SO3.cpp:254
SO3 mul(const SO3 &rhs) const
Definition: SO3.cpp:73
SO3 & operator=(const SO3 &rhs)
Definition: SO3.cpp:57
Mat3 ln(double *o=nullptr) const
Definition: SO3.cpp:136
Definition: SO3.hpp:49
Mat31 ln_vee() const
Definition: SO3.cpp:243
Mat31 vee3(const Mat3 &w_hat)
Definition: SO3.cpp:97
Special Euclidean (group) in 3d Is the group representing rotations and translations, that is, rigid body transformations. SE3 = {T = [R t] | R SO3 , t Re^3 } [0 1] Associated to the groups of RBT, there is the Lie algebra se3 representing the same transformation in the tangent space around the identity. Particularly, xi =[w , v] Re^6, where w Re^3 represents the rotation and v the translation. We will preserve this order in this class.
Definition: matrix_base.hpp:36
void exp(const Mat3 &w_hat)
Definition: SO3.cpp:114
Mat3 & ref2R()
Definition: SO3.cpp:264
Mat3 hat3(const Mat31 &w)
Definition: SO3.cpp:104