TurtleQUAD 2.0
Loading...
Searching...
No Matches
matrixbase.hpp
Go to the documentation of this file.
1
6
11inline Matrix<Scalar, 3, 3> exp3() const {
12 assert(RowsAtCompileTime == 3 && ColsAtCompileTime == 3);
13 AngleAxis<Scalar> theta{&this};
14 if (abs(theta.angle()) < 1e-6) {
15 return Matrix<Scalar, 3, 3>::Identity();
16 } else {
17 Matrix<Scalar, 3, 3> omgmat{theta.axis().asSkewSymmetric()};
18 return Matrix<Scalar, 3, 3>::Identity() + std::sin(theta.angle()) * omgmat +
19 (1 - std::cos(theta.angle())) * omgmat * omgmat;
20 }
21}
22
27inline Transform<Scalar, 3, Isometry> exp6() const {
28 assert(RowsAtCompileTime == 4 && ColsAtCompileTime == 4);
29 // Extract the angular velocity vector from the transformation matrix
30 AngleAxis<Scalar> theta{this->template block<3, 3>(0, 0)};
31 Transform<Scalar, 3, Isometry> T;
32
33 // If negligible rotation
34 if (abs(theta.angle()) < 1e-6) {
35 T.linear() = Matrix<Scalar, 3, 3>::Identity();
36 T.translation() = this->template block<3, 1>(0, 3);
37 return T;
38 }
39
40 Matrix<Scalar, 3, 3> omgmat{theta.axis().asSkewSymmetric()};
41 T.linear() = Matrix<Scalar, 3, 3>::Identity() +
42 std::sin(theta.angle()) * omgmat +
43 (1 - std::cos(theta.angle())) * omgmat * omgmat;
44 T.translation() =
45 ((Matrix<Scalar, 3, 3>::Identity() * theta +
46 (1 - std::cos(theta.angle())) * omgmat +
47 (theta.angle() - std::sin(theta.angle())) * omgmat * omgmat) *
48 this->template block<3, 1>(0, 3)) /
49 theta.angle();
50 return T;
51}
52
57inline Matrix<Scalar, 6, 6> ad() const {
58 assert(RowsAtCompileTime == 6 && ColsAtCompileTime == 1);
59 return (Matrix<Scalar, 6, 6>()
60 << this->template segment<3>(0).asSkewSymmetric().toDenseMatrix(),
61 Matrix<Scalar, 3, 3>::Zero(),
62 this->template segment<3>(3).asSkewSymmetric().toDenseMatrix(),
63 this->template segment<3>(0).asSkewSymmetric().toDenseMatrix())
64 .finished();
65}
66
71inline Matrix<Scalar, 4, 4> tose3() const {
72 (
73 Matrix<Scalar, 4, 4>()
74 << this->template head<3>().asSkewSymmetric().toDenseMatrix(),
75 this->template tail<3>(), 0, 0, 0, 0)
76 .finished();
77}
Matrix< Scalar, 6, 6 > ad() const
6-vector adjoint
Definition matrixbase.hpp:57
Transform< Scalar, 3, Isometry > exp6() const
se(3) matrix exponent
Definition matrixbase.hpp:27
Matrix< Scalar, 3, 3 > exp3() const
so(3) matrix exponent
Definition matrixbase.hpp:11
Matrix< Scalar, 4, 4 > tose3() const
3-vector as se(3) matrix
Definition matrixbase.hpp:71