Commit e6ed2b8e authored by chengronglai's avatar chengronglai Committed by Kelly Guo

Updates xr teleop scripts (#193)

# Description

* Add starting view port so the user can start the xr teleop right at
the ideal position to do the stacking task
* Set the XR anchormode to active camera
* Set default renderer to RTX - RealTime to avoid extra step in
operation

## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent cb1e29ad
......@@ -11,6 +11,7 @@ from scipy.spatial.transform import Rotation, Slerp
from typing import Final
import carb
from omni.kit.viewport.utility import get_active_viewport
from ..device_base import DeviceBase
......@@ -65,6 +66,11 @@ class Se3HandTracking(DeviceBase):
self._alpha_rot = 0.5
self._smoothed_delta_pos = np.zeros(3)
self._smoothed_delta_rot = np.zeros(3)
# Set the XR anchormode to active camera
carb.settings.get_settings().set_string("/xrstage/profile/ar/anchorMode", "active camera")
# Select RTX - RealTime for Renderer
viewport_api = get_active_viewport()
viewport_api.set_hd_engine("rtx", "RaytracedLighting")
def __del__(self):
return
......
......@@ -26,14 +26,11 @@ AppLauncher.add_app_launcher_args(parser)
# parse the arguments
args_cli = parser.parse_args()
app_launcher_args = {}
app_launcher_args = vars(args_cli)
if args_cli.teleop_device.lower() == "handtracking":
app_launcher_args = {
"experience": f'{os.environ["ISAACLAB_PATH"]}/source/apps/isaaclab.python.xr.openxr.kit',
}
app_launcher_args["experience"] = f'{os.environ["ISAACLAB_PATH"]}/source/apps/isaaclab.python.xr.openxr.kit'
# launch omniverse app
app_launcher = AppLauncher(app_launcher_args, headless=args_cli.headless)
app_launcher = AppLauncher(app_launcher_args)
simulation_app = app_launcher.app
"""Rest everything follows."""
......@@ -45,6 +42,8 @@ import torch
import omni.log
from omni.isaac.lab.devices import Se3Gamepad, Se3HandTracking, Se3Keyboard, Se3SpaceMouse
from omni.isaac.lab.envs import ViewerCfg
from omni.isaac.lab.envs.ui import ViewportCameraController
from omni.isaac.lab.managers import TerminationTermCfg as DoneTerm
import omni.isaac.lab_tasks # noqa: F401
......@@ -106,6 +105,8 @@ def main():
teleop_interface = Se3HandTracking(OpenXRSpec.XrHandEXT.XR_HAND_RIGHT_EXT, False)
teleop_interface.add_callback("RESET", env.reset)
viewer = ViewerCfg(eye=(-0.25, -0.3, 0.5), lookat=(0.6, 0, 0), asset_name="viewer")
ViewportCameraController(env, viewer)
else:
raise ValueError(f"Invalid device interface '{args_cli.teleop_device}'. Supported: 'keyboard', 'spacemouse'.")
......
......@@ -59,7 +59,9 @@ import time
import torch
from omni.isaac.lab.devices import Se3HandTracking, Se3Keyboard, Se3SpaceMouse
from omni.isaac.lab.envs import ViewerCfg
from omni.isaac.lab.envs.mdp.recorders.recorders_cfg import ActionStateRecorderManagerCfg
from omni.isaac.lab.envs.ui import ViewportCameraController
import omni.isaac.lab_tasks # noqa: F401
from omni.isaac.lab_tasks.utils.parse_cfg import parse_env_cfg
......@@ -155,6 +157,8 @@ def main():
teleop_interface = Se3HandTracking(OpenXRSpec.XrHandEXT.XR_HAND_RIGHT_EXT, False, True)
teleop_interface.add_callback("RESET", reset_recording_instance)
viewer = ViewerCfg(eye=(-0.25, -0.3, 0.5), lookat=(0.6, 0, 0), asset_name="viewer")
ViewportCameraController(env, viewer)
else:
raise ValueError(
f"Invalid device interface '{args_cli.teleop_device}'. Supported: 'keyboard', 'spacemouse', 'handtracking'."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment