From d5ba6eec5bde9b94670cd98636c6a6997cf6963c Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Thu, 1 Aug 2024 16:14:23 -0400 Subject: [PATCH] xrt: use int64_t for timestamp in get_tracked_pose Part-of: --- src/xrt/drivers/android/android_sensors.c | 2 +- src/xrt/drivers/arduino/arduino_device.c | 2 +- src/xrt/drivers/daydream/daydream_device.c | 2 +- src/xrt/drivers/euroc/euroc_device.c | 2 +- src/xrt/drivers/hdk/hdk_device.cpp | 2 +- src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp | 10 +++++----- src/xrt/drivers/hydra/hydra_driver.c | 2 +- src/xrt/drivers/multi_wrapper/multi.c | 2 +- src/xrt/drivers/north_star/ns_hmd.c | 2 +- src/xrt/drivers/ohmd/oh_device.c | 2 +- src/xrt/drivers/psmv/psmv_driver.c | 2 +- src/xrt/drivers/pssense/pssense_driver.c | 4 ++-- src/xrt/drivers/psvr/psvr_device.c | 2 +- src/xrt/drivers/qwerty/qwerty_device.c | 2 +- src/xrt/drivers/realsense/rs_ddev.c | 2 +- src/xrt/drivers/realsense/rs_hdev.c | 2 +- src/xrt/drivers/remote/r_device.c | 2 +- src/xrt/drivers/remote/r_hmd.c | 2 +- src/xrt/drivers/rift_s/rift_s_controller.c | 4 ++-- src/xrt/drivers/rift_s/rift_s_hmd.c | 2 +- src/xrt/drivers/rift_s/rift_s_tracker.c | 4 ++-- src/xrt/drivers/rokid/rokid_hmd.c | 8 ++++---- src/xrt/drivers/sample/sample_hmd.c | 2 +- src/xrt/drivers/simula/svr_hmd.c | 2 +- src/xrt/drivers/simulated/simulated_controller.c | 2 +- src/xrt/drivers/simulated/simulated_hmd.c | 2 +- src/xrt/drivers/survive/survive_driver.c | 2 +- src/xrt/drivers/twrap/twrap_slam.c | 2 +- src/xrt/drivers/vive/vive_controller.c | 4 ++-- src/xrt/drivers/vive/vive_device.c | 4 ++-- src/xrt/drivers/wmr/wmr_controller_base.c | 6 +++--- src/xrt/drivers/wmr/wmr_hmd.c | 4 ++-- src/xrt/drivers/xreal_air/xreal_air_hmd.c | 2 +- src/xrt/include/xrt/xrt_device.h | 4 ++-- src/xrt/ipc/client/ipc_client_device.c | 2 +- src/xrt/ipc/client/ipc_client_hmd.c | 2 +- src/xrt/ipc/server/ipc_server_handler.c | 2 +- src/xrt/ipc/shared/proto.json | 2 +- src/xrt/targets/sdl_test/sdl_device.c | 2 +- 39 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/xrt/drivers/android/android_sensors.c b/src/xrt/drivers/android/android_sensors.c index ba3d6ef95..9678060a9 100644 --- a/src/xrt/drivers/android/android_sensors.c +++ b/src/xrt/drivers/android/android_sensors.c @@ -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; diff --git a/src/xrt/drivers/arduino/arduino_device.c b/src/xrt/drivers/arduino/arduino_device.c index 83d456084..9841c1147 100644 --- a/src/xrt/drivers/arduino/arduino_device.c +++ b/src/xrt/drivers/arduino/arduino_device.c @@ -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); diff --git a/src/xrt/drivers/daydream/daydream_device.c b/src/xrt/drivers/daydream/daydream_device.c index 88c39e6fe..497880516 100644 --- a/src/xrt/drivers/daydream/daydream_device.c +++ b/src/xrt/drivers/daydream/daydream_device.c @@ -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); diff --git a/src/xrt/drivers/euroc/euroc_device.c b/src/xrt/drivers/euroc/euroc_device.c index 5148ee17a..91668039e 100644 --- a/src/xrt/drivers/euroc/euroc_device.c +++ b/src/xrt/drivers/euroc/euroc_device.c @@ -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); diff --git a/src/xrt/drivers/hdk/hdk_device.cpp b/src/xrt/drivers/hdk/hdk_device.cpp index 4b4d651a1..97acdf6e0 100644 --- a/src/xrt/drivers/hdk/hdk_device.cpp +++ b/src/xrt/drivers/hdk/hdk_device.cpp @@ -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); diff --git a/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp b/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp index a0b224603..ce96d419c 100644 --- a/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp +++ b/src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp @@ -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); diff --git a/src/xrt/drivers/hydra/hydra_driver.c b/src/xrt/drivers/hydra/hydra_driver.c index 6d71edca5..74ef1b741 100644 --- a/src/xrt/drivers/hydra/hydra_driver.c +++ b/src/xrt/drivers/hydra/hydra_driver.c @@ -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); diff --git a/src/xrt/drivers/multi_wrapper/multi.c b/src/xrt/drivers/multi_wrapper/multi.c index b4e303d90..60e1b8d34 100644 --- a/src/xrt/drivers/multi_wrapper/multi.c +++ b/src/xrt/drivers/multi_wrapper/multi.c @@ -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; diff --git a/src/xrt/drivers/north_star/ns_hmd.c b/src/xrt/drivers/north_star/ns_hmd.c index 82da90b9a..9f2092341 100644 --- a/src/xrt/drivers/north_star/ns_hmd.c +++ b/src/xrt/drivers/north_star/ns_hmd.c @@ -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); diff --git a/src/xrt/drivers/ohmd/oh_device.c b/src/xrt/drivers/ohmd/oh_device.c index 121999cde..a4510d234 100644 --- a/src/xrt/drivers/ohmd/oh_device.c +++ b/src/xrt/drivers/ohmd/oh_device.c @@ -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); diff --git a/src/xrt/drivers/psmv/psmv_driver.c b/src/xrt/drivers/psmv/psmv_driver.c index e970cd071..e0a4750a0 100644 --- a/src/xrt/drivers/psmv/psmv_driver.c +++ b/src/xrt/drivers/psmv/psmv_driver.c @@ -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}; diff --git a/src/xrt/drivers/pssense/pssense_driver.c b/src/xrt/drivers/pssense/pssense_driver.c index 383140a1a..fafe523d8 100644 --- a/src/xrt/drivers/pssense/pssense_driver.c +++ b/src/xrt/drivers/pssense/pssense_driver.c @@ -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; diff --git a/src/xrt/drivers/psvr/psvr_device.c b/src/xrt/drivers/psvr/psvr_device.c index d96fde923..c7ca9f58a 100644 --- a/src/xrt/drivers/psvr/psvr_device.c +++ b/src/xrt/drivers/psvr/psvr_device.c @@ -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); diff --git a/src/xrt/drivers/qwerty/qwerty_device.c b/src/xrt/drivers/qwerty/qwerty_device.c index 51439b49d..ea0d29159 100644 --- a/src/xrt/drivers/qwerty/qwerty_device.c +++ b/src/xrt/drivers/qwerty/qwerty_device.c @@ -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); diff --git a/src/xrt/drivers/realsense/rs_ddev.c b/src/xrt/drivers/realsense/rs_ddev.c index 7d99399d7..02d00e1d4 100644 --- a/src/xrt/drivers/realsense/rs_ddev.c +++ b/src/xrt/drivers/realsense/rs_ddev.c @@ -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); diff --git a/src/xrt/drivers/realsense/rs_hdev.c b/src/xrt/drivers/realsense/rs_hdev.c index 74095b2f3..c43d0b899 100644 --- a/src/xrt/drivers/realsense/rs_hdev.c +++ b/src/xrt/drivers/realsense/rs_hdev.c @@ -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); diff --git a/src/xrt/drivers/remote/r_device.c b/src/xrt/drivers/remote/r_device.c index 63f68abef..03ed6a882 100644 --- a/src/xrt/drivers/remote/r_device.c +++ b/src/xrt/drivers/remote/r_device.c @@ -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); diff --git a/src/xrt/drivers/remote/r_hmd.c b/src/xrt/drivers/remote/r_hmd.c index 1e77c7893..fc341b4b7 100644 --- a/src/xrt/drivers/remote/r_hmd.c +++ b/src/xrt/drivers/remote/r_hmd.c @@ -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); diff --git a/src/xrt/drivers/rift_s/rift_s_controller.c b/src/xrt/drivers/rift_s/rift_s_controller.c index 33bfc5819..7b2f7561a 100644 --- a/src/xrt/drivers/rift_s/rift_s_controller.c +++ b/src/xrt/drivers/rift_s/rift_s_controller.c @@ -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); diff --git a/src/xrt/drivers/rift_s/rift_s_hmd.c b/src/xrt/drivers/rift_s/rift_s_hmd.c index c28ee74de..de60d7588 100644 --- a/src/xrt/drivers/rift_s/rift_s_hmd.c +++ b/src/xrt/drivers/rift_s/rift_s_hmd.c @@ -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); diff --git a/src/xrt/drivers/rift_s/rift_s_tracker.c b/src/xrt/drivers/rift_s/rift_s_tracker.c index 40f286c85..532313fc5 100644 --- a/src/xrt/drivers/rift_s/rift_s_tracker.c +++ b/src/xrt/drivers/rift_s/rift_s_tracker.c @@ -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); diff --git a/src/xrt/drivers/rokid/rokid_hmd.c b/src/xrt/drivers/rokid/rokid_hmd.c index 1943cd9e5..e28368751 100644 --- a/src/xrt/drivers/rokid/rokid_hmd.c +++ b/src/xrt/drivers/rokid/rokid_hmd.c @@ -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); diff --git a/src/xrt/drivers/sample/sample_hmd.c b/src/xrt/drivers/sample/sample_hmd.c index def7d2775..205f09a8c 100644 --- a/src/xrt/drivers/sample/sample_hmd.c +++ b/src/xrt/drivers/sample/sample_hmd.c @@ -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); diff --git a/src/xrt/drivers/simula/svr_hmd.c b/src/xrt/drivers/simula/svr_hmd.c index 3e6d4d5bb..57904c663 100644 --- a/src/xrt/drivers/simula/svr_hmd.c +++ b/src/xrt/drivers/simula/svr_hmd.c @@ -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); diff --git a/src/xrt/drivers/simulated/simulated_controller.c b/src/xrt/drivers/simulated/simulated_controller.c index 1e395d040..e5fba51ba 100644 --- a/src/xrt/drivers/simulated/simulated_controller.c +++ b/src/xrt/drivers/simulated/simulated_controller.c @@ -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); diff --git a/src/xrt/drivers/simulated/simulated_hmd.c b/src/xrt/drivers/simulated/simulated_hmd.c index dbfdbde63..81d6ecf49 100644 --- a/src/xrt/drivers/simulated/simulated_hmd.c +++ b/src/xrt/drivers/simulated/simulated_hmd.c @@ -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); diff --git a/src/xrt/drivers/survive/survive_driver.c b/src/xrt/drivers/survive/survive_driver.c index 8bcc41db4..c4e200053 100644 --- a/src/xrt/drivers/survive/survive_driver.c +++ b/src/xrt/drivers/survive/survive_driver.c @@ -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; diff --git a/src/xrt/drivers/twrap/twrap_slam.c b/src/xrt/drivers/twrap/twrap_slam.c index e528fb17f..379c07579 100644 --- a/src/xrt/drivers/twrap/twrap_slam.c +++ b/src/xrt/drivers/twrap/twrap_slam.c @@ -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); diff --git a/src/xrt/drivers/vive/vive_controller.c b/src/xrt/drivers/vive/vive_controller.c index 8d1e0769d..8b457b449 100644 --- a/src/xrt/drivers/vive/vive_controller.c +++ b/src/xrt/drivers/vive/vive_controller.c @@ -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); diff --git a/src/xrt/drivers/vive/vive_device.c b/src/xrt/drivers/vive/vive_device.c index 252bc34fc..2929b0677 100644 --- a/src/xrt/drivers/vive/vive_device.c +++ b/src/xrt/drivers/vive/vive_device.c @@ -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); diff --git a/src/xrt/drivers/wmr/wmr_controller_base.c b/src/xrt/drivers/wmr/wmr_controller_base.c index dd627e74c..5520611cc 100644 --- a/src/xrt/drivers/wmr/wmr_controller_base.c +++ b/src/xrt/drivers/wmr/wmr_controller_base.c @@ -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); diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index 0ef8ba45c..59bd5b819 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -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); diff --git a/src/xrt/drivers/xreal_air/xreal_air_hmd.c b/src/xrt/drivers/xreal_air/xreal_air_hmd.c index 8a6b886ef..220342b07 100644 --- a/src/xrt/drivers/xreal_air/xreal_air_hmd.c +++ b/src/xrt/drivers/xreal_air/xreal_air_hmd.c @@ -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); diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index b9cec163a..a13ee2344 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -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); diff --git a/src/xrt/ipc/client/ipc_client_device.c b/src/xrt/ipc/client/ipc_client_device.c index 16de7c859..656d8847d 100644 --- a/src/xrt/ipc/client/ipc_client_device.c +++ b/src/xrt/ipc/client/ipc_client_device.c @@ -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); diff --git a/src/xrt/ipc/client/ipc_client_hmd.c b/src/xrt/ipc/client/ipc_client_hmd.c index deff671a5..c9b7e7704 100644 --- a/src/xrt/ipc/client/ipc_client_hmd.c +++ b/src/xrt/ipc/client/ipc_client_hmd.c @@ -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); diff --git a/src/xrt/ipc/server/ipc_server_handler.c b/src/xrt/ipc/server/ipc_server_handler.c index ddc57063c..0826b9d40 100644 --- a/src/xrt/ipc/server/ipc_server_handler.c +++ b/src/xrt/ipc/server/ipc_server_handler.c @@ -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. diff --git a/src/xrt/ipc/shared/proto.json b/src/xrt/ipc/shared/proto.json index d305bde84..2d84f2eb8 100644 --- a/src/xrt/ipc/shared/proto.json +++ b/src/xrt/ipc/shared/proto.json @@ -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"} diff --git a/src/xrt/targets/sdl_test/sdl_device.c b/src/xrt/targets/sdl_test/sdl_device.c index 210887af8..db9c85ddc 100644 --- a/src/xrt/targets/sdl_test/sdl_device.c +++ b/src/xrt/targets/sdl_test/sdl_device.c @@ -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);