|
Monado OpenXR Runtime
|
A routine to automatically refine latency offsets of LED blink times using constellation samples. More...
#include "xrt/xrt_compiler.h"#include "xrt/xrt_tracking.h"#include "tracking/t_constellation.h"#include "util/u_time.h"#include "util/u_var.h"#include "util/u_debug.h"#include "math/m_api.h"#include "os/os_time.h"#include "constellation/t_led_sync_refinement.h"#include "led_sync_internal.h"#include "pssense_gray_code.h"
Macros | |
| #define | PERIOD_ESTIMATE_FRAMES 600 |
| How many frames the period estimate is measured over, ~10s at 60 fps. | |
| #define | PERIOD_ESTIMATE_MAX_ERROR 200e-6 |
| How far a run may be from the per-frame interval before it's taken as a timestamp jump. | |
| #define | PERIOD_ESTIMATE_AGREEMENT 10e-6 |
| How closely two runs in a row have to agree before the estimate is trusted. | |
Functions | |
| static time_duration_ns | change_good_cutoff (struct t_led_sync_refinement *refinement) |
| The amount of time of which a change under this amount is considered "good" and we can exit the binary search. | |
| static uint32_t | frames_since_sample_apply (struct t_led_sync_refinement *refinement, timepoint_ns now_ns) |
| The amount of frames since the sample was applied to the controller. | |
| static time_duration_ns | get_search_period_locked (struct t_led_sync_refinement *refinement) |
| Gets the period to iterate over when searching for an offset. | |
| static void | update_period_estimate (struct t_led_sync_refinement *refinement, const struct t_timing_event_camera_exposure_start *event) |
| Measures the frame period over many frames, the per-frame interval is too noisy to trim the LED cycle from. | |
| static void | handle_find_initial_offset (struct t_led_sync_refinement *refinement) |
| static void | handle_find_right_edge (struct t_led_sync_refinement *refinement) |
| static void | handle_find_left_edge (struct t_led_sync_refinement *refinement) |
| static void | handle_refine_blink_duration (struct t_led_sync_refinement *refinement) |
| static void | handle_maintain_offset (struct t_led_sync_refinement *refinement) |
| static void | handle_timing_event_locked (struct t_led_sync_refinement *refinement, const struct t_timing_event_camera_exposure_start *event) |
| static void | handle_constellation_sample_locked (struct t_led_sync_refinement *refinement, const struct t_constellation_tracker_sample *sample) |
| int | t_led_sync_refinement_init (struct t_led_sync_refinement *refinement, const struct t_led_sync_refinement_options *options) |
| void | t_led_sync_refinement_destroy (struct t_led_sync_refinement *refinement) |
| void | t_led_sync_push_timing_event (struct t_led_sync_refinement *refinement, const struct t_timing_event_camera_exposure_start *event) |
| void | t_led_sync_push_constellation_sample (struct t_led_sync_refinement *refinement, const struct t_constellation_tracker_sample *sample) |
| bool | t_led_sync_get_sample (struct t_led_sync_refinement *refinement, struct t_led_sync_sample *out_sample) |
| void | t_led_sync_mark_latest_sample_applied (struct t_led_sync_refinement *refinement, timepoint_ns apply_time_ns) |
| void | t_led_sync_push_host_device_clock_offset (struct t_led_sync_refinement *refinement, time_duration_ns clock_offset_ns) |
| Pushes a clock offset to the refinement routine, this is the offset from the host to the device. | |
A routine to automatically refine latency offsets of LED blink times using constellation samples.
| #define PERIOD_ESTIMATE_AGREEMENT 10e-6 |
How closely two runs in a row have to agree before the estimate is trusted.
| #define PERIOD_ESTIMATE_FRAMES 600 |
How many frames the period estimate is measured over, ~10s at 60 fps.
| #define PERIOD_ESTIMATE_MAX_ERROR 200e-6 |
How far a run may be from the per-frame interval before it's taken as a timestamp jump.
|
static |
The amount of time of which a change under this amount is considered "good" and we can exit the binary search.
References t_led_sync_refinement::current_blink_duration_ns, t_led_sync_refinement::exposure_time_ns, and MIN.
|
static |
The amount of frames since the sample was applied to the controller.
References t_led_sync_refinement::exposure_interval_ns, and t_led_sync_refinement::last_sample_apply_time_ns.
|
static |
Gets the period to iterate over when searching for an offset.
References t_led_sync_refinement::current_blink_duration_ns, t_led_sync_refinement::exposure_time_ns, t_led_sync_refinement::has_exposure_time, MAX, MIN, t_led_sync_refinement::phase, and T_LED_SYNC_PHASE_FIND_INITIAL_OFFSET.
| void t_led_sync_push_host_device_clock_offset | ( | struct t_led_sync_refinement * | refinement, |
| time_duration_ns | clock_offset_ns | ||
| ) |
Pushes a clock offset to the refinement routine, this is the offset from the host to the device.
To convert a timestamp from host -> device domain, you would do: device_timestamp = host_timestamp + clock_offset_ns
References t_led_sync_refinement::driver_host_device_clock_offset_ns, and t_led_sync_refinement::initialized.
|
static |
Measures the frame period over many frames, the per-frame interval is too noisy to trim the LED cycle from.
References t_led_sync_period_estimate::candidate_ns, t_led_sync_refinement::exposure_interval_ns, PERIOD_ESTIMATE_AGREEMENT, PERIOD_ESTIMATE_FRAMES, PERIOD_ESTIMATE_MAX_ERROR, t_led_sync_period_estimate::period_ns, t_timing_event_camera_exposure_start::sequence_id, and t_timing_event_camera_exposure_start::timestamp_ns.