I face the following issue when using IncrementalFixedLagSmoother to add landmarks using BearingRangeFactor.
this happens as soon as we add a BearingRangeFactor and when there is a call to the update() function.
Here is a simple example similar to PlanarSLAMExample.cpp to reproduce the problem
* I tried to add another observation to the landmark (l1) and then call update in isam2 but the result is the same.
* Moreover adding a unary factor (i.e. map landmark) to l1 does not solve the issue.
* This is also tested with real data and as soon as we add a landmark with BearingRangeFactor, the same issue happens.
TEST(tGraphFactor, IndeterminantLinearSystemException)
{
// The incremental optimizer uses iSAM2 to perform the nonlinear optimization
ISAM2Params parameters;
parameters.relinearizeThreshold = 0.1;
parameters.relinearizeSkip = 1;
IncrementalFixedLagSmoother smootherISAM2(0.0, parameters);
Values initialEstimate;
NonlinearFactorGraph graph;
// Create the keys X for poses and L for landmarks
Symbol x1('x', 1);
Symbol x2('x', 2);
Symbol l1('l', 1);
// Add prior node
auto priorNoise = noiseModel::Diagonal::Sigmas(Vector3(0.3, 0.3, 0.1)); // // 30cm std on x,y, 0.1 rad on theta
graph.add(PriorFactor<Pose2>(x1, Pose2(0.0, 0.0, 0.0), priorNoise));
// Add odometry factors
auto odometryNoise = noiseModel::Diagonal::Sigmas(Vector3(0.2, 0.2, 0.1)); // 20cm std on x,y, 0.1 rad on theta
graph.emplace_shared<BetweenFactor<Pose2>>(x1, x2, Pose2(2.0, 0.0, 0.0), odometryNoise);
initialEstimate.insert(x1, Pose2(0.5, 0.0, 0.2));
initialEstimate.insert(x2, Pose2(2.3, 0.1, -0.2));
// Update Isam
smootherISAM2.update(graph, initialEstimate);
// clear the buffers
initialEstimate.clear();
graph.resize(0);
// Add Range-Bearing measurements
auto landmarkNoise = noiseModel::Diagonal::Sigmas(Vector2(0.1, 0.2)); // 0.1 rad std on bearing, 20cm on range
tF64 range21{2};
Rot2 bearing21{Rot2::fromDegrees(90)};
// Add landmark
graph.emplace_shared<BearingRangeFactor<Pose2, Pose2>>(x2, l1, bearing21, range21, landmarkNoise);
initialEstimate.insert(l1, Pose2(2.1, 2.2, 0));
// Update Isam, fixme: issue occurs here!
smootherISAM2.update(graph, initialEstimate);
Values results = smootherISAM2.calculateEstimate();
results.print();
}
I appreciate if you could help.