44 #define COLOR_NORMAL FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
45 #define COLOR_RED FOREGROUND_RED | FOREGROUND_INTENSITY
46 #define COLOR_GREEN FOREGROUND_GREEN
47 #define COLOR_YELLOW FOREGROUND_GREEN | FOREGROUND_RED
49 #define COLOR_NORMAL "\033[0m"
50 #define COLOR_RED "\033[31m"
51 #define COLOR_GREEN "\033[32m"
52 #define COLOR_YELLOW "\033[33m"
58 "rtabmap-info [options] \"map.db\"\n"
60 " --diff Show only modified parameters.\n"
61 " --diff \"other_map.db\" Compare parameters with other database.\n"
62 " --dump \"config.ini\" Dump parameters in ini file.\n"
74 std::string otherDatabasePath;
75 std::string dumpFilePath;
77 for(
int i=1;
i<argc-1; ++
i)
79 if(strcmp(
argv[
i],
"--diff") == 0)
82 if(
i<argc-1 &&
argv[
i][0] !=
'-')
85 printf(
"Comparing with other database \"%s\"...\n", otherDatabasePath.c_str());
89 if(strcmp(
argv[
i],
"--dump") == 0)
98 printf(
"--dump should have an output file path\n");
107 printf(
"Database \"%s\" doesn't exist!\n", databasePath.c_str());
114 printf(
"Cannot open database \"%s\".\n", databasePath.c_str());
120 if(!dumpFilePath.empty())
123 printf(
"%ld parameters exported to \"%s\".\n", parameters.size(), dumpFilePath.c_str());
128 std::string otherDatabasePathName;
129 if(!otherDatabasePath.empty())
135 printf(
"Database \"%s\" doesn't exist!\n", otherDatabasePath.c_str());
142 printf(
"Cannot open database \"%s\".\n", otherDatabasePath.c_str());
148 removedParameters.clear();
152 HANDLE
H = GetStdHandle(STD_OUTPUT_HANDLE);
155 std::cout << (
"Parameters (Yellow=modified, Red=old parameter not used anymore, NA=not in database):\n");
156 for(ParametersMap::iterator
iter=parameters.begin();
iter!=parameters.end(); ++
iter)
158 ParametersMap::const_iterator jter = defaultParameters.find(
iter->first);
159 std::string defaultValue;
160 bool defaultValueSet =
false;
161 if(jter == defaultParameters.end())
163 jter = removedParameters.find(
iter->first);
164 if(jter != removedParameters.end())
166 defaultValue = jter->second;
167 defaultValueSet =
true;
172 defaultValue = jter->second;
173 defaultValueSet =
true;
176 if(defaultValueSet &&
177 iter->second.compare(defaultValue) != 0 &&
178 iter->first.compare(Parameters::kRtabmapWorkingDirectory()) != 0)
180 bool different =
true;
198 std::cout << (
uFormat(
"%s%s (%s=%s)\n",
uPad(
iter->first +
"=", padding).c_str(),
iter->second.c_str(), otherDatabasePath.empty()?
"default":otherDatabasePathName.c_str(), defaultValue.c_str()));
208 std::cout << (
uFormat(
"%s%s\n",
uPad(
iter->first +
"=", padding).c_str(),
iter->second.c_str()));
211 else if(!defaultValueSet)
219 std::cout << (
uFormat(
"%s%s (%s=NA)\n",
uPad(
iter->first +
"=", padding).c_str(),
iter->second.c_str(), otherDatabasePath.empty()?
"default":otherDatabasePathName.c_str()));
229 std::cout << (
uFormat(
"%s%s\n",
uPad(
iter->first +
"=", padding).c_str(),
iter->second.c_str()));
238 for(ParametersMap::iterator
iter=defaultParameters.begin();
iter!=defaultParameters.end(); ++
iter)
240 ParametersMap::const_iterator jter = parameters.find(
iter->first);
241 if(jter == parameters.end())
249 std::cout << (
uFormat(
"%sNA (%s=\"%s\")\n",
uPad(
iter->first +
"=", padding).c_str(), otherDatabasePath.empty()?
"default":otherDatabasePathName.c_str(),
iter->second.c_str()));
259 if(otherDatabasePath.empty())
261 printf(
"\nInfo:\n\n");
266 std::map<int, Transform> optimizedPoses = driver->
loadOptimizedPoses(&lastLocalization);
268 if(!optimizedPoses.empty())
272 std::multimap<int, int> mapIdsLinkedToLastGraph;
274 double previousStamp = 0.0f;
276 float infoTotalOdom = 0.0f;
277 double infoTotalTime = 0.0f;
282 for(std::set<int>::iterator
iter=ids.begin();
iter!=ids.end(); ++
iter)
289 std::vector<float>
v;
306 if(optimizedPoses.find(
id) != optimizedPoses.end())
308 mapIdsLinkedToLastGraph.insert(std::make_pair(mapId,
id));
310 if(
iter!=ids.begin())
312 if(lastMapId == mapId)
314 if(!
p.isNull() && !previousPose.
isNull())
316 infoTotalOdom +=
p.getDistance(previousPose);
319 if(previousStamp > 0.0 &&
s > 0.0)
321 infoTotalTime +=
s-previousStamp;
336 std::multimap<int, Link> links;
338 bool reducedGraph =
false;
340 std::vector<std::vector<float> > linkLengths(
Link::kEnd);
342 for(std::multimap<int, Link>::iterator
iter=uniqueLinks.begin();
iter!=uniqueLinks.end(); ++
iter)
350 ++linkTypes[
iter->second.type()];
351 linkLengths[
iter->second.type()].push_back(
iter->second.transform().getNorm());
356 std::cout << (
uFormat(
"%s%f m (approx. as graph has been reduced)\n",
uPad(
"Total odom:").
c_str(), infoTotalOdom));
360 std::cout << (
uFormat(
"%s%f m\n",
uPad(
"Total odometry length:").
c_str(), infoTotalOdom));
363 std::stringstream sessionsInOptGraphStr;
364 std::list<int> mapsLinkedToLastGraph =
uUniqueKeys(mapIdsLinkedToLastGraph);
365 for(std::list<int>::iterator
iter=mapsLinkedToLastGraph.begin();
iter!=mapsLinkedToLastGraph.end(); ++
iter)
367 if(
iter!=mapsLinkedToLastGraph.begin())
369 sessionsInOptGraphStr <<
", ";
371 sessionsInOptGraphStr << *
iter <<
"(" << mapIdsLinkedToLastGraph.count(*
iter) <<
")";
374 int lastWordIdId = 0;
381 ids.insert(lastWordIdId);
382 std::list<VisualWord *> vws;
386 wordsDim = vws.front()->getDescriptor().cols;
387 wordsType = vws.front()->getDescriptor().type();
393 std::cout << (
uFormat(
"%s%fs\n",
uPad(
"Total time:").
c_str(), infoTotalTime));
396 std::cout << (
uFormat(
"%s%d poses and %d links\n",
uPad(
"Global graph:").
c_str(), odomPoses, links.size()));
397 std::cout << (
uFormat(
"%s%d poses (x=%d->%d, y=%d->%d, z=%d->%d)\n",
uPad(
"Optimized graph:").
c_str(), (
int)optimizedPoses.size(), links.size(), (
int)
min[0], (
int)
max[0], (
int)
min[1], (
int)
max[1],
min[2], (
int)
max[2]));
398 std::cout << (
uFormat(
"%s%d/%d [%s]\n",
uPad(
"Maps in graph:").
c_str(), (
int)mapsLinkedToLastGraph.size(),
sessions, sessionsInOptGraphStr.str().c_str()));
399 std::cout << (
uFormat(
"%s%d poses\n",
uPad(
"Ground truth:").
c_str(), gtPoses));
401 std::cout << (
uFormat(
"Links:\n"));
402 for(
size_t i=0;
i<linkTypes.size(); ++
i)
404 float avg =
uMean(linkLengths[
i]);
411 std::cout << (
uFormat(
"%s%d\t(length avg: %.2fm, std: %.2fm, max: %.2fm)\n",
422 std::cout << (
uFormat(
"%s%d %s\n",
uPad(
"Database size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes"));
425 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Nodes size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
428 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Links size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
431 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"RGB Images size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
434 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Depth Images size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
437 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Calibrations size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
440 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Grids size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
443 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Scans size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
446 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"User data size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
449 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Dictionary size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
452 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Features size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
455 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Statistics size:").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));
456 mem = dbSize - total;
457 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
uPad(
"Other (indexing, unused):").
c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes", dbSize>0?
double(mem)/
double(dbSize)*100.0:0.0));