MROB
SE3.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  * SE3.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 SE3_HPP_
26 #define SE3_HPP_
27 
28 
29 #include "mrob/matrix_base.hpp"
30 #include "mrob/SO3.hpp"
31 
32 
33 
34 
47 namespace mrob{
48 
49 
50 class SE3
51 {
52 public:
56  SE3(const Mat4 &T = Mat4::Identity() );
61  SE3(const Mat61 &xi);
65  SE3(const SE3 &T);
69  SE3(const SO3 &R, const Mat31 &t);
73  SE3(const Mat3 &R, const Mat31 &t);
78  template<typename OtherDerived>
79  SE3(const Eigen::MatrixBase<OtherDerived>& rhs);
83  SE3& operator=(const SE3& rhs);
84 
88  SE3 operator*(const SE3& rhs) const;
92  SE3 mul(const SE3& rhs) const;
93 
99  void update_lhs(const Mat61 &dxi);
104  void update_rhs(const Mat61 &dxi);
114  void exp(const Mat4 &xi_hat);
120  Mat4 ln(void) const;
124  Mat61 ln_vee() const;
129  Mat31 transform(const Mat31 & p) const;
135  MatX transform_array(const MatX &P) const;
140  SE3 inv(void) const;
146  Mat6 adj() const;
151  //Mat4 T() const;
152  const Eigen::Ref<const Mat4> T() const;
156  Mat4& ref2T();
160  Mat3 R() const;
164  Mat31 t() const;
169  double distance(const SE3 &rhs=SE3()) const;
174  double distance_rotation(const SE3 &rhs=SE3()) const;
179  double distance_trans(const SE3 &rhs=SE3()) const;
184  void regenerate();
185 
186  Mat41 transform_plane(const Mat41 &pi);
187 
188 
189  void print(void) const;
190  void print_lie(void) const;
191 
197  std::string toString() const;
198 
199 protected:
200  Mat4 T_;
201 
202 public:
203  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
204 };
205 
206 
213 Mat4 hat6(const Mat61 &xi);
217 Mat61 vee6(const Mat4 &xi_hat);
218 
219 bool isSE3(const Mat4 &T);
220 
225 Mat4 SE3GenerativeMatrix(uint_t coordinate);
233 //Mat4 SE3DoubleGenerativeMatrix(uint_t i, uint_t j);
234 
242 extern const std::vector<Mat4> LieGenerative;
252 extern const std::vector< Mat4> LieDoubleGenerative;
253 
254 }// end namespace
255 #endif /* SE3_HPP_ */
void update_lhs(const Mat61 &dxi)
Definition: SE3.cpp:85
Mat4 & ref2T()
Definition: SE3.cpp:242
const Eigen::Ref< const Mat4 > T() const
Definition: SE3.cpp:237
Mat61 vee6(const Mat4 &xi_hat)
Definition: SE3.cpp:96
Definition: SE3.hpp:50
void regenerate()
Definition: SE3.cpp:284
Mat3 R() const
Definition: SE3.cpp:247
double distance_rotation(const SE3 &rhs=SE3()) const
Definition: SE3.cpp:262
const std::vector< Mat4 > LieDoubleGenerative
Mat6 adj() const
Definition: SE3.cpp:226
SE3 operator*(const SE3 &rhs) const
Definition: SE3.cpp:73
Mat4 ln(void) const
Definition: SE3.cpp:154
Mat31 t() const
Definition: SE3.cpp:252
void exp(const Mat4 &xi_hat)
Definition: SE3.cpp:114
Mat31 transform(const Mat31 &p) const
Definition: SE3.cpp:198
double distance(const SE3 &rhs=SE3()) const
Definition: SE3.cpp:257
SE3 inv(void) const
Definition: SE3.cpp:215
SE3 mul(const SE3 &rhs) const
Definition: SE3.cpp:80
Mat4 hat6(const Mat61 &xi)
Definition: SE3.cpp:104
Mat4 SE3GenerativeMatrix(uint_t coordinate)
Definition: SE3.cpp:313
MatX transform_array(const MatX &P) const
Definition: SE3.cpp:204
SE3 & operator=(const SE3 &rhs)
Definition: SE3.cpp:64
Definition: SO3.hpp:49
std::string toString() const
Generates string representation of the object.
Definition: SE3.cpp:343
const std::vector< Mat4 > LieGenerative
Definition: SE3.cpp:307
SE3(const Mat4 &T=Mat4::Identity())
Definition: SE3.cpp:32
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
double distance_trans(const SE3 &rhs=SE3()) const
Definition: SE3.cpp:268
void update_rhs(const Mat61 &dxi)
Definition: SE3.cpp:90
Mat61 ln_vee() const
Definition: SE3.cpp:192