GUI:Export Poses: fixed poses!=stamps issue when there are landmarks (landmarks now only exported with g2o format)

This commit is contained in:
matlabbe
2022-01-15 21:49:40 -05:00
parent 03a106ea36
commit aa0e6ef692
2 changed files with 21 additions and 1 deletions

View File

@@ -2702,6 +2702,16 @@ void DatabaseViewer::exportPoses(int format)
}
}
if(format != 4 && !poses.empty() && poses.begin()->first<0) // not g2o, landmark not supported
{
UWARN("Only g2o format (4) can export landmarks, they are ignored with format %d", format);
std::map<int, Transform>::iterator iter=poses.begin();
while(iter!=poses.end() && iter->first < 0)
{
poses.erase(iter++);
}
}
std::map<int, double> stamps;
if(format == 1 || format == 10 || format == 11)
{
@@ -2729,7 +2739,7 @@ void DatabaseViewer::exportPoses(int format)
}
QString output = pathDatabase_ + QDir::separator() + (format==3?"toro%1.graph":format==4?"poses%1.g2o":"poses%1.txt");
QString suffix = odometry?"_odom":"";
QString suffix = odometry?"_odom":groundTruth?"_gt":"";
output = output.arg(suffix);
QString path = QFileDialog::getSaveFileName(

View File

@@ -6008,6 +6008,16 @@ void MainWindow::exportPoses(int format)
}
}
if(format != 4 && !poses.empty() && poses.begin()->first<0) // not g2o, landmark not supported
{
UWARN("Only g2o format (4) can export landmarks, they are ignored with format %d", format);
std::map<int, Transform>::iterator iter=poses.begin();
while(iter!=poses.end() && iter->first < 0)
{
poses.erase(iter++);
}
}
std::map<int, double> stamps;
if(format == 1 || format == 10 || format == 11)
{