diff --git a/server/driver/history.h b/server/driver/history.h index 5cb993b8..4fc54738 100644 --- a/server/driver/history.h +++ b/server/driver/history.h @@ -27,7 +27,7 @@ #include #include -template +template class history { struct TimedData : public Data @@ -127,10 +127,11 @@ public: if (data.front().at_timestamp_ns > at_timestamp_ns) { - if constexpr (extrapolate) + if constexpr (extrapolation) { auto second = data.begin(); auto first = second++; + at_timestamp_ns = std::max(at_timestamp_ns, data.front().at_timestamp_ns - extrapolation); return {ex, Derived::extrapolate(*first, *second, first->at_timestamp_ns, second->at_timestamp_ns, at_timestamp_ns)}; } else @@ -147,10 +148,11 @@ public: } } - if constexpr (extrapolate) + if constexpr (extrapolation) { auto prev = data.rbegin(); auto last = prev++; + at_timestamp_ns = std::min(at_timestamp_ns, data.back().at_timestamp_ns + extrapolation); return {ex, Derived::extrapolate(*prev, *last, prev->at_timestamp_ns, last->at_timestamp_ns, at_timestamp_ns)}; } else diff --git a/server/driver/view_list.h b/server/driver/view_list.h index db1d0d9e..e92d8d3b 100644 --- a/server/driver/view_list.h +++ b/server/driver/view_list.h @@ -30,7 +30,7 @@ struct tracked_views std::array fovs; }; -class view_list : public history +class view_list : public history { public: static tracked_views interpolate(const tracked_views & a, const tracked_views & b, float t);