-
Notifications
You must be signed in to change notification settings - Fork 15
Add monotonic update time to deviceIO, refactor get extensions. #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,7 +110,7 @@ def main(): | |
| try: | ||
| while time.time() - start_time < 10.0: | ||
| # Update session and all trackers | ||
| if not session.update(): | ||
| if not session.update(time.monotonic_ns()): | ||
| print("Update failed") | ||
| break | ||
|
|
||
|
|
@@ -130,13 +130,13 @@ def main(): | |
| right_pos = np.zeros(3, dtype=np.float32) | ||
|
|
||
| if left_tracked.data is not None and left_tracked.data.joints: | ||
| wrist = left_tracked.data.joints.poses(deviceio.JOINT_WRIST) | ||
| wrist = left_tracked.data.joints.poses(deviceio.HandJoint.WRIST) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apply ruff formatting for wrist pose calls to unblock CI. Pre-commit reports this file is reformatted by 🧹 Formatter-aligned shape- wrist = left_tracked.data.joints.poses(deviceio.HandJoint.WRIST)
+ wrist = left_tracked.data.joints.poses(
+ deviceio.HandJoint.WRIST
+ )
- wrist = right_tracked.data.joints.poses(deviceio.HandJoint.WRIST)
+ wrist = right_tracked.data.joints.poses(
+ deviceio.HandJoint.WRIST
+ )Also applies to: 139-139 🤖 Prompt for AI Agents |
||
| if wrist.is_valid: | ||
| pos = wrist.pose.position | ||
| left_pos = np.array([pos.x, pos.y, pos.z], dtype=np.float32) | ||
|
|
||
| if right_tracked.data is not None and right_tracked.data.joints: | ||
| wrist = right_tracked.data.joints.poses(deviceio.JOINT_WRIST) | ||
| wrist = right_tracked.data.joints.poses(deviceio.HandJoint.WRIST) | ||
| if wrist.is_valid: | ||
| pos = wrist.pose.position | ||
| right_pos = np.array( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |||||||||||||||||||||||||||||||||||
| Useful when creating external OpenXR sessions. | ||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import time | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| import isaacteleop.deviceio as deviceio | ||||||||||||||||||||||||||||||||||||
| import isaacteleop.oxr as oxr | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -87,12 +89,12 @@ | |||||||||||||||||||||||||||||||||||
| print(" ✅ Initialized successfully") | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| # Quick update test | ||||||||||||||||||||||||||||||||||||
| if session.update(): | ||||||||||||||||||||||||||||||||||||
| if session.update(time.monotonic_ns()): | ||||||||||||||||||||||||||||||||||||
| left_tracked = hand.get_left_hand(session) | ||||||||||||||||||||||||||||||||||||
| head_tracked = head.get_head(session) | ||||||||||||||||||||||||||||||||||||
| print(" ✅ Update successful") | ||||||||||||||||||||||||||||||||||||
| if left_tracked.data is not None: | ||||||||||||||||||||||||||||||||||||
| pos = left_tracked.data.joints.poses(deviceio.JOINT_WRIST).pose.position | ||||||||||||||||||||||||||||||||||||
| pos = left_tracked.data.joints.poses(deviceio.HandJoint.WRIST).pose.position | ||||||||||||||||||||||||||||||||||||
| print(f" Left wrist: [{pos.x:.3f}, {pos.y:.3f}, {pos.z:.3f}]") | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+92
to
98
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting issue flagged by CI pipeline. The changes correctly pass the monotonic timestamp to 🔧 Suggested fix for formatting if left_tracked.data is not None:
- pos = left_tracked.data.joints.poses(deviceio.HandJoint.WRIST).pose.position
+ pos = left_tracked.data.joints.poses(
+ deviceio.HandJoint.WRIST
+ ).pose.position
print(f" Left wrist: [{pos.x:.3f}, {pos.y:.3f}, {pos.z:.3f}]")📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: Run linters using pre-commit[error] 94-96: ruff format modified formatting in this file (ruff-format reformatted 3 files). Formatter changed 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||
| print(" Left hand: inactive") | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -86,11 +86,12 @@ | |||||||||||||
| try: | ||||||||||||||
| while time.time() - start_time < 5.0: | ||||||||||||||
| # Both sessions update using the same underlying OpenXR session | ||||||||||||||
| if not session1.update(): | ||||||||||||||
| now_ns = time.monotonic_ns() | ||||||||||||||
| if not session1.update(now_ns): | ||||||||||||||
| print("Session 1 update failed") | ||||||||||||||
| break | ||||||||||||||
|
|
||||||||||||||
| if not session2.update(): | ||||||||||||||
| if not session2.update(now_ns): | ||||||||||||||
| print("Session 2 update failed") | ||||||||||||||
| break | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -104,7 +105,7 @@ | |||||||||||||
|
|
||||||||||||||
| print(f"[{elapsed:4.1f}s] Frame {frame_count:3d}:") | ||||||||||||||
| if left_tracked.data is not None: | ||||||||||||||
| pos = left_tracked.data.joints.poses(deviceio.JOINT_WRIST).pose.position | ||||||||||||||
| pos = left_tracked.data.joints.poses(deviceio.HandJoint.WRIST).pose.position | ||||||||||||||
| print(f" Left wrist: [{pos.x:6.3f}, {pos.y:6.3f}, {pos.z:6.3f}]") | ||||||||||||||
|
Comment on lines
+108
to
109
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Formatting issue flagged by CI pipeline. The logic correctly uses 🔧 Suggested fix for formatting if left_tracked.data is not None:
- pos = left_tracked.data.joints.poses(deviceio.HandJoint.WRIST).pose.position
+ pos = left_tracked.data.joints.poses(
+ deviceio.HandJoint.WRIST
+ ).pose.position
print(f" Left wrist: [{pos.x:6.3f}, {pos.y:6.3f}, {pos.z:6.3f}]")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| else: | ||||||||||||||
| print(" Left hand: inactive") | ||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.