Go to the documentation of this file.
36 static constexpr
double one_6th = 1.0 / 6.0;
62 H << I_3x3 *
R(0, 0), I_3x3 *
R(1, 0), I_3x3 *
R(2, 0),
63 I_3x3 *
R(0, 1), I_3x3 *
R(1, 1), I_3x3 *
R(2, 1),
64 I_3x3 *
R(0, 2), I_3x3 *
R(1, 2), I_3x3 *
R(2, 2);
70 Matrix3 MR =
M *
R.matrix();
83 const double one_minus_cos =
100 init(nearZeroThresholdSq);
104 : theta2(angle * angle),
123 const bool nearPi = (delta2 < nearPiThresholdSq);
149 return I_3x3 + 0.5 *
W +
D *
WW;
154 return I_3x3 - 0.5 *
W +
D *
WW;
169 Matrix3 CWWv_H_w = -WWv *
F *
omega.transpose() +
C * WWv_H_w;
170 *H1 = -BWv_H_w + CWWv_H_w;
174 return v -
B * Wv +
C * WWv;
201 Matrix3 CWWv_H_w = -WWv *
F *
omega.transpose() +
C * WWv_H_w;
202 *H1 = BWv_H_w + CWWv_H_w;
206 return v +
B * Wv +
C * WWv;
234 SO3 SO3::ClosestTo(
const Matrix3&
M) {
236 const auto&
U =
svd.matrixU();
237 const auto&
V =
svd.matrixV();
239 return SO3(
U *
Vector3(1, 1, det).asDiagonal() *
V.transpose());
245 SO3 SO3::ChordalMean(
const std::vector<SO3>& rotations) {
250 for (
const auto& R_i : rotations) {
253 return ClosestTo(C_e);
266 Vector3 SO3::Vee(
const Matrix3&
X) {
277 Matrix3 SO3::AdjointMap()
const {
286 if (
H) *
H =
local.rightJacobian();
293 return so3::DexpFunctor(
omega).rightJacobian();
300 return so3::DexpFunctor(
omega).rightJacobianInverse();
310 const Matrix3&
R =
Q.matrix();
311 const double &R11 =
R(0, 0),
R12 =
R(0, 1), R13 =
R(0, 2);
312 const double &R21 =
R(1, 0), R22 =
R(1, 1), R23 =
R(1, 2);
313 const double &R31 =
R(2, 0), R32 =
R(2, 1), R33 =
R(2, 2);
315 const double tr =
R.trace();
320 if (tr + 1.0 < 1
e-3) {
321 if (R33 > R22 && R33 > R11) {
323 const double W = R21 -
R12;
324 const double Q1 = 2.0 + 2.0 * R33;
325 const double Q2 = R31 + R13;
326 const double Q3 = R23 + R32;
327 const double r =
sqrt(
Q1);
328 const double one_over_r = 1 / r;
330 const double sgn_w =
W < 0 ? -1.0 : 1.0;
331 const double mag =
M_PI - (2 * sgn_w *
W) / norm;
332 const double scale = 0.5 * one_over_r * mag;
334 }
else if (R22 > R11) {
336 const double W = R13 - R31;
337 const double Q1 = 2.0 + 2.0 * R22;
338 const double Q2 = R23 + R32;
339 const double Q3 =
R12 + R21;
340 const double r =
sqrt(
Q1);
341 const double one_over_r = 1 / r;
343 const double sgn_w =
W < 0 ? -1.0 : 1.0;
344 const double mag =
M_PI - (2 * sgn_w *
W) / norm;
345 const double scale = 0.5 * one_over_r * mag;
349 const double W = R32 - R23;
350 const double Q1 = 2.0 + 2.0 * R11;
351 const double Q2 =
R12 + R21;
352 const double Q3 = R31 + R13;
353 const double r =
sqrt(
Q1);
354 const double one_over_r = 1 / r;
356 const double sgn_w =
W < 0 ? -1.0 : 1.0;
357 const double mag =
M_PI - (2 * sgn_w *
W) / norm;
358 const double scale = 0.5 * one_over_r * mag;
363 const double tr_3 = tr - 3.0;
366 double theta =
acos((tr - 1.0) / 2.0);
367 magnitude = theta / (2.0 *
sin(theta));
377 if (
H) *
H = LogmapDerivative(
omega);
392 Vector3 SO3::ChartAtOrigin::Local(
const SO3&
R, ChartJacobian
H) {
398 static Vector9
vec3(
const Matrix3&
R) {
403 static std::vector<Matrix3>
G3({SO3::Hat(Vector3::Unit(0)),
404 SO3::Hat(Vector3::Unit(1)),
405 SO3::Hat(Vector3::Unit(2))});
415 const Matrix3&
R = matrix_;
418 *
H <<
R *
P3.block<3, 3>(0, 0),
R *
P3.block<3, 3>(3, 0),
419 R *
P3.block<3, 3>(6, 0);
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
static SO AxisAngle(const Vector3 &axis, double theta)
Constructor from axis and angle. Only defined for SO3.
Vector3 applyLeftJacobian(const Vector3 &v, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
Multiplies with leftJacobian(), with optional derivatives.
static constexpr double one_180th
typedef and functions to augment Eigen's VectorXd
void init(double nearZeroThresholdSq)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Jet< T, N > sin(const Jet< T, N > &f)
static constexpr double k2_Pi3
typedef and functions to augment Eigen's MatrixXd
State class representing the state of the Biased Attitude System.
Matrix3 rightJacobianInverse() const
static constexpr double one_120th
Matrix3 expmap() const
Rodrigues formula.
static Vector9 vec3(const Matrix3 &R)
static constexpr double one_24th
static constexpr double one_60th
Matrix3 skewSymmetric(double wx, double wy, double wz)
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf > svd(m, ComputeThinU|ComputeThinV)
Jet< T, N > acos(const Jet< T, N > &f)
void determinant(const MatrixType &m)
np.ndarray local(Y a, Y b)
DexpFunctor(const Vector3 &omega)
Constructor with element of Lie algebra so(3)
3*3 matrix representation of SO(3)
static constexpr double one_720th
Pose2_ Expmap(const Vector3_ &xi)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics scale
Point3 cross(const Point3 &p, const Point3 &q, OptionalJacobian< 3, 3 > H1, OptionalJacobian< 3, 3 > H2)
cross product
static constexpr double kPi2
const MatrixNN & matrix() const
Return matrix.
static constexpr double k1_4Pi
double dot(const V1 &a, const V2 &b)
ExpmapFunctor(const Vector3 &omega)
Constructor with element of Lie algebra so(3)
static std::vector< Matrix3 > G3({SO3::Hat(Vector3::Unit(0)), SO3::Hat(Vector3::Unit(1)), SO3::Hat(Vector3::Unit(2))})
static constexpr double one_6th
A matrix or vector expression mapping an existing array of data.
static constexpr double k1_Pi3
Vector3 applyLeftJacobianInverse(const Vector3 &v, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
Multiplies with leftJacobianInverse(), with optional derivatives.
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Vector3 applyRightJacobian(const Vector3 &v, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
Multiplies with rightJacobian(), with optional derivatives.
The quaternion class used to represent 3D orientations and rotations.
Matrix3 leftJacobian() const
Vector3 applyRightJacobianInverse(const Vector3 &v, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
Multiplies with rightJacobian().inverse(), with optional derivatives.
GTSAM_EXPORT Matrix99 Dcompose(const SO3 &Q)
(constant) Jacobian of compose wrpt M
Matrix3 rightJacobian() const
static constexpr double kPi_inv
static constexpr double kNearPiThresholdSq
static constexpr double k1_Pi2
Array< int, Dynamic, 1 > v
abc_eqf_lib::State< N > M
Matrix3 leftJacobianInverse() const
For |omega|>pi uses leftJacobian().inverse(), as unstable beyond pi!
Jet< T, N > sqrt(const Jet< T, N > &f)
static constexpr double one_12th
static constexpr double one_1260th
Eigen::Matrix< double, 9, 3 > Matrix93
Rot2 R(Rot2::fromAngle(0.1))
static constexpr double kNearZeroThresholdSq
GTSAM_EXPORT Matrix3 compose(const Matrix3 &M, const SO3 &R, OptionalJacobian< 9, 9 > H)
Point3 doubleCross(const Point3 &p, const Point3 &q, OptionalJacobian< 3, 3 > H1, OptionalJacobian< 3, 3 > H2)
double cross product
static constexpr double kPi3
gtsam
Author(s):
autogenerated on Wed May 28 2025 03:03:22