77 uint64_t at_timestamp_ns,
109 uint64_t *out_time_ns,
149 class RelationHistory
155 typedef m_relation_history_result Result;
164 RelationHistory() noexcept { m_relation_history_create(&mPtr); }
165 ~RelationHistory() { m_relation_history_destroy(&mPtr); }
169 RelationHistory(RelationHistory
const &) =
delete;
170 RelationHistory(RelationHistory &&) =
delete;
172 operator=(RelationHistory
const &) =
delete;
174 operator=(RelationHistory &&) =
delete;
183 return m_relation_history_push(mPtr, &relation, ts);
201 return m_relation_history_get_latest(mPtr, out_time_ns, out_relation);
208 size() const noexcept
210 return m_relation_history_get_size(mPtr);
219 return m_relation_history_clear(mPtr);
enum m_relation_history_result m_relation_history_get(const struct m_relation_history *rh, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Definition: m_relation_history.cpp:84
@ M_RELATION_HISTORY_RESULT_INTERPOLATED
The desired timestamp was between two entries.
Definition: m_relation_history.h:40
@ M_RELATION_HISTORY_RESULT_PREDICTED
The desired timestamp was newer than the most recent entry.
Definition: m_relation_history.h:41
@ M_RELATION_HISTORY_RESULT_REVERSE_PREDICTED
The desired timestamp was older than the oldest entry.
Definition: m_relation_history.h:42
@ M_RELATION_HISTORY_RESULT_INVALID
The supplied timestamp was invalid (0) or buffer was empty.
Definition: m_relation_history.h:38
@ M_RELATION_HISTORY_RESULT_EXACT
The exact desired timestamp was found.
Definition: m_relation_history.h:39
C++-only functionality in the Math helper library.
Definition: m_documentation.hpp:15
Definition: m_relation_history.cpp:46
bool m_relation_history_get_latest(const struct m_relation_history *rh, uint64_t *out_time_ns, struct xrt_space_relation *out_relation)
Get the latest report in the buffer, if any.
Definition: m_relation_history.cpp:231
void m_relation_history_destroy(struct m_relation_history **rh)
Destroys an opaque relation_history object.
Definition: m_relation_history.cpp:259
bool m_relation_history_estimate_motion(struct m_relation_history *rh, const struct xrt_space_relation *in_relation, uint64_t timestamp, struct xrt_space_relation *out_relation)
Estimates the movement (velocity and angular velocity) of a new relation based on the latest relation...
Definition: m_relation_history.cpp:184
m_relation_history_result
Describes how the resulting space relation for the desired time stamp was generated.
Definition: m_relation_history.h:37
bool m_relation_history_push(struct m_relation_history *rh, struct xrt_space_relation const *in_relation, uint64_t timestamp)
Pushes a new pose to the history.
Definition: m_relation_history.cpp:60
uint32_t m_relation_history_get_size(const struct m_relation_history *rh)
Returns the number of items in the history.
Definition: m_relation_history.cpp:245
enum m_relation_history_result m_relation_history_get(const struct m_relation_history *rh, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
Interpolates or extrapolates to the desired timestamp.
Definition: m_relation_history.cpp:84
void m_relation_history_clear(struct m_relation_history *rh)
Clears the history from all of the items.
Definition: m_relation_history.cpp:252
void m_relation_history_create(struct m_relation_history **rh)
Creates an opaque relation_history object.
Definition: m_relation_history.cpp:53
A relation with two spaces, includes velocity and acceleration.
Definition: xrt_defines.h:657
static const cJSON * get(const cJSON *json, const char *f)
Less typing.
Definition: u_json.c:36
Common defines and enums for XRT.