31 using namespace gtsam;
50 Pose3 init_pose = Pose3::Identity();
51 Pose3 anchor_pose = Pose3::Identity();
52 graph.
addPrior(
X(0), init_pose, noiseModel::Isotropic::Sigma(6, 0.001));
53 graph.
addPrior(
X(1), anchor_pose, noiseModel::Isotropic::Sigma(6, 0.001));
56 Vector4 measurement0(-1.0, 0.0, 0.0, 3.0);
59 measurement0, noiseModel::Isotropic::Sigma(3, 0.1),
X(0),
X(1),
P(0));
61 measurement1, noiseModel::Isotropic::Sigma(3, 0.1),
X(0),
X(1),
P(0));
68 values.
insert(
X(1), anchor_pose);
73 isam2.
update(graph, values);
142 Key planeKey(1),
poseKey(2), anchorPoseKey(3);
159 Matrix actualH1, actualH2, actualH3;
160 factor.
evaluateError(poseLin, anchorPoseLin, pLin, actualH1, actualH2,
189 auto x0_noise = noiseModel::Isotropic::Sigma(6, 0.01);
190 auto x1_noise = noiseModel::Isotropic::Sigma(6, 0.01);
195 const Plane
p1(0, 0, 1, 1),
p2(0, 0, 1, 2);
197 auto p1_in_x1 =
p1.transform(x1);
198 auto p2_in_x1 = p2.transform(x1);
199 auto p1_noise = noiseModel::Diagonal::Sigmas(
Vector3{1, 1, 5});
200 auto p2_noise = noiseModel::Diagonal::Sigmas(
Vector3{1, 1, 5});
201 graph.
addPrior<Plane>(
P(1), p1_in_x1, p1_noise);
202 graph.
addPrior<Plane>(
P(2), p2_in_x1, p2_noise);
206 auto p1_measured_from_x0 =
p1.transform(x0);
208 auto p2_measured_from_x0 = p2.transform(x0);
209 const auto x0_p1_noise = noiseModel::Isotropic::Sigma(3, 0.05);
210 const auto x0_p2_noise = noiseModel::Isotropic::Sigma(3, 0.05);
212 p1_measured_from_x0.planeCoefficients(), x0_p1_noise,
X(0),
X(1),
P(1));
214 p2_measured_from_x0.planeCoefficients(), x0_p2_noise,
X(0),
X(1),
P(2));
220 initialEstimate.insert(
P(1), p1_in_x1);
221 initialEstimate.insert(
P(2), p2_in_x1);
222 initialEstimate.insert(
X(0), x0_initial);
223 initialEstimate.insert(
X(1), x1);
228 isam2.
update(graph, initialEstimate);
232 EXPECT(p1_in_x1.equals(result.
at<Plane>(
P(1))));
233 EXPECT(p2_in_x1.equals(result.
at<Plane>(
P(2))));
235 cerr <<
"CAPTURED THE EXCEPTION: " 243 srand(
time(
nullptr));
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
static int runAllTests(TestResult &result)
const ValueType at(Key j) const
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Some functions to compute numerical derivatives.
virtual ISAM2Result update(const NonlinearFactorGraph &newFactors=NonlinearFactorGraph(), const Values &newTheta=Values(), const FactorIndices &removeFactorIndices=FactorIndices(), const std::optional< FastMap< Key, int > > &constrainedKeys={}, const std::optional< FastList< Key > > &noRelinKeys={}, const std::optional< FastList< Key > > &extraReelimKeys={}, bool force_relinearize=false)
bool equals(const Pose3 &pose, double tol=1e-9) const
assert equality up to a tolerance
NonlinearFactorGraph graph
static const KeyFormatter DefaultKeyFormatter
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
Represents an infinite plane in 3D, which is composed of a planar normal and its perpendicular distan...
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
Vector evaluateError(const Pose3 &wTwi, const Pose3 &wTwa, const OrientedPlane3 &a_plane, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3) const override
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
internal::FixedSizeMatrix< Y, X3 >::type numericalDerivative33(std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative32(std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Incremental update functionality (ISAM2) for BayesTree, with fluid relinearization.
#define EXPECT(condition)
static Point2 measurement1(323.0, 240.0)
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative31(std::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
double error(const Values &values) const
Class compose(const Class &g) const
typedef and functions to augment Eigen's VectorXd
TEST(LocalOrientedPlane3Factor, lm_translation_error)
#define GTSAM_CONCEPT_MANIFOLD_INST(T)
void insert(Key j, const Value &val)
Jet< T, N > sqrt(const Jet< T, N > &f)
Key nearbyVariable() const
std::uint64_t Key
Integer nonlinear key type.
Values calculateEstimate() const
noiseModel::Gaussian::shared_ptr SharedGaussian
#define GTSAM_CONCEPT_TESTABLE_INST(T)