19 using namespace gtsam;
31 static const Unit3 p1(1, 0, 0),
p2(0, 1, 0),
p3(0, 0, 1);
57 Model
model = noiseModel::Isotropic::Sigma(3, 0.01);
62 #if defined(GTSAM_ROT3_EXPMAP) || defined(GTSAM_USE_QUATERNIONS) 72 expected = numericalDerivative11<Vector3, Rot3>(
78 expected = numericalDerivative11<Vector3, Rot3>(
89 Model
model = noiseModel::Isotropic::Sigma(3, 0.01);
102 initial.insert(1, initialE);
104 #if defined(GTSAM_ROT3_EXPMAP) || defined(GTSAM_USE_QUATERNIONS) 126 Model
model = noiseModel::Isotropic::Sigma(2, 0.01);
132 #if defined(GTSAM_ROT3_EXPMAP) || defined(GTSAM_USE_QUATERNIONS) 143 expected = numericalDerivative11<Vector,Rot3>(
149 expected = numericalDerivative11<Vector,Rot3>(
160 Model
model = noiseModel::Isotropic::Sigma(2, 0.01);
173 initial.insert(1, initialE);
175 #if defined(GTSAM_ROT3_EXPMAP) || defined(GTSAM_USE_QUATERNIONS) 198 const Unit3 n_p(-n_gravity);
201 std::vector<double> angles = {0, 45, 85, 135, 180, 225, 275, 315};
202 for (
double yaw : angles) {
204 for (
double pitch : angles) {
205 const Rot3 yRp = Rot3::Pitch(pitch * kDegree);
206 for (
double roll : angles) {
207 const Rot3 pRb = Rot3::Roll(roll * kDegree);
210 const Rot3 nRb = nRy * yRp * pRb;
215 const Unit3 b_z(b_acc);
218 const Rot3 actual_nRb = RotateDirectionsFactor::Initialize(n_p, b_z);
static const Unit3 p2(0, 1, 0)
static const double kDegree
static const Eigen::MatrixBase< Vector3 >::ConstantReturnType Z_3x1
virtual const Values & optimize()
Concept check for values that can be used in unit tests.
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
static int runAllTests(TestResult &result)
TEST(RotateFactor, checkMath)
Factor Graph consisting of non-linear factors.
static const Unit3 p3(0, 0, 1)
noiseModel::Diagonal::shared_ptr model
const ValueType at(Key j) const
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static const Rot3 iRc(cameraX, cameraY, cameraZ)
Rot2 R(Rot2::fromAngle(0.1))
static const Point3 cameraZ(1, 0, 0)
noiseModel::Isotropic::shared_ptr Model
Some functions to compute numerical derivatives.
NonlinearFactorGraph graph
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
static const Point3 cameraY(0, 0, 1)
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
Rot3 inverse() const
inverse of a rotation
Represents a 3D point on a unit sphere.
Point3 unrotate(const Point3 &p, OptionalJacobian< 3, 3 > H1={}, OptionalJacobian< 3, 3 > H2={}) const
rotate point from world to rotated frame
#define EXPECT(condition)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Vector3 rpy(OptionalJacobian< 3, 3 > H={}) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double error(const Values &values) const
std::shared_ptr< Isotropic > shared_ptr
static ConjugateGradientParameters parameters
static const Unit3 p1(1, 0, 0)
static const Point3 cameraX(0, 1, 0)
Vector evaluateError(const Rot3 &R, OptionalMatrixType H) const override
vector of errors returns 2D vector
Class retract(const TangentVector &v) const
retract as required by manifold concept: applies v at *this
void insert(Key j, const Value &val)
Vector evaluateError(const Rot3 &iRc, OptionalMatrixType H) const override
vector of errors returns 2D vector
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1