xrt: use int64_t for timestamp in get_tracked_pose

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2298>
This commit is contained in:
Simon Zeni 2024-08-01 16:14:23 -04:00 committed by Rylie Pavlik
parent 8976e677b2
commit d5ba6eec5b
39 changed files with 55 additions and 55 deletions

View file

@ -173,7 +173,7 @@ android_device_destroy(struct xrt_device *xdev)
static void
android_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
(void)at_timestamp_ns;

View file

@ -332,7 +332,7 @@ arduino_device_update_inputs(struct xrt_device *xdev)
static void
arduino_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct arduino_device *ad = arduino_device(xdev);

View file

@ -311,7 +311,7 @@ daydream_device_update_inputs(struct xrt_device *xdev)
static void
daydream_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct daydream_device *daydream = daydream_device(xdev);

View file

@ -105,7 +105,7 @@ euroc_device(struct xrt_device *xdev)
static void
euroc_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct euroc_device *ed = euroc_device(xdev);

View file

@ -216,7 +216,7 @@ hdk_device_update(struct hdk_device *hd)
static void
hdk_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t requested_timestamp_ns,
int64_t requested_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct hdk_device *hd = hdk_device(xdev);

View file

@ -217,8 +217,8 @@ do_grip_pose(struct xrt_hand_joint_set *joint_set,
static void
get_other_two(struct cemu_device *dev,
uint64_t head_timestamp_ns,
uint64_t hand_timestamp_ns,
int64_t head_timestamp_ns,
int64_t hand_timestamp_ns,
xrt_pose *out_head,
xrt_hand_joint_set *out_secondary)
{
@ -242,8 +242,8 @@ get_other_two(struct cemu_device *dev,
static void
do_aim_pose(struct cemu_device *dev,
struct xrt_hand_joint_set *joint_set_primary,
uint64_t head_timestamp_ns,
uint64_t hand_timestamp_ns,
int64_t head_timestamp_ns,
int64_t hand_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct xrt_vec3 vec3_up = {0, 1, 0};
@ -319,7 +319,7 @@ do_aim_pose(struct cemu_device *dev,
static void
cemu_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct cemu_device *dev = cemu_device(xdev);

View file

@ -483,7 +483,7 @@ hydra_device_update_inputs(struct xrt_device *xdev)
static void
hydra_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct hydra_device *hd = hydra_device(xdev);

View file

@ -82,7 +82,7 @@ attached_override(struct multi_device *d,
static void
get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct multi_device *d = (struct multi_device *)xdev;

View file

@ -370,7 +370,7 @@ ns_hmd_destroy(struct xrt_device *xdev)
static void
ns_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct ns_hmd *ns = ns_hmd(xdev);

View file

@ -353,7 +353,7 @@ check_tracker_pose(struct oh_device *ohd, enum xrt_input_name name)
static void
oh_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct oh_device *ohd = oh_device(xdev);

View file

@ -909,7 +909,7 @@ psmv_device_get_relation_chain(struct xrt_device *xdev,
static void
psmv_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct xrt_relation_chain xrc = {0};

View file

@ -733,7 +733,7 @@ pssense_set_output(struct xrt_device *xdev, enum xrt_output_name name, const uni
static void
pssense_get_fusion_pose(struct pssense_device *pssense,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
out_relation->pose = pssense->pose;
@ -758,7 +758,7 @@ pssense_get_fusion_pose(struct pssense_device *pssense,
static void
pssense_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct pssense_device *pssense = (struct pssense_device *)xdev;

View file

@ -958,7 +958,7 @@ psvr_device_update_inputs(struct xrt_device *xdev)
static void
psvr_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct psvr_device *psvr = psvr_device(xdev);

View file

@ -139,7 +139,7 @@ qwerty_set_output(struct xrt_device *xd, enum xrt_output_name name, const union
static void
qwerty_get_tracked_pose(struct xrt_device *xd,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct qwerty_device *qd = qwerty_device(xd);

View file

@ -391,7 +391,7 @@ load_config(struct rs_ddev *rs)
static void
rs_ddev_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct rs_ddev *rs = rs_ddev(xdev);

View file

@ -276,7 +276,7 @@ rs_hdev_correct_pose_from_basalt(struct xrt_pose pose)
static void
rs_hdev_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct rs_hdev *rh = rs_hdev_from_xdev(xdev);

View file

@ -97,7 +97,7 @@ r_device_update_inputs(struct xrt_device *xdev)
static void
r_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct r_device *rd = r_device(xdev);

View file

@ -59,7 +59,7 @@ r_hmd_destroy(struct xrt_device *xdev)
static void
r_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct r_hmd *rh = r_hmd(xdev);

View file

@ -517,7 +517,7 @@ rift_s_controller_set_output(struct xrt_device *xdev, enum xrt_output_name name,
static void
rift_s_controller_get_fusion_pose(struct rift_s_controller *ctrl,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
out_relation->pose = ctrl->pose;
@ -541,7 +541,7 @@ rift_s_controller_get_fusion_pose(struct rift_s_controller *ctrl,
static void
rift_s_controller_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct rift_s_controller *ctrl = (struct rift_s_controller *)(xdev);

View file

@ -46,7 +46,7 @@
static void
rift_s_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct rift_s_hmd *hmd = (struct rift_s_hmd *)(xdev);

View file

@ -70,7 +70,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(rift_s_handtracking, "RIFT_S_HANDTRACKING", true)
static void
rift_s_tracker_get_tracked_pose_imu(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation);
static void
@ -611,7 +611,7 @@ rift_s_tracker_correct_pose_from_basalt(struct xrt_pose *pose)
static void
rift_s_tracker_get_tracked_pose_imu(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct rift_s_tracker *tracker = (struct rift_s_tracker *)(xdev);

View file

@ -54,7 +54,7 @@ struct rokid_fusion
struct os_mutex mutex;
struct m_imu_3dof i3dof;
struct xrt_space_relation last_relation;
uint64_t last_update;
int64_t last_update;
struct xrt_vec3 last_gyro;
struct xrt_vec3 last_accel;
uint64_t gyro_ts_device;
@ -232,7 +232,7 @@ rokid_fusion_parse_usb_packet(struct rokid_fusion *fusion, unsigned char usb_buf
static void
rokid_fusion_get_pose(struct rokid_fusion *fusion, uint64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
rokid_fusion_get_pose(struct rokid_fusion *fusion, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
{
if (at_timestamp_ns > fusion->last_update) {
double time_diff = time_ns_to_s(at_timestamp_ns - fusion->last_update);
@ -261,7 +261,7 @@ rokid_fusion_add_vars(struct rokid_fusion *fusion, void *root)
u_var_add_pose(root, &fusion->last_relation.pose, "last_pose");
u_var_add_ro_vec3_f32(root, &fusion->last_gyro, "gyro");
u_var_add_ro_vec3_f32(root, &fusion->last_accel, "accel");
u_var_add_ro_u64(root, &fusion->last_update, "timestamp");
u_var_add_ro_i64(root, &fusion->last_update, "timestamp");
}
@ -433,7 +433,7 @@ rokid_hmd_destroy(struct xrt_device *xdev)
static void
rokid_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct rokid_hmd *rokid = rokid_hmd(xdev);

View file

@ -98,7 +98,7 @@ sample_hmd_update_inputs(struct xrt_device *xdev)
static void
sample_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct sample_hmd *hmd = sample_hmd(xdev);

View file

@ -75,7 +75,7 @@ svr_hmd_destroy(struct xrt_device *xdev)
static void
svr_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct svr_hmd *ns = svr_hmd(xdev);

View file

@ -118,7 +118,7 @@ simulated_device_update_inputs(struct xrt_device *xdev)
static void
simulated_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct simulated_device *sd = simulated_device(xdev);

View file

@ -88,7 +88,7 @@ simulated_hmd_destroy(struct xrt_device *xdev)
static void
simulated_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct simulated_hmd *hmd = simulated_hmd(xdev);

View file

@ -327,7 +327,7 @@ verify_device_name(struct survive_device *survive, enum xrt_input_name name)
static void
survive_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct survive_device *survive = (struct survive_device *)xdev;

View file

@ -87,7 +87,7 @@ twrap_hmd_correct_pose_from_basalt(struct xrt_pose pose)
static void
twrap_slam_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct slam_device *dx = slam_device(xdev);

View file

@ -123,7 +123,7 @@ vive_controller_device(struct xrt_device *xdev)
static inline void
get_pose(struct vive_controller_device *d,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct xrt_space_relation imu_relation = {0};
@ -409,7 +409,7 @@ vive_controller_get_hand_tracking(struct xrt_device *xdev,
static void
vive_controller_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct vive_controller_device *d = vive_controller_device(xdev);

View file

@ -180,7 +180,7 @@ vive_device_get_slam_tracked_pose(struct xrt_device *xdev,
static void
vive_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
XRT_TRACE_MARKER();
@ -188,7 +188,7 @@ vive_device_get_tracked_pose(struct xrt_device *xdev,
struct vive_device *d = vive_device(xdev);
// Ajdust the timestamp with the offset.
at_timestamp_ns += (uint64_t)(d->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
at_timestamp_ns += (int64_t)(d->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
if (d->tracking.slam_enabled && d->slam_over_3dof) {
vive_device_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation);

View file

@ -446,7 +446,7 @@ read_controller_config(struct wmr_controller_base *wcb)
static void
wmr_controller_base_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
DRV_TRACE_MARKER();
@ -454,7 +454,7 @@ wmr_controller_base_get_tracked_pose(struct xrt_device *xdev,
struct wmr_controller_base *wcb = wmr_controller_base(xdev);
// Variables needed for prediction.
uint64_t last_imu_timestamp_ns = 0;
int64_t last_imu_timestamp_ns = 0;
struct xrt_space_relation relation = {0};
relation.relation_flags = (enum xrt_space_relation_flags)(
XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT |
@ -482,7 +482,7 @@ wmr_controller_base_get_tracked_pose(struct xrt_device *xdev,
return;
}
uint64_t prediction_ns = at_timestamp_ns - last_imu_timestamp_ns;
int64_t prediction_ns = at_timestamp_ns - last_imu_timestamp_ns;
double prediction_s = time_ns_to_s(prediction_ns);
m_predict_relation(&relation, prediction_s, out_relation);

View file

@ -1168,14 +1168,14 @@ wmr_hmd_get_slam_tracked_pose(struct xrt_device *xdev,
static void
wmr_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
DRV_TRACE_MARKER();
struct wmr_hmd *wh = wmr_hmd(xdev);
at_timestamp_ns += (uint64_t)(wh->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
at_timestamp_ns += (int64_t)(wh->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
if (wh->tracking.slam_enabled && wh->slam_over_3dof) {
wmr_hmd_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation);

View file

@ -1050,7 +1050,7 @@ xreal_air_hmd_update_inputs(struct xrt_device *xdev)
static void
xreal_air_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct xreal_air_hmd *hmd = xreal_air_hmd(xdev);

View file

@ -310,7 +310,7 @@ struct xrt_device
*/
void (*get_tracked_pose)(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation);
/*!
@ -547,7 +547,7 @@ xrt_device_update_inputs(struct xrt_device *xdev)
static inline void
xrt_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);

View file

@ -85,7 +85,7 @@ ipc_client_device_update_inputs(struct xrt_device *xdev)
static void
ipc_client_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
ipc_client_device_t *icd = ipc_client_device(xdev);

View file

@ -152,7 +152,7 @@ ipc_client_hmd_update_inputs(struct xrt_device *xdev)
static void
ipc_client_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
ipc_client_hmd_t *ich = ipc_client_hmd(xdev);

View file

@ -1854,7 +1854,7 @@ xrt_result_t
ipc_handle_device_get_tracked_pose(volatile struct ipc_client_state *ics,
uint32_t id,
enum xrt_input_name name,
uint64_t at_timestamp,
int64_t at_timestamp,
struct xrt_space_relation *out_relation)
{
// To make the code a bit more readable.

View file

@ -395,7 +395,7 @@
"in": [
{"name": "id", "type": "uint32_t"},
{"name": "name", "type": "enum xrt_input_name"},
{"name": "at_timestamp", "type": "uint64_t"}
{"name": "at_timestamp", "type": "int64_t"}
],
"out": [
{"name": "relation", "type": "struct xrt_space_relation"}

View file

@ -17,7 +17,7 @@
static void
sdl_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name,
uint64_t at_timestamp_ns,
int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation)
{
struct sdl_program *sp = from_xdev(xdev);