-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Refactors retargeters and adds Quest retargeters for G1 tasks #3950
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 |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| from abc import ABC, abstractmethod | ||
| from collections.abc import Callable | ||
| from dataclasses import dataclass, field | ||
| from enum import Enum | ||
| from typing import Any | ||
|
|
||
| from isaaclab.devices.retargeter_base import RetargeterBase, RetargeterCfg | ||
|
|
@@ -58,9 +59,13 @@ def __init__(self, retargeters: list[RetargeterBase] | None = None): | |
| """ | ||
| # Initialize empty list if None is provided | ||
| self._retargeters = retargeters or [] | ||
| # Aggregate required features across all retargeters | ||
| self._required_features = set() | ||
| for retargeter in self._retargeters: | ||
| self._required_features.update(retargeter.get_requirements()) | ||
|
|
||
| def __str__(self) -> str: | ||
| """Returns: A string containing the information of joystick.""" | ||
| """Returns: A string identifier for the device.""" | ||
| return f"{self.__class__.__name__}" | ||
|
|
||
| """ | ||
|
|
@@ -123,3 +128,32 @@ def advance(self) -> torch.Tensor: | |
| # With multiple retargeters, return a tuple of outputs | ||
| # Concatenate retargeted outputs into a single tensor | ||
| return torch.cat([retargeter.retarget(raw_data) for retargeter in self._retargeters], dim=-1) | ||
|
|
||
| # ----------------------------- | ||
| # Shared data layout helpers (for retargeters across devices) | ||
| # ----------------------------- | ||
| class TrackingTarget(Enum): | ||
|
Contributor
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. are these applicable for non-xr devices like keyboards and spacemouse?
Contributor
Author
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. Yes in the sense that by omitting some of these types from their output, they allow the retargeters to conditionally or not support certain retargeter/device configurations. IE passing a motion controller retargeter to a device that only supports HandTracking. |
||
| """Standard tracking targets shared across devices.""" | ||
|
|
||
| HAND_LEFT = 0 | ||
| HAND_RIGHT = 1 | ||
| HEAD = 2 | ||
| CONTROLLER_LEFT = 3 | ||
| CONTROLLER_RIGHT = 4 | ||
|
|
||
| class MotionControllerDataRowIndex(Enum): | ||
| """Rows in the motion-controller 2x7 array.""" | ||
|
|
||
| POSE = 0 | ||
| INPUTS = 1 | ||
|
|
||
| class MotionControllerInputIndex(Enum): | ||
| """Indices in the motion-controller input row.""" | ||
|
|
||
| THUMBSTICK_X = 0 | ||
| THUMBSTICK_Y = 1 | ||
| TRIGGER = 2 | ||
| SQUEEZE = 3 | ||
| BUTTON_0 = 4 | ||
| BUTTON_1 = 5 | ||
| PADDING = 6 | ||
Uh oh!
There was an error while loading. Please reload this page.