43 #define COLOR_NORMAL FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED 44 #define COLOR_RED FOREGROUND_RED | FOREGROUND_INTENSITY 45 #define COLOR_GREEN FOREGROUND_GREEN 46 #define COLOR_YELLOW FOREGROUND_GREEN | FOREGROUND_RED 48 #define COLOR_NORMAL "\033[0m" 49 #define COLOR_RED "\033[31m" 50 #define COLOR_GREEN "\033[32m" 51 #define COLOR_YELLOW "\033[33m" 57 "rtabmap-info [options] \"map.db\"\n" 59 " --diff Show only modified parameters.\n" 60 " --diff \"other_map.db\" Compare parameters with other database.\n" 65 std::string
pad(
const std::string & title,
int padding = 20)
67 int emptySize = padding - (int)title.size();
70 return title + std::string(emptySize,
' ');
82 std::string otherDatabasePath;
84 for(
int i=1; i<argc-1; ++i)
86 if(strcmp(argv[i],
"--diff") == 0)
92 printf(
"Comparing with other database \"%s\"...\n", otherDatabasePath.c_str());
101 printf(
"Database \"%s\" doesn't exist!\n", databasePath.c_str());
108 printf(
"Cannot open database \"%s\".\n", databasePath.c_str());
116 std::string otherDatabasePathName;
117 if(!otherDatabasePath.empty())
123 printf(
"Database \"%s\" doesn't exist!\n", otherDatabasePath.c_str());
130 printf(
"Cannot open database \"%s\".\n", otherDatabasePath.c_str());
136 removedParameters.clear();
140 HANDLE H = GetStdHandle(STD_OUTPUT_HANDLE);
143 std::cout << (
"Parameters (Yellow=modified, Red=old parameter not used anymore):\n");
144 for(ParametersMap::iterator iter=parameters.begin(); iter!=parameters.end(); ++iter)
146 ParametersMap::const_iterator jter = defaultParameters.find(iter->first);
147 std::string defaultValue;
148 bool defaultValueSet =
false;
149 if(jter == defaultParameters.end())
151 jter = removedParameters.find(iter->first);
152 if(jter != removedParameters.end())
154 defaultValue = jter->second;
155 defaultValueSet =
true;
160 defaultValue = jter->second;
161 defaultValueSet =
true;
164 if(defaultValueSet &&
165 iter->second.compare(defaultValue) != 0 &&
166 iter->first.compare(Parameters::kRtabmapWorkingDirectory()) != 0)
168 bool different =
true;
186 std::cout << (
uFormat(
"%s%s (%s=%s)\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str(), otherDatabasePath.empty()?
"default":otherDatabasePathName.c_str(), defaultValue.c_str()));
196 std::cout << (
uFormat(
"%s%s\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str()));
199 else if(!defaultValueSet && otherDatabasePath.empty())
207 std::cout << (
uFormat(
"%s%s\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str()));
217 std::cout << (
uFormat(
"%s%s\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str()));
226 if(otherDatabasePath.empty())
228 printf(
"\nInfo:\n\n");
233 std::map<int, Transform> optimizedPoses = driver->
loadOptimizedPoses(&lastLocalization);
234 std::multimap<int, int> mapIdsLinkedToLastGraph;
236 double previousStamp = 0.0f;
238 float infoTotalOdom = 0.0f;
239 double infoTotalTime = 0.0f;
240 int sessions = !ids.empty()?1:0;
244 for(std::set<int>::iterator iter=ids.begin(); iter!=ids.end(); ++iter)
251 std::vector<float> v;
255 driver->
getNodeInfo(
id, p, mapId, w, l, s, g, v, gps, sensors);
268 if(optimizedPoses.find(
id) != optimizedPoses.end())
270 mapIdsLinkedToLastGraph.insert(std::make_pair(mapId,
id));
272 if(iter!=ids.begin())
274 if(lastMapId == mapId)
281 if(previousStamp > 0.0 && s > 0.0)
283 infoTotalTime += s-previousStamp;
295 std::cout << (
uFormat(
"%s%s\n",
pad(
"Path:").c_str(), driver->
getUrl().c_str()));
297 std::cout << (
uFormat(
"%s%d\n",
pad(
"Sessions:").c_str(), sessions));
298 std::multimap<int, Link> links;
300 bool reducedGraph =
false;
302 for(std::multimap<int, Link>::iterator iter=links.begin(); iter!=links.end(); ++iter)
308 if(iter->second.type()>=0 && iter->second.type()<
Link::kEnd)
310 ++linkTypes[iter->second.type()];
315 std::cout << (
uFormat(
"%s%f m (approx. as graph has been reduced)\n",
pad(
"Total odom:").c_str(), infoTotalOdom));
319 std::cout << (
uFormat(
"%s%f m\n",
pad(
"Total odometry length:").c_str(), infoTotalOdom));
322 std::stringstream sessionsInOptGraphStr;
323 std::list<int> mapsLinkedToLastGraph =
uUniqueKeys(mapIdsLinkedToLastGraph);
324 for(std::list<int>::iterator iter=mapsLinkedToLastGraph.begin(); iter!=mapsLinkedToLastGraph.end(); ++iter)
326 if(iter!=mapsLinkedToLastGraph.begin())
328 sessionsInOptGraphStr <<
", ";
330 sessionsInOptGraphStr << *iter <<
"(" << mapIdsLinkedToLastGraph.count(*iter) <<
")";
333 int lastWordIdId = 0;
340 ids.insert(lastWordIdId);
341 std::list<VisualWord *> vws;
345 wordsDim = vws.front()->getDescriptor().cols;
346 wordsType = vws.front()->getDescriptor().type();
352 std::cout << (
uFormat(
"%s%fs\n",
pad(
"Total time:").c_str(), infoTotalTime));
353 std::cout << (
uFormat(
"%s%d nodes and %d words (dim=%d type=%s)\n",
pad(
"LTM:").c_str(), (
int)ids.size(), driver->
getTotalDictionarySize(), wordsDim, wordsType==CV_8UC1?
"8U":wordsType==CV_32FC1?
"32F":
uNumber2Str(wordsType).c_str()));
355 std::cout << (
uFormat(
"%s%d poses and %d links\n",
pad(
"Global graph:").c_str(), odomPoses, links.size()));
356 std::cout << (
uFormat(
"%s%d poses\n",
pad(
"Optimized graph:").c_str(), (
int)optimizedPoses.size(), links.size()));
357 std::cout << (
uFormat(
"%s%d/%d [%s]\n",
pad(
"Maps in graph:").c_str(), (
int)mapsLinkedToLastGraph.size(), sessions, sessionsInOptGraphStr.str().c_str()));
358 std::cout << (
uFormat(
"%s%d poses\n",
pad(
"Ground truth:").c_str(), gtPoses));
359 std::cout << (
uFormat(
"%s%d poses\n",
pad(
"GPS:").c_str(), gpsValues));
360 std::cout << (
uFormat(
"Links:\n"));
361 for(
size_t i=0; i<linkTypes.size(); ++i)
369 std::cout << (
uFormat(
"%s%d %s\n",
pad(
"Database size:").c_str(), mem>1000000?mem/1000000:mem>1000?mem/1000:mem, mem>1000000?
"MB":mem>1000?
"KB":
"Bytes"));
372 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
375 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
378 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
381 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
384 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
387 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
390 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
393 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
396 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
399 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
402 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
403 mem = dbSize - total;
404 std::cout << (
uFormat(
"%s%d %s\t(%.2f%%)\n",
pad(
"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));
static std::string homeDir()
std::list< K > uUniqueKeys(const std::multimap< K, V > &mm)
long getFeaturesMemoryUsed() const
long getGridsMemoryUsed() const
long getImagesMemoryUsed() const
long getUserDataMemoryUsed() const
double UTILITE_EXP uStr2Double(const std::string &str)
void getAllNodeIds(std::set< int > &ids, bool ignoreChildren=false, bool ignoreBadSignatures=false) const
long getWordsMemoryUsed() const
std::map< std::string, std::string > ParametersMap
void loadWords(const std::set< int > &wordIds, std::list< VisualWord * > &vws)
int main(int argc, char *argv[])
const std::string & getUrl() const
bool openConnection(const std::string &url, bool overwritten=false)
Wrappers of STL for convenient functions.
void getAllLinks(std::multimap< int, Link > &links, bool ignoreNullLinks=true, bool withLandmarks=false) const
static const ParametersMap & getBackwardCompatibilityMap()
long getLaserScansMemoryUsed() const
void closeConnection(bool save=true, const std::string &outputUrl="")
int getLastDictionarySize() const
long getStatisticsMemoryUsed() const
std::string UTILITE_EXP uReplaceChar(const std::string &str, char before, char after)
long getCalibrationsMemoryUsed() const
long getDepthImagesMemoryUsed() const
static DBDriver * create(const ParametersMap ¶meters=ParametersMap())
bool getNodeInfo(int signatureId, Transform &pose, int &mapId, int &weight, std::string &label, double &stamp, Transform &groundTruthPose, std::vector< float > &velocity, GPS &gps, EnvSensors &sensors) const
static std::string getType(const std::string ¶mKey)
static const ParametersMap & getDefaultParameters()
ParametersMap getLastParameters() const
std::string typeName() const
int getTotalDictionarySize() const
std::string getDatabaseVersion() const
std::map< EnvSensor::Type, EnvSensor > EnvSensors
std::string pad(const std::string &title, int padding=20)
std::string UTILITE_EXP uFormat(const char *fmt,...)
std::string UTILITE_EXP uNumber2Str(unsigned int number)
long getLinksMemoryUsed() const
void getLastWordId(int &id) const
int getLastNodesSize() const
long getNodesMemoryUsed() const
std::map< int, Transform > loadOptimizedPoses(Transform *lastlocalizationPose=0) const
const double & stamp() const