12 template <
typename Derived>
14 const Eigen::MatrixBase<Derived>& rpy) {
15 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Eigen::MatrixBase<Derived>, 3);
16 auto rpy_2 = (rpy / 2.0).array();
21 q << c(0) * c(1) * c(2) + s(0) * s(1) * s(2),
22 s(0) * c(1) * c(2) - c(0) * s(1) * s(2),
23 c(0) * s(1) * c(2) + s(0) * c(1) * s(2),
24 c(0) * c(1) * s(2) - s(0) * s(1) * c(2);
26 q /= q.norm() + std::numeric_limits<typename Derived::Scalar>::epsilon();
30 template <
typename Derived>
32 const Eigen::MatrixBase<Derived>& rpy) {
36 template <
typename Derived>
38 const Eigen::MatrixBase<Derived>& rpy) {
39 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Eigen::MatrixBase<Derived>, 3);
40 auto rpy_array = rpy.array();
41 auto s = rpy_array.sin();
42 auto c = rpy_array.cos();
45 R.row(0) << c(2) * c(1), c(2) * s(1) * s(0) - s(2) * c(0),
46 c(2) * s(1) * c(0) + s(2) * s(0);
47 R.row(1) << s(2) * c(1), s(2) * s(1) * s(0) + c(2) * c(0),
48 s(2) * s(1) * c(0) - c(2) * s(0);
49 R.row(2) << -s(1), c(1) * s(0), c(1) * c(0);
54 template <
typename Derived>
56 const Eigen::MatrixBase<Derived>& rpy) {
57 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Eigen::MatrixBase<Derived>, 3);
58 auto rpy_array = rpy.array();
59 auto s = rpy_array.sin();
60 auto c = rpy_array.cos();
62 Eigen::Matrix<typename Derived::Scalar, 9, 3> dR;
63 dR.row(0) << 0, c(2) * -s(1), c(1) * -s(2);
64 dR.row(1) << 0, -s(1) * s(2), c(2) * c(1);
65 dR.row(2) << 0, -c(1), 0;
66 dR.row(3) << c(2) * s(1) * c(0) - s(2) * -s(0), c(2) * c(1) * s(0),
67 -s(2) * s(1) * s(0) - c(2) * c(0);
68 dR.row(4) << s(2) * s(1) * c(0) + c(2) * -s(0), s(2) * c(1) * s(0),
69 c(2) * s(1) * s(0) - s(2) * c(0);
70 dR.row(5) << c(1) * c(0), -s(1) * s(0), 0;
71 dR.row(6) << c(2) * s(1) * -s(0) + s(2) * c(0), c(2) * c(1) * c(0),
72 -s(2) * s(1) * c(0) + c(2) * s(0);
73 dR.row(7) << s(2) * s(1) * -s(0) - c(2) * c(0), s(2) * c(1) * c(0),
74 c(2) * s(1) * c(0) + s(2) * s(0);
75 dR.row(8) << c(1) * -s(0), -s(1) * c(0), 0;
This file contains abbreviated definitions for certain specializations of Eigen::Matrix that are comm...
Eigen::Matrix< Scalar, 4, 1 > Vector4
A column vector of size 4, templated on scalar type.
Definition: eigen_types.h:28
Definition: constants.h:3
Vector4< typename Derived::Scalar > rpy2axis(const Eigen::MatrixBase< Derived > &rpy)
Definition: roll_pitch_yaw.h:31
Vector4< typename Derived::Scalar > rpy2quat(const Eigen::MatrixBase< Derived > &rpy)
Definition: roll_pitch_yaw.h:13
Vector4< typename Derived::Scalar > quat2axis(const Eigen::MatrixBase< Derived > &q)
Definition: quaternion.h:136
Eigen::Matrix< Scalar, 3, 3 > Matrix3
A matrix of 3 rows and 3 columns, templated on scalar type.
Definition: eigen_types.h:40
Matrix3< typename Derived::Scalar > rpy2rotmat(const Eigen::MatrixBase< Derived > &rpy)
Definition: roll_pitch_yaw.h:37
Eigen::Matrix< typename Derived::Scalar, 9, 3 > drpy2rotmat(const Eigen::MatrixBase< Derived > &rpy)
Definition: roll_pitch_yaw.h:55