10 #include <mrpt/core/exceptions.h>
11 #include <mrpt/maps/CSimpleMap.h>
12 #include <mrpt/math/TBoundingBox.h>
13 #include <mrpt/system/filesystem.h>
21 const auto& lstCmds =
cli->argCmd.getValue();
31 auto bbox = mrpt::math::TBoundingBox::PlusMinusInfinity();
32 bool hasTwist =
false;
33 std::optional<mrpt::Clock::time_point> timeMin, timeMax;
35 std::map<std::string, std::string> obsTypes;
36 std::map<std::string, size_t> obsCount;
38 for (
const auto& [pose, sf, twist] : sm)
40 if (twist.has_value()) hasTwist =
true;
42 const auto p = pose->getMeanVal().asTPose();
43 bbox.updateWithPoint(p.translation());
47 for (
const auto& o : *sf)
50 auto t = o->getTimeStamp();
51 if (!timeMin ||
t < *timeMin) timeMin =
t;
52 if (!timeMax ||
t > *timeMax) timeMax =
t;
54 obsTypes[o->sensorLabel] = o->GetRuntimeClass()->className;
55 obsCount[o->sensorLabel]++;
59 const auto sizeBytes = mrpt::system::getFileSize(file);
62 std::cout <<
"size_bytes: " << sizeBytes <<
"\n";
63 std::cout <<
"keyframe_count: " << sm.size() <<
"\n";
64 std::cout <<
"has_twist: " << (hasTwist ?
"true" :
"false")
66 std::cout <<
"kf_bounding_box_min: " << bbox.min.asString() <<
"\n";
67 std::cout <<
"kf_bounding_box_max: " << bbox.max.asString() <<
"\n";
68 std::cout <<
"kf_bounding_box_span: " << (bbox.max - bbox.min).asString()
70 std::cout <<
"timestamp_first_utc: "
71 << (timeMin ? mrpt::system::dateTimeToString(*timeMin) :
"None")
73 std::cout <<
"timestamp_last_utc: "
74 << (timeMax ? mrpt::system::dateTimeToString(*timeMax) :
"None")
76 std::cout <<
"timestamp_span: "
77 << ((timeMin && timeMax)
78 ? mrpt::system::formatTimeInterval(
79 mrpt::system::timeDifference(*timeMax, *timeMin))
82 std::cout <<
"observations:\n";
84 for (
const auto& [label, type] : obsTypes)
86 std::cout <<
" - label: '" << label <<
"'\n";
87 std::cout <<
" class: '" << type <<
"'\n";
88 std::cout <<
" count: " << obsCount[label] <<
"\n";
99 std::cerr <<
"Error: missing or unknown subcommand.\n";
107 sm-cli info <filename.simplemap> Loads and analyze the given map
111 return showErrorMsg ? 1 : 0;