31 using namespace gtsam;
36 constexpr
double rangeMmeasurement(10.0);
46 TEST(SerializationSam, BearingFactor2D) {
48 double measurement2D(10.0);
51 EXPECT(serializationTestHelpers::equalsObj(factor2D));
52 EXPECT(serializationTestHelpers::equalsXML(factor2D));
53 EXPECT(serializationTestHelpers::equalsBinary(factor2D));
57 TEST(SerializationSam, BearingFactor3D) {
63 EXPECT(serializationTestHelpers::equalsObj(factor3D));
64 EXPECT(serializationTestHelpers::equalsXML(factor3D));
65 EXPECT(serializationTestHelpers::equalsBinary(factor3D));
76 EXPECT(serializationTestHelpers::equalsObj(factor2D));
77 EXPECT(serializationTestHelpers::equalsXML(factor2D));
78 EXPECT(serializationTestHelpers::equalsBinary(factor2D));
85 EXPECT(serializationTestHelpers::equalsObj(factor3D));
86 EXPECT(serializationTestHelpers::equalsXML(factor3D));
87 EXPECT(serializationTestHelpers::equalsBinary(factor3D));
93 Pose3 body_P_sensor_3D(Rot3::RzRyRx(-M_PI_2, 0.0, -M_PI_2),
96 poseKey,
pointKey, rangeMmeasurement, rangeNoiseModel, body_P_sensor_3D),
100 gtsam::serializationTestHelpers::roundtripXML(factor3D_1, factor3D_2);
103 const Pose3 pose(Rot3::RzRyRx(0.2, -0.3, 1.75),
Point3(1.0, 2.0, -3.0));
108 const Vector error_1 = factor3D_1.unwhitenedError(values);
119 EXPECT(serializationTestHelpers::equalsObj(factor2D));
120 EXPECT(serializationTestHelpers::equalsXML(factor2D));
121 EXPECT(serializationTestHelpers::equalsBinary(factor2D));
130 EXPECT(serializationTestHelpers::equalsObj(factor3D));
131 EXPECT(serializationTestHelpers::equalsXML(factor3D));
132 EXPECT(serializationTestHelpers::equalsBinary(factor3D));
static int runAllTests(TestResult &result)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Evaluate derivatives of a nonlinear factor numerically.
const gtsam::Key pointKey
TEST(SerializationSam, BearingFactor2D)
Represents a 3D point on a unit sphere.
Test harness methods for expressions.
#define EXPECT(condition)
Unit3 bearing(const Point3 &point, OptionalJacobian< 2, 6 > Hself={}, OptionalJacobian< 2, 3 > Hpoint={}) const
Vector unwhitenedError(const Values &x, OptionalMatrixVecType H=nullptr) const override
GenericValue< T > genericValue(const T &v)
static const Pose3 pose(Rot3(Vector3(1, -1, -1).asDiagonal()), Point3(0, 0, 0.5))
BOOST_CLASS_EXPORT(gtsam::noiseModel::Isotropic)
std::uint64_t Key
Integer nonlinear key type.
noiseModel::Base::shared_ptr SharedNoiseModel