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" 66 std::string
pad(
const std::string & title,
int padding = 20)
68 int emptySize = padding - (int)title.size();
71 return title + std::string(emptySize,
' ');
83 std::string otherDatabasePath;
85 for(
int i=1; i<argc-1; ++i)
87 if(strcmp(argv[i],
"--diff") == 0)
93 printf(
"Comparing with other database \"%s\"...\n", otherDatabasePath.c_str());
102 printf(
"Database \"%s\" doesn't exist!\n", databasePath.c_str());
109 printf(
"Cannot open database \"%s\".\n", databasePath.c_str());
117 std::string otherDatabasePathName;
118 if(!otherDatabasePath.empty())
124 printf(
"Database \"%s\" doesn't exist!\n", otherDatabasePath.c_str());
131 printf(
"Cannot open database \"%s\".\n", otherDatabasePath.c_str());
137 removedParameters.clear();
141 HANDLE H = GetStdHandle(STD_OUTPUT_HANDLE);
144 std::cout << (
"Parameters (Yellow=modified, Red=old parameter not used anymore, NA=not in database):\n");
145 for(ParametersMap::iterator iter=parameters.begin(); iter!=parameters.end(); ++iter)
147 ParametersMap::const_iterator jter = defaultParameters.find(iter->first);
148 std::string defaultValue;
149 bool defaultValueSet =
false;
150 if(jter == defaultParameters.end())
152 jter = removedParameters.find(iter->first);
153 if(jter != removedParameters.end())
155 defaultValue = jter->second;
156 defaultValueSet =
true;
161 defaultValue = jter->second;
162 defaultValueSet =
true;
165 if(defaultValueSet &&
166 iter->second.compare(defaultValue) != 0 &&
167 iter->first.compare(Parameters::kRtabmapWorkingDirectory()) != 0)
169 bool different =
true;
187 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()));
197 std::cout << (
uFormat(
"%s%s\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str()));
200 else if(!defaultValueSet)
208 std::cout << (
uFormat(
"%s%s (%s=NA)\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str(), otherDatabasePath.empty()?
"default":otherDatabasePathName.c_str()));
218 std::cout << (
uFormat(
"%s%s\n",
pad(iter->first +
"=", padding).c_str(), iter->second.c_str()));
227 for(ParametersMap::iterator iter=defaultParameters.begin(); iter!=defaultParameters.end(); ++iter)
229 ParametersMap::const_iterator jter = parameters.find(iter->first);
230 if(jter == parameters.end())
238 std::cout << (
uFormat(
"%sNA (%s=\"%s\")\n",
pad(iter->first +
"=", padding).c_str(), otherDatabasePath.empty()?
"default":otherDatabasePathName.c_str(), iter->second.c_str()));
248 if(otherDatabasePath.empty())
250 printf(
"\nInfo:\n\n");
255 std::map<int, Transform> optimizedPoses = driver->
loadOptimizedPoses(&lastLocalization);
257 if(!optimizedPoses.empty())
261 std::multimap<int, int> mapIdsLinkedToLastGraph;
263 double previousStamp = 0.0f;
265 float infoTotalOdom = 0.0f;
266 double infoTotalTime = 0.0f;
267 int sessions = !ids.empty()?1:0;
271 for(std::set<int>::iterator iter=ids.begin(); iter!=ids.end(); ++iter)
278 std::vector<float> v;
282 driver->
getNodeInfo(
id, p, mapId, w, l, s, g, v, gps, sensors);
295 if(optimizedPoses.find(
id) != optimizedPoses.end())
297 mapIdsLinkedToLastGraph.insert(std::make_pair(mapId,
id));
299 if(iter!=ids.begin())
301 if(lastMapId == mapId)
308 if(previousStamp > 0.0 && s > 0.0)
310 infoTotalTime += s-previousStamp;
322 std::cout << (
uFormat(
"%s%s\n",
pad(
"Path:").c_str(), driver->
getUrl().c_str()));
324 std::cout << (
uFormat(
"%s%d\n",
pad(
"Sessions:").c_str(), sessions));
325 std::multimap<int, Link> links;
327 bool reducedGraph =
false;
329 for(std::multimap<int, Link>::iterator iter=links.begin(); iter!=links.end(); ++iter)
335 if(iter->second.type()>=0 && iter->second.type()<
Link::kEnd)
337 ++linkTypes[iter->second.type()];
342 std::cout << (
uFormat(
"%s%f m (approx. as graph has been reduced)\n",
pad(
"Total odom:").c_str(), infoTotalOdom));
346 std::cout << (
uFormat(
"%s%f m\n",
pad(
"Total odometry length:").c_str(), infoTotalOdom));
349 std::stringstream sessionsInOptGraphStr;
350 std::list<int> mapsLinkedToLastGraph =
uUniqueKeys(mapIdsLinkedToLastGraph);
351 for(std::list<int>::iterator iter=mapsLinkedToLastGraph.begin(); iter!=mapsLinkedToLastGraph.end(); ++iter)
353 if(iter!=mapsLinkedToLastGraph.begin())
355 sessionsInOptGraphStr <<
", ";
357 sessionsInOptGraphStr << *iter <<
"(" << mapIdsLinkedToLastGraph.count(*iter) <<
")";
360 int lastWordIdId = 0;
367 ids.insert(lastWordIdId);
368 std::list<VisualWord *> vws;
372 wordsDim = vws.front()->getDescriptor().cols;
373 wordsType = vws.front()->getDescriptor().type();
379 std::cout << (
uFormat(
"%s%fs\n",
pad(
"Total time:").c_str(), infoTotalTime));
380 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()));
382 std::cout << (
uFormat(
"%s%d poses and %d links\n",
pad(
"Global graph:").c_str(), odomPoses, links.size()));
383 std::cout << (
uFormat(
"%s%d poses (x=%d->%d, y=%d->%d, z=%d->%d)\n",
pad(
"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]));
384 std::cout << (
uFormat(
"%s%d/%d [%s]\n",
pad(
"Maps in graph:").c_str(), (
int)mapsLinkedToLastGraph.size(), sessions, sessionsInOptGraphStr.str().c_str()));
385 std::cout << (
uFormat(
"%s%d poses\n",
pad(
"Ground truth:").c_str(), gtPoses));
386 std::cout << (
uFormat(
"%s%d poses\n",
pad(
"GPS:").c_str(), gpsValues));
387 std::cout << (
uFormat(
"Links:\n"));
388 for(
size_t i=0; i<linkTypes.size(); ++i)
396 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"));
399 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));
402 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));
405 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));
408 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));
411 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));
414 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));
417 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));
420 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));
423 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));
426 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));
429 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));
430 mem = dbSize - total;
431 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 getWordsMemoryUsed() const
const double & stamp() const
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
void loadWords(const std::set< int > &wordIds, std::list< VisualWord *> &vws)
long getStatisticsMemoryUsed() const
double UTILITE_EXP uStr2Double(const std::string &str)
long getFeaturesMemoryUsed() const
std::map< std::string, std::string > ParametersMap
int main(int argc, char *argv[])
long getNodesMemoryUsed() const
std::map< int, Transform > loadOptimizedPoses(Transform *lastlocalizationPose=0) const
std::string typeName() const
bool openConnection(const std::string &url, bool overwritten=false)
void getAllLinks(std::multimap< int, Link > &links, bool ignoreNullLinks=true, bool withLandmarks=false) const
long getLaserScansMemoryUsed() const
Wrappers of STL for convenient functions.
int getTotalDictionarySize() const
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 const ParametersMap & getBackwardCompatibilityMap()
void closeConnection(bool save=true, const std::string &outputUrl="")
void getAllNodeIds(std::set< int > &ids, bool ignoreChildren=false, bool ignoreBadSignatures=false, bool ignoreIntermediateNodes=false) const
long getGridsMemoryUsed() const
std::string UTILITE_EXP uReplaceChar(const std::string &str, char before, char after)
static DBDriver * create(const ParametersMap ¶meters=ParametersMap())
long getCalibrationsMemoryUsed() const
static std::string getType(const std::string ¶mKey)
int getLastNodesSize() const
static const ParametersMap & getDefaultParameters()
void RTABMAP_EXP computeMinMax(const std::map< int, Transform > &poses, cv::Vec3f &min, cv::Vec3f &max)
void getLastWordId(int &id) const
GLM_FUNC_DECL genType max(genType const &x, genType const &y)
long getDepthImagesMemoryUsed() const
ParametersMap getLastParameters() const
long getImagesMemoryUsed() const
std::string getDatabaseVersion() const
int getLastDictionarySize() const
std::map< EnvSensor::Type, EnvSensor > EnvSensors
std::string pad(const std::string &title, int padding=20)
long getUserDataMemoryUsed() const
std::string UTILITE_EXP uFormat(const char *fmt,...)
long getLinksMemoryUsed() const
std::string UTILITE_EXP uNumber2Str(unsigned int number)
const std::string & getUrl() const