mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-09 21:10:19 +08:00
add option to create a report.csv file in /tools/Report (#512)
Co-authored-by: John <john.bobzwik@gmail.com>
This commit is contained in:
+40
-1
@@ -36,6 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <QApplication>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace rtabmap;
|
||||
|
||||
@@ -50,7 +52,8 @@ void showUsage()
|
||||
" --scale Find the best scale for the map against the ground truth\n"
|
||||
" and compute error based on the scaled path.\n"
|
||||
" --poses Export poses to [path]_poses.txt, ground truth to [path]_gt.txt\n"
|
||||
" and valid ground truth indices to [path]_indices.txt \n\n");
|
||||
" and valid ground truth indices to [path]_indices.txt \n"
|
||||
" --report Export all statistics values in report.txt \n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -71,6 +74,7 @@ int main(int argc, char * argv[])
|
||||
bool outputPoses = false;
|
||||
bool outputKittiError = false;
|
||||
bool outputRelativeError = false;
|
||||
bool outputReport = false;
|
||||
std::map<std::string, UPlot*> figures;
|
||||
for(int i=1; i<argc-1; ++i)
|
||||
{
|
||||
@@ -94,6 +98,10 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
outputPoses = true;
|
||||
}
|
||||
else if(strcmp(argv[i],"--report") == 0)
|
||||
{
|
||||
outputReport = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string figureTitle = argv[i];
|
||||
@@ -550,6 +558,37 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (outputReport)
|
||||
{
|
||||
bool fillHeader = false;
|
||||
std::ifstream f("report.csv");
|
||||
if(!f.good())
|
||||
{
|
||||
fillHeader = true;
|
||||
}
|
||||
|
||||
std::ofstream myfile;
|
||||
myfile.open("report.csv", std::fstream::in | std::fstream::out | std::fstream::app);
|
||||
if(fillHeader)
|
||||
{
|
||||
myfile << "Rosbag name"<<";"<<"error linear (m)"<<";"<<"error linear max (m)"<<";"<<"error linear odom (m)"<<";"
|
||||
<<"error angular"<<";"
|
||||
<<"Slam avg (hz)"<<";"<<"Slam max (hz)"<<";"
|
||||
<<"Odom avg (hz)"<<";"<<"Odom max (hz)"<<std::endl;
|
||||
}
|
||||
|
||||
myfile <<fileName.c_str()<<";"
|
||||
<<bestRMSE<< ";"
|
||||
<<maxRMSE<<";"
|
||||
<<bestVoRMSE<<";"
|
||||
<<bestRMSEAng<<";"
|
||||
<<(1/(uMean(slamTime)/1000.0))<<";"
|
||||
<<(1/(uMax(slamTime)/1000.0))<<";"
|
||||
<<(1/(uMean(odomTime)/1000.0))<<";"
|
||||
<<(1/(uMax(odomTime)/1000.0))<<";"<<std::endl;
|
||||
myfile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
printf(" %s (%d, s=%.3f):\terror lin=%.3fm (max=%.3fm, odom=%.3fm) ang=%.1fdeg%s%s, slam: avg=%dms (max=%dms) loops=%d, odom: avg=%dms (max=%dms), camera: avg=%dms, %smap=%dMB\n",
|
||||
|
||||
Reference in New Issue
Block a user