Modified Fixed-Lag Smoothing example to call iSAM2 multiple times to recover the same solution as batch

release/4.3a0
Stephen Williams 2013-04-11 21:10:32 +00:00
parent 321de2f701
commit 5087e4eabc
1 changed files with 5 additions and 0 deletions

View File

@ -111,6 +111,11 @@ int main(int argc, char** argv) {
// Update the smoothers with the new factors // Update the smoothers with the new factors
smootherBatch.update(newFactors, newValues, newTimestamps); smootherBatch.update(newFactors, newValues, newTimestamps);
smootherISAM2.update(newFactors, newValues, newTimestamps); smootherISAM2.update(newFactors, newValues, newTimestamps);
// The iSAM2 algorithm only performs one optimization iteration per call to update.
// To get equivalent results to the full batch optimization each time, we need to call update multiple times
for(size_t i = 0; i < 10; ++i) {
smootherISAM2.update();
}
// Print the optimized current pose // Print the optimized current pose
cout << setprecision(5) << "Timestamp = " << time << endl; cout << setprecision(5) << "Timestamp = " << time << endl;