@@ -183,6 +183,7 @@ int main(int argc, char * argv[])
183
183
driver->getAllNodeIds (ids);
184
184
std::map<int , std::pair<std::map<std::string, float >, double > > stats = driver->getAllStatistics ();
185
185
std::map<int , Transform> odomPoses, gtPoses;
186
+ std::map<int , double > odomStamps;
186
187
std::vector<float > cameraTime;
187
188
cameraTime.reserve (ids.size ());
188
189
std::vector<float > odomTime;
@@ -212,6 +213,7 @@ int main(int argc, char * argv[])
212
213
if (driver->getNodeInfo (*iter, p, m, w, l, s, gt, v, gps, sensors))
213
214
{
214
215
odomPoses.insert (std::make_pair (*iter, p));
216
+ odomStamps.insert (std::make_pair (*iter, s));
215
217
if (!gt.isNull ())
216
218
{
217
219
gtPoses.insert (std::make_pair (*iter, gt));
@@ -493,49 +495,55 @@ int main(int argc, char * argv[])
493
495
std::string dir = UDirectory::getDir (filePath);
494
496
std::string dbName = UFile::getName (filePath);
495
497
dbName = dbName.substr (0 , dbName.size ()-3 ); // remove db
496
- std::string path = dir+UDirectory::separator ()+dbName+" _poses.txt" ;
497
- if (!graph::exportPoses (path, outputKittiError?2 :0 , poses))
498
+ std::string path = dir+UDirectory::separator ()+dbName+" _slam.txt" ;
499
+ std::multimap<int , Link> dummyLinks;
500
+ std::map<int , double > stamps;
501
+ if (!outputKittiError)
502
+ {
503
+ for (std::map<int , Transform>::iterator iter=poses.begin (); iter!=poses.end (); ++iter)
504
+ {
505
+ UASSERT (odomStamps.find (iter->first ) != odomStamps.end ());
506
+ stamps.insert (*odomStamps.find (iter->first ));
507
+ }
508
+ }
509
+ if (!graph::exportPoses (path, outputKittiError?2 :10 , poses, dummyLinks, stamps))
498
510
{
499
511
printf (" Could not export the poses to \" %s\" !?!\n " , path.c_str ());
500
512
}
513
+
514
+ // export odom
515
+ path = dir+UDirectory::separator ()+dbName+" _odom.txt" ;
516
+ stamps.clear ();
517
+ if (!outputKittiError)
518
+ {
519
+ for (std::map<int , Transform>::iterator iter=odomPoses.begin (); iter!=odomPoses.end (); ++iter)
520
+ {
521
+ UASSERT (odomStamps.find (iter->first ) != odomStamps.end ());
522
+ stamps.insert (*odomStamps.find (iter->first ));
523
+ }
524
+ }
525
+ if (!graph::exportPoses (path, outputKittiError?2 :10 , odomPoses, dummyLinks, stamps))
526
+ {
527
+ printf (" Could not export the ground truth to \" %s\" !?!\n " , path.c_str ());
528
+ }
529
+
530
+ // export ground truth
501
531
if (groundTruth.size ())
502
532
{
503
- // For missing ground truth poses, set them to null
504
- std::vector<int > validIndices (poses.size (), 1 );
505
- int i=0 ;
506
- for (std::map<int , Transform>::iterator iter=poses.begin (); iter!=poses.end (); ++iter, ++i)
533
+ path = dir+UDirectory::separator ()+dbName+" _gt.txt" ;
534
+ stamps.clear ();
535
+ if (!outputKittiError)
507
536
{
508
- if ( groundTruth.find (iter-> first ) == groundTruth.end ())
537
+ for (std::map< int , Transform>::iterator iter= groundTruth.begin (); iter!= groundTruth.end (); ++iter )
509
538
{
510
- groundTruth. insert ( std::make_pair ( iter->first , Transform () ));
511
- validIndices[i] = 0 ;
539
+ UASSERT (odomStamps. find ( iter->first ) != odomStamps. end ( ));
540
+ stamps. insert (*odomStamps. find (iter-> first )) ;
512
541
}
513
542
}
514
- path = dir+UDirectory::separator ()+dbName+" _gt.txt" ;
515
- if (!graph::exportPoses (path, outputKittiError?2 :0 , groundTruth))
543
+ if (!graph::exportPoses (path, outputKittiError?2 :10 , groundTruth, dummyLinks, stamps))
516
544
{
517
545
printf (" Could not export the ground truth to \" %s\" !?!\n " , path.c_str ());
518
546
}
519
- else
520
- {
521
- // save valid indices
522
- path = dir+UDirectory::separator ()+dbName+" _indices.txt" ;
523
- FILE * file = 0 ;
524
- #ifdef _MSC_VER
525
- fopen_s (&file, path.c_str (), " w" );
526
- #else
527
- file = fopen (path.c_str (), " w" );
528
- #endif
529
- if (file)
530
- {
531
- // VERTEX3 id x y z phi theta psi
532
- for (unsigned int k=0 ; k<validIndices.size (); ++k)
533
- {
534
- fprintf (file, " %d\n " , validIndices[k]);
535
- }
536
- fclose (file);
537
- }
538
- }
539
547
}
540
548
}
541
549
}
0 commit comments