16 #include <Eigen/Dense> 48 const double qr =
x.quat().r();
49 const double qx =
x.quat().x();
50 const double qx2 =
square(qx);
51 const double qy =
x.quat().y();
52 const double qy2 =
square(qy);
53 const double qz =
x.quat().z();
54 const double qz2 =
square(qz);
56 const double ax = u.
x();
57 const double ay = u.
y();
58 const double az = u.z();
59 const double q2r = u.
quat().
r();
60 const double q2x = u.
quat().
x();
61 const double q2y = u.
quat().
y();
62 const double q2z = u.
quat().
z();
69 x.quat().normalizationJacobian(norm_jacob_x);
79 alignas(MRPT_MAX_STATIC_ALIGN_BYTES)
80 const double vals2[3 * 4] = {2 * (-qz * ay + qy * az),
81 2 * (qy * ay + qz * az),
82 2 * (-2 * qy * ax + qx * ay + qr * az),
83 2 * (-2 * qz * ax - qr * ay + qx * az),
85 2 * (qz * ax - qx * az),
86 2 * (qy * ax - 2 * qx * ay - qr * az),
87 2 * (qx * ax + qz * az),
88 2 * (qr * ax - 2 * qz * ay + qy * az),
90 2 * (-qy * ax + qx * ay),
91 2 * (qz * ax + qr * ay - 2 * qx * az),
92 2 * (-qr * ax + qz * ay - 2 * qy * az),
93 2 * (qx * ax + qy * ay)};
96 df_dx.
block<3, 4>(0, 3).noalias() =
101 alignas(MRPT_MAX_STATIC_ALIGN_BYTES)
const double aux44_data[4 * 4] = {
102 q2r, -q2x, -q2y, -q2z, q2x, q2r, q2z, -q2y,
103 q2y, -q2z, q2r, q2x, q2z, q2y, -q2x, q2r};
105 df_dx.
block<4, 4>(3, 3).noalias() =
113 df_du(0, 0) = 1 - 2 * (qy2 + qz2);
114 df_du(0, 1) = 2 * (qx * qy - qr * qz);
115 df_du(0, 2) = 2 * (qr * qy + qx * qz);
117 df_du(1, 0) = 2 * (qr * qz + qx * qy);
118 df_du(1, 1) = 1 - 2 * (qx2 + qz2);
119 df_du(1, 2) = 2 * (qy * qz - qr * qx);
121 df_du(2, 0) = 2 * (qx * qz - qr * qy);
122 df_du(2, 1) = 2 * (qr * qx + qy * qz);
123 df_du(2, 2) = 1 - 2 * (qx2 + qy2);
127 alignas(MRPT_MAX_STATIC_ALIGN_BYTES)
const double aux44_data[4 * 4] = {
128 qr, -qx, -qy, -qz, qx, qr, -qz, qy,
129 qy, qz, qr, -qx, qz, -qy, qx, qr};
131 df_du.
block<4, 4>(3, 3).noalias() =
135 if (out_x_oplus_u) *out_x_oplus_u = x_plus_u;
#define IMPLEMENTS_VIRTUAL_SERIALIZABLE(class_name, base_class, NS)
This must be inserted as implementation of some required members for virtual CSerializable classes: ...
mrpt::math::CQuaternionDouble & quat()
Read/Write access to the quaternion representing the 3D rotation.
A compile-time fixed-size numeric matrix container.
T y() const
Return y coordinate of the quaternion.
GLdouble GLdouble GLdouble GLdouble q
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
T square(const T x)
Inline function for the square of a number.
This base provides a set of functions for maths stuff.
T r() const
Return r coordinate of the quaternion.
auto block(int start_row, int start_col)
non-const block(): Returns an Eigen::Block reference to the block
double x() const
Common members of all points & poses classes.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
T x() const
Return x coordinate of the quaternion.
void normalizationJacobian(MATRIXLIKE &J) const
Calculate the 4x4 Jacobian of the normalization operation of this quaternion.
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
static void jacobiansPoseComposition(const CPose3DQuat &x, const CPose3DQuat &u, mrpt::math::CMatrixDouble77 &df_dx, mrpt::math::CMatrixDouble77 &df_du, CPose3DQuat *out_x_oplus_u=nullptr)
This static method computes the two Jacobians of a pose composition operation $f(x,u)= x u$.
T z() const
Return z coordinate of the quaternion.