Skip to content

Commit e755e24

Browse files
committed
Add monotonic update time to deviceIO
Move extension requirements from ITracker to live impls Extension knowledge is an OpenXR live-session concern, not a tracker concern. Remove get_required_extensions() from ITracker and deviceio_trackers. Each LiveXxxTrackerImpl now declares its own static required_extensions(), and LiveDeviceIOFactory aggregates them via dynamic_cast dispatch. DeviceIOSession::get_required_extensions() delegates to the factory.
1 parent a17e89f commit e755e24

File tree

77 files changed

+403
-219
lines changed

Some content is hidden

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

77 files changed

+403
-219
lines changed

docs/source/device/add_device.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ the collection and prints samples. Pattern (see :code-file:`examples/schemaio/pe
157157
2. Get required extensions with ``DeviceIOSession::get_required_extensions(trackers)`` and
158158
create an ``OpenXRSession``.
159159
3. Create a ``DeviceIOSession`` with ``DeviceIOSession::run(trackers, oxr_session->get_handles())``.
160-
4. Loop: call ``session->update()``, then read ``tracker->get_data(*session)``. If
160+
4. Loop: call ``session->update(core::os_monotonic_now_ns())``, then read ``tracker->get_data(*session)``. If
161161
``tracked.data`` is non-null, use the latest sample; otherwise sleep briefly and repeat.
162162

163163
Use the same ``collection_id`` (and optionally ``tensor_identifier``) as the plugin. See

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-
if not session.update():
113+
if not session.update(time.monotonic_ns()):
114114
print("Update failed")
115115
break
116116

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 <time_utils/os_time.hpp>
89

910
#include <chrono>
1011
#include <iostream>
@@ -76,13 +77,14 @@ try
7677
for (int i = 0; i < 10; ++i)
7778
{
7879
// Both sessions update using the same underlying OpenXR session
79-
if (!session1->update())
80+
const int64_t now_ns = core::os_monotonic_now_ns();
81+
if (!session1->update(now_ns))
8082
{
8183
std::cerr << "Session 1 update failed" << std::endl;
8284
break;
8385
}
8486

85-
if (!session2->update())
87+
if (!session2->update(now_ns))
8688
{
8789
std::cerr << "Session 2 update failed" << std::endl;
8890
break;

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 <time_utils/os_time.hpp>
89

910
#include <iostream>
1011
#include <memory>
@@ -75,7 +76,7 @@ try
7576
for (int i = 0; i < 5; ++i)
7677
{
7778
// Session handles internal update() calls to trackers
78-
if (!session->update())
79+
if (!session->update(core::os_monotonic_now_ns()))
7980
{
8081
std::cerr << "Update failed" << std::endl;
8182
break;

examples/oxr/python/modular_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def main():
6161
try:
6262
while time.time() - start_time < 10.0:
6363
# Update session and all trackers
64-
if not session.update():
64+
if not session.update(time.monotonic_ns()):
6565
print("Update failed")
6666
break
6767

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
@@ -52,7 +52,7 @@
5252

5353
# Test 4: Initial update
5454
print("[Test 4] Testing initial data retrieval...")
55-
if not session.update():
55+
if not session.update(time.monotonic_ns()):
5656
print("❌ Update failed")
5757
sys.exit(1)
5858

@@ -105,7 +105,7 @@ def assert_trackers_consistent(label, ta, tb):
105105

106106
try:
107107
while time.time() - start_time < 10.0:
108-
if not session.update():
108+
if not session.update(time.monotonic_ns()):
109109
print("Update failed")
110110
break
111111

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
Useful when creating external OpenXR sessions.
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-
if session.update():
92+
if 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
@@ -57,7 +57,7 @@
5757

5858
# Test 5: Initial update
5959
print("[Test 5] Testing initial data retrieval...")
60-
if not session.update():
60+
if not session.update(time.monotonic_ns()):
6161
print("❌ Update failed")
6262
sys.exit(1)
6363

@@ -92,7 +92,7 @@
9292
last_status_print = start_time
9393

9494
while time.time() - start_time < 10.0:
95-
if not session.update():
95+
if not session.update(time.monotonic_ns()):
9696
print("Update failed")
9797
break
9898

examples/oxr/python/test_hand_inactive_on_plugin_stop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def poll_hands(hand_tracker, deviceio_session):
3737
Raises UpdateFailedError if the underlying DeviceIOSession update fails so
3838
callers can distinguish a session error from genuine hand inactivity.
3939
"""
40-
if not deviceio_session.update():
40+
if not deviceio_session.update(time.monotonic_ns()):
4141
raise UpdateFailedError("deviceio_session.update() returned False")
4242
left = hand_tracker.get_left_hand(deviceio_session)
4343
right = hand_tracker.get_right_hand(deviceio_session)

0 commit comments

Comments
 (0)