Skip to content

Commit d150481

Browse files
committed
Update timestamps to monotonic, and use Update timestamp for the mcap timestamp.
1 parent 4d030c7 commit d150481

48 files changed

Lines changed: 161 additions & 171 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/source/device/add_device.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ tensor samples from OpenXR. Implement a concrete tracker class (e.g.
117117
- **Factory registration** — Register your tracker in the live factory dispatch table
118118
(see ``LiveDeviceIOFactory``). The factory constructs an ``ITrackerImpl`` that holds
119119
a ``SchemaTracker``, builds a ``SchemaTrackerConfig`` from the tracker's stored
120-
configuration, and implements ``update(XrTime)`` and
120+
configuration, and implements ``update(int64_t monotonic_time_ns)`` and
121121
``serialize_all(channel_index, callback)``.
122122

123123
In the **Impl**:

examples/lerobot/record.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def main():
110110
try:
111111
while time.time() - start_time < 10.0:
112112
# Update session and all trackers
113-
session.update()
113+
session.update(time.monotonic_ns())
114114

115115
# Get hand data
116116
left_tracked: schema.HandPoseTrackedT = hand_tracker.get_left_hand(

examples/oxr/cpp/oxr_session_sharing.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <deviceio_trackers/hand_tracker.hpp>
66
#include <deviceio_trackers/head_tracker.hpp>
77
#include <oxr/oxr_session.hpp>
8+
#include <oxr_utils/os_time.hpp>
89

910
#include <chrono>
1011
#include <iostream>
@@ -76,8 +77,9 @@ try
7677
for (int i = 0; i < 10; ++i)
7778
{
7879
// Both sessions update using the same underlying OpenXR session
79-
session1->update();
80-
session2->update();
80+
const int64_t graph_time_ns = core::os_monotonic_now_ns();
81+
session1->update(graph_time_ns);
82+
session2->update(graph_time_ns);
8183

8284
// Get data from both trackers
8385
const auto& left_tracked = hand_tracker->get_left_hand(*session1);

examples/oxr/cpp/oxr_simple_api_demo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <deviceio_trackers/hand_tracker.hpp>
66
#include <deviceio_trackers/head_tracker.hpp>
77
#include <oxr/oxr_session.hpp>
8+
#include <oxr_utils/os_time.hpp>
89

910
#include <iostream>
1011
#include <memory>
@@ -76,7 +77,7 @@ try
7677
for (int i = 0; i < 5; ++i)
7778
{
7879
// Session handles internal update() calls to trackers
79-
session->update();
80+
session->update(core::os_monotonic_now_ns());
8081

8182
// External user only uses public query methods
8283
const auto& left_tracked = hand_tracker->get_left_hand(*session);

examples/oxr/python/modular_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def main():
6060

6161
while time.time() - start_time < 10.0:
6262
# Update session and all trackers
63-
session.update()
63+
session.update(time.monotonic_ns())
6464

6565
# Print every 60 frames (~1 second)
6666
if frame_count % 60 == 0:

examples/oxr/python/modular_example_with_mcap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def main():
7171
start_time = time.time()
7272

7373
while time.time() - start_time < 30.0:
74-
session.update()
74+
session.update(time.monotonic_ns())
7575

7676
# Print every 60 frames (~1 second)
7777
if frame_count % 60 == 0:

examples/oxr/python/test_controller_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
# Test 4: Initial update
5353
print("[Test 4] Testing initial data retrieval...")
54-
session.update()
54+
session.update(time.monotonic_ns())
5555

5656
print("✓ Update successful")
5757
print()
@@ -101,7 +101,7 @@ def assert_trackers_consistent(label, ta, tb):
101101
last_status_print = start_time
102102

103103
while time.time() - start_time < 10.0:
104-
session.update()
104+
session.update(time.monotonic_ns())
105105

106106
current_time = time.time()
107107
if current_time - last_status_print >= 0.5:

examples/oxr/python/test_extensions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
do not expose get_required_extensions().
1010
"""
1111

12+
import time
13+
1214
import isaacteleop.deviceio as deviceio
1315
import isaacteleop.oxr as oxr
1416

@@ -87,7 +89,7 @@
8789
print(" ✅ Initialized successfully")
8890

8991
# Quick update test
90-
session.update()
92+
session.update(time.monotonic_ns())
9193
left_tracked = hand.get_left_hand(session)
9294
head_tracked = head.get_head(session)
9395
print(" ✅ Update successful")

examples/oxr/python/test_full_body_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
# Test 5: Initial update
5757
print("[Test 5] Testing initial data retrieval...")
58-
session.update()
58+
session.update(time.monotonic_ns())
5959

6060
print("✓ Update successful")
6161
print()
@@ -86,7 +86,7 @@
8686
last_status_print = start_time
8787

8888
while time.time() - start_time < 10.0:
89-
session.update()
89+
session.update(time.monotonic_ns())
9090

9191
# Get current body pose
9292
current_time = time.time()

examples/oxr/python/test_hand_inactive_on_plugin_stop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
def poll_hands(hand_tracker, deviceio_session):
3131
"""Return (left_active, right_active) for the current frame."""
32-
deviceio_session.update()
32+
deviceio_session.update(time.monotonic_ns())
3333
left = hand_tracker.get_left_hand(deviceio_session)
3434
right = hand_tracker.get_right_hand(deviceio_session)
3535
return left.data is not None, right.data is not None

0 commit comments

Comments
 (0)