|
Monado OpenXR Runtime
|
The base type for a relation history. More...
#include <math/m_relation_history.hpp>

Public Member Functions | |
| bool | pushOrUpdateLocked (const T &rhe, bool allow_update) |
| Pushes a new entry (if newest) or updates an old one if allowed. | |
| std::optional< T > | getLatestLocked () const |
| Gets the latest entry, or nullopt if none exists. | |
| m_relation_history_result | getLocked (timepoint_ns timestamp_ns, T &out_entry) const |
| Gets the device's relation at the specified timestamp. | |
| std::optional< T > | getExactLocked (timepoint_ns timestamp_ns) const |
| Gets an exact entry, if it exists. | |
| std::optional< T > | getNearestLocked (timepoint_ns timestamp_ns, time_duration_ns max_slop_ns) const |
Gets the stored entry nearest to the given timestamp, if one exists within max_slop_ns of it. | |
| bool | pushOrUpdate (const T &entry, bool allow_update) |
| Pushes a new entry (if newest) or updates an old one if allowed. | |
| std::optional< T > | getLatest () const |
| Gets the latest entry, or nullopt if none exists. | |
| bool | pushWithMotionEstimation (const T &new_entry, bool allow_update) |
| Pushes a new entry, doing motion estimation if required. | |
| uint32_t | size () const |
| Gets the amount of entries contained within the history. | |
| void | clear () |
| Clears the relation history. | |
| m_relation_history_result | get (timepoint_ns timestamp_ns, T &out_entry) const |
| Gets the device's relation at the specified timestamp. | |
| std::optional< T > | getExact (timepoint_ns timestamp_ns) const |
| Gets an exact entry, if it exists. | |
| std::optional< T > | getNearest (timepoint_ns timestamp_ns, time_duration_ns max_slop_ns) const |
Gets the stored entry nearest to the given timestamp, if one exists within max_slop_ns of it. | |
Data Fields | |
| util::HistoryBuffer< T, kBufLen > | impl |
| os::Mutex | mutex |
Static Public Attributes | |
| static constexpr size_t | kBufLen = 4096 |
The base type for a relation history.
T must be a type compatible with RelationHistoryEntry (fields & functions).
|
inline |
Clears the relation history.
Thread safe, holds mutex.
|
inline |
Gets the device's relation at the specified timestamp.
May predict or interpolate to get the closest value.
Call with mutex held.
Thread safe, holds mutex.
References xrt::auxiliary::math::RelationHistoryBase< T >::getLocked().
Referenced by xrt::auxiliary::tracking::slam::predict_pose().
|
inline |
Gets an exact entry, if it exists.
Call with mutex held.
Thread safe, holds mutex.
References xrt::auxiliary::math::RelationHistoryBase< T >::getExactLocked().
|
inline |
Gets an exact entry, if it exists.
Call with mutex held.
References xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::begin(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::empty(), and xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::end().
Referenced by xrt::auxiliary::math::RelationHistoryBase< T >::getExact().
|
inline |
Gets the latest entry, or nullopt if none exists.
Call with mutex locked.
Thread safe, holds mutex.
References xrt::auxiliary::math::RelationHistoryBase< T >::getLatestLocked().
Referenced by xrt::auxiliary::tracking::slam::flush_poses(), and xrt::auxiliary::tracking::slam::predict_pose().
|
inline |
Gets the latest entry, or nullopt if none exists.
Call with mutex locked.
References xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::back(), and xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::empty().
Referenced by xrt::auxiliary::math::RelationHistoryBase< T >::getLatest(), and xrt::auxiliary::math::RelationHistoryBase< T >::pushWithMotionEstimation().
|
inline |
Gets the device's relation at the specified timestamp.
May predict or interpolate to get the closest value.
Call with mutex held.
References xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::back(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::begin(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::empty(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::end(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::front(), M_RELATION_HISTORY_RESULT_EXACT, M_RELATION_HISTORY_RESULT_INTERPOLATED, M_RELATION_HISTORY_RESULT_INVALID, M_RELATION_HISTORY_RESULT_PREDICTED, M_RELATION_HISTORY_RESULT_REVERSE_PREDICTED, time_ns_to_s(), and U_LOG_T.
Referenced by xrt::auxiliary::math::RelationHistoryBase< T >::get().
|
inline |
Gets the stored entry nearest to the given timestamp, if one exists within max_slop_ns of it.
Never interpolates or extrapolates, the returned entry is exactly as stored (check its timestamp to see how far off it is). If two entries are equally close, the older one is returned.
Call with mutex held.
Thread safe, holds mutex.
References xrt::auxiliary::math::RelationHistoryBase< T >::getNearestLocked().
|
inline |
Gets the stored entry nearest to the given timestamp, if one exists within max_slop_ns of it.
Never interpolates or extrapolates, the returned entry is exactly as stored (check its timestamp to see how far off it is). If two entries are equally close, the older one is returned.
Call with mutex held.
References xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::begin(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::empty(), and xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::end().
Referenced by xrt::auxiliary::math::RelationHistoryBase< T >::getNearest().
|
inline |
Pushes a new entry (if newest) or updates an old one if allowed.
Call with mutex locked.
Thread safe, holds mutex.
References xrt::auxiliary::math::RelationHistoryBase< T >::pushOrUpdateLocked().
Referenced by xrt::auxiliary::tracking::slam::flush_poses().
|
inline |
Pushes a new entry (if newest) or updates an old one if allowed.
Call with mutex locked.
References xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::begin(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::empty(), xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::end(), and xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::push_back().
Referenced by xrt::auxiliary::math::RelationHistoryBase< T >::pushOrUpdate(), and xrt::auxiliary::math::RelationHistoryBase< T >::pushWithMotionEstimation().
|
inline |
Pushes a new entry, doing motion estimation if required.
Thread safe, holds mutex.
References xrt::auxiliary::math::RelationHistoryBase< T >::getLatestLocked(), and xrt::auxiliary::math::RelationHistoryBase< T >::pushOrUpdateLocked().
|
inline |
Gets the amount of entries contained within the history.
Thread safe, holds mutex.
References xrt::auxiliary::util::HistoryBuffer< T, MaxSize >::size().