14 #include <mrpt/containers/yaml.h>
35 mrpt::system::COutputLogger::setLoggerName(
"FilterAdjustTimestamps");
42 MRPT_LOG_DEBUG_STREAM(
"Loading these params:\n" << c);
58 "Input point cloud layer '%s' was not found.",
63 auto* TsPtr = pc.getPointsBufferRef_timestamp();
65 if (TsPtr ==
nullptr || (TsPtr->empty() && !pc.empty()))
70 MRPT_LOG_DEBUG_STREAM(
71 "Skipping time adjusting in input cloud '"
73 << pc.asString() <<
" due to missing timestamps.");
79 "Cannot do time adjusting for input cloud '%s' "
80 "with contents: %s due to missing timestamps.",
87 std::optional<float> minT, maxT;
89 for (
size_t i = 0; i < Ts.size(); i++)
91 const float t = Ts[i];
93 if (!minT ||
t < *minT) minT =
t;
94 if (!maxT ||
t > *maxT) maxT =
t;
96 ASSERT_(minT && maxT);
103 for (
auto&
t : Ts)
t -= dt;
109 for (
auto&
t : Ts)
t -= dt;
114 const float m = *minT;
115 const float k = *maxT != *minT ? 1.0f / (*maxT - *minT) : 1.0
f;
121 THROW_EXCEPTION(
"Unknown value for 'method'");