@@ -69,8 +69,8 @@ namespace br = boost::range;
69
69
70
70
typedef Pose2 Pose;
71
71
72
- typedef NoiseModelFactor1 <Pose> NM1;
73
- typedef NoiseModelFactor2 <Pose,Pose> NM2;
72
+ typedef NoiseModelFactorN <Pose> NM1;
73
+ typedef NoiseModelFactorN <Pose,Pose> NM2;
74
74
typedef BearingRangeFactor<Pose,Point2> BR;
75
75
76
76
double chi2_red (const gtsam::NonlinearFactorGraph& graph, const gtsam::Values& config) {
@@ -261,7 +261,7 @@ void runIncremental()
261
261
if (BetweenFactor<Pose>::shared_ptr factor =
262
262
boost::dynamic_pointer_cast<BetweenFactor<Pose> >(datasetMeasurements[nextMeasurement]))
263
263
{
264
- Key key1 = factor->key1 (), key2 = factor->key2 ();
264
+ Key key1 = factor->key < 1 > (), key2 = factor->key < 2 > ();
265
265
if (((int )key1 >= firstStep && key1 < key2) || ((int )key2 >= firstStep && key2 < key1)) {
266
266
// We found an odometry starting at firstStep
267
267
firstPose = std::min (key1, key2);
@@ -313,34 +313,34 @@ void runIncremental()
313
313
boost::dynamic_pointer_cast<BetweenFactor<Pose> >(measurementf))
314
314
{
315
315
// Stop collecting measurements that are for future steps
316
- if (factor->key1 () > step || factor->key2 () > step)
316
+ if (factor->key < 1 > () > step || factor->key < 2 > () > step)
317
317
break ;
318
318
319
319
// Require that one of the nodes is the current one
320
- if (factor->key1 () != step && factor->key2 () != step)
320
+ if (factor->key < 1 > () != step && factor->key < 2 > () != step)
321
321
throw runtime_error (" Problem in data file, out-of-sequence measurements" );
322
322
323
323
// Add a new factor
324
324
newFactors.push_back (factor);
325
325
const auto & measured = factor->measured ();
326
326
327
327
// Initialize the new variable
328
- if (factor->key1 () > factor->key2 ()) {
329
- if (!newVariables.exists (factor->key1 ())) { // Only need to check newVariables since loop closures come after odometry
328
+ if (factor->key < 1 > () > factor->key < 2 > ()) {
329
+ if (!newVariables.exists (factor->key < 1 > ())) { // Only need to check newVariables since loop closures come after odometry
330
330
if (step == 1 )
331
- newVariables.insert (factor->key1 (), measured.inverse ());
331
+ newVariables.insert (factor->key < 1 > (), measured.inverse ());
332
332
else {
333
- Pose prevPose = isam2.calculateEstimate <Pose>(factor->key2 ());
334
- newVariables.insert (factor->key1 (), prevPose * measured.inverse ());
333
+ Pose prevPose = isam2.calculateEstimate <Pose>(factor->key < 2 > ());
334
+ newVariables.insert (factor->key < 1 > (), prevPose * measured.inverse ());
335
335
}
336
336
}
337
337
} else {
338
- if (!newVariables.exists (factor->key2 ())) { // Only need to check newVariables since loop closures come after odometry
338
+ if (!newVariables.exists (factor->key < 2 > ())) { // Only need to check newVariables since loop closures come after odometry
339
339
if (step == 1 )
340
- newVariables.insert (factor->key2 (), measured);
340
+ newVariables.insert (factor->key < 2 > (), measured);
341
341
else {
342
- Pose prevPose = isam2.calculateEstimate <Pose>(factor->key1 ());
343
- newVariables.insert (factor->key2 (), prevPose * measured);
342
+ Pose prevPose = isam2.calculateEstimate <Pose>(factor->key < 1 > ());
343
+ newVariables.insert (factor->key < 2 > (), prevPose * measured);
344
344
}
345
345
}
346
346
}
0 commit comments