27 using namespace gtsam;
29 #ifdef GTSAM_USE_QUATERNIONS 32 TEST(Rot3Q , Compare) {
37 typedef TQ::ChartJacobian OJ;
49 Q q3 = TQ::Compose(q1, q2, {}, {});
50 R
R3 = TR::Compose(
R1,
R2, {}, {});
55 Q q4 = TQ::Retract(q3,
v);
56 R R4 = TR::Retract(R3,
v);
61 R R5 = R3.between(R4);
73 vQ = TQ::Local(q3, q4);
74 vR = TR::Local(R3, R4);
78 Vector3 vQ1 = TQ::Local(q3, TQ::Compose(q1, TQ::Retract(q2,
v)));
79 Vector3 vR1 = TR::Local(R3, TR::Compose(
R1, TR::Retract(
R2,
v)));
81 Vector3 vQ2 = TQ::Local(q3, TQ::Compose(q1, TQ::Retract(q2, -
v)));
82 Vector3 vR2 = TR::Local(R3, TR::Compose(
R1, TR::Retract(
R2, -
v)));
84 EXPECT(assert_equal<Vector3>((vQ1 - vQ2) / 0.2, (vR1 - vR2) / 0.2));
88 HQ = numericalDerivative42<Q, Q, Q, OJ, OJ>(TQ::Compose, q1, q2, {}, {});
89 HR = numericalDerivative42<R, R, R, OJ, OJ>(TR::Compose,
R1,
R2, {}, {});
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Rot2 R(Rot2::fromAngle(0.1))
Some functions to compute numerical derivatives.
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
#define EXPECT(condition)
Array< int, Dynamic, 1 > v
BetweenFactor< Rot3 > Between
Array< double, 1, 3 > e(1./3., 0.5, 2.)
The quaternion class used to represent 3D orientations and rotations.
#define TEST(testGroup, testName)
Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.
3D rotation represented as a rotation matrix or quaternion