update examples to use C++11

release/4.3a0
Varun Agrawal 2023-01-28 16:27:07 -05:00
parent ee63a5bf6f
commit f2f1bbaf8c
2 changed files with 16 additions and 4 deletions

View File

@ -234,8 +234,11 @@ int main(int argc, char** argv) {
} }
} }
countK = 0; countK = 0;
for (const auto& [key, point] : result.extract<Point2>()) for (const auto& key_point : result.extract<Point2>()) {
auto key = key_point.first;
const Point2 point = key_point.second;
os2 << key << "\t" << point.x() << "\t" << point.y() << "\t1" << endl; os2 << key << "\t" << point.x() << "\t" << point.y() << "\t1" << endl;
}
if (smart) { if (smart) {
for(size_t jj: ids) { for(size_t jj: ids) {
Point2 landmark = smartFactors[jj]->triangulate(result); Point2 landmark = smartFactors[jj]->triangulate(result);
@ -256,8 +259,11 @@ int main(int argc, char** argv) {
// Write result to file // Write result to file
Values result = isam.calculateEstimate(); Values result = isam.calculateEstimate();
ofstream os("rangeResult.txt"); ofstream os("rangeResult.txt");
for (const auto& [key, pose] : result.extract<Pose2>()) for (const auto& key_pose : result.extract<Pose2>()) {
auto key = key_pose.first;
const Pose2 pose = key_pose.second;
os << key << "\t" << pose.x() << "\t" << pose.y() << "\t" << pose.theta() << endl; os << key << "\t" << pose.x() << "\t" << pose.y() << "\t" << pose.theta() << endl;
}
exit(0); exit(0);
} }

View File

@ -202,11 +202,17 @@ int main(int argc, char** argv) {
// Write result to file // Write result to file
Values result = isam.calculateEstimate(); Values result = isam.calculateEstimate();
ofstream os2("rangeResultLM.txt"); ofstream os2("rangeResultLM.txt");
for (const auto& [key, point] : result.extract<Point2>()) for (const auto& key_point : result.extract<Point2>()) {
auto key = key_point.first;
const Point2 point = key_point.second;
os2 << key << "\t" << point.x() << "\t" << point.y() << "\t1" << endl; os2 << key << "\t" << point.x() << "\t" << point.y() << "\t1" << endl;
}
ofstream os("rangeResult.txt"); ofstream os("rangeResult.txt");
for (const auto& [key, pose] : result.extract<Pose2>()) for (const auto& key_pose : result.extract<Pose2>()) {
auto key = key_pose.first;
const Pose2 pose = key_pose.second;
os << key << "\t" << pose.x() << "\t" << pose.y() << "\t" << pose.theta() << endl; os << key << "\t" << pose.x() << "\t" << pose.y() << "\t" << pose.theta() << endl;
}
exit(0); exit(0);
} }