Browse Source

[update] readme and fix test

main
silencht 5 months ago
parent
commit
3d4aea5a34
  1. 14
      README.md
  2. 22
      test/_test_televuer.py
  3. 28
      test/_test_tv_wrapper.py

14
README.md

@ -5,6 +5,10 @@ The TeleVuer library is a specialized version of the Vuer library, designed to e
Currently, this module serves as a core component of the [xr_teleoperate](https://github.com/unitreerobotics/xr_teleoperate) library, offering advanced functionality for teleoperation tasks. It supports various XR devices, including Apple Vision Pro, Meta Quest3, Pico 4 Ultra Enterprise etc., ensuring compatibility and ease of use for robotic teleoperation applications.
## Release Note
V3.0 brings updates:
1. Added `pass_through` interface to enable/disable the pass-through mode.
2. Support `webrtc` interface to enable/disable the webrtc streaming mode.
3. Use `render_to_xr` method (adjust from `set_display_image`) to send images to XR device.
V2.0 brings updates:
@ -15,6 +19,14 @@ V2.0 brings updates:
5. Streamlined the data structure: removed the nested `TeleStateData` and return everything in the unified `TeleData`.
6. Added new image-transport interfaces such as `set_display_image`.
## Diagram
<p align="center">
<a href="https://oss-global-cdn.unitree.com/static/5ae3c9ee9a3d40dc9fe002281e8aeac1_2975x3000.png">
<img src="https://oss-global-cdn.unitree.com/static/5ae3c9ee9a3d40dc9fe002281e8aeac1_2975x3000.png" alt="Diagram" style="width: 50%;">
</a>
</p>
## Install
```bash
@ -33,7 +45,7 @@ python _test_tv_wrapper.py
# First, use Apple Vision Pro or Pico 4 Ultra Enterprise to connect to the same Wi-Fi network as your computer.
# Next, open safari / pico browser, enter https://host machine's ip:8012/?ws=wss://host machine's ip:8012
# for example, https://192.168.123.2:8012?ws=wss://192.168.123.2:8012
# Use the appropriate method (hand gesture or controller) to click the "Virtual Reality" button in the bottom-left corner of the screen.
# Use the appropriate method (hand gesture or controller) to click the "pass-through" button in the bottom-left corner of the screen.
# Press Enter in the terminal to launch the program.
```

22
test/_test_televuer.py

@ -6,38 +6,19 @@ if project_root not in sys.path:
import time
from televuer import TeleVuer
# image client. if you want to test with real image stream,
# please copy image_client.py and messaging.py from xr_teleoperate/teleop/image_server to the current directory before running this test script
# from image_client import ImageClient
import logging_mp
logger_mp = logging_mp.get_logger(__name__, level=logging_mp.INFO)
def run_test_TeleVuer():
head_binocular = True
head_img_shape = (480, 1280, 3) # default image
# img_client = ImageClient(host="127.0.0.1") # 127.0.0.1 is localhost, 192.168.123.164 is unitree robot's host ip
# if not img_client.has_head_cam():
# logger_mp.error("Head camera is required. Please enable head camera on the image server side.")
# head_img_shape = img_client.get_head_shape()
# head_binocular = img_client.is_binocular()
# xr-mode
use_hand_track = True
use_image = True
webrtc = True
tv = TeleVuer(binocular = head_binocular, use_hand_tracking = use_hand_track, img_shape = head_img_shape,
use_image=use_image, webrtc=webrtc)
tv = TeleVuer(use_hand_tracking = use_hand_track, pass_through=True)
try:
input("Press Enter to start TeleVuer test...")
running = True
while running:
start_time = time.time()
# image client
# head_img, head_img_fps = img_client.get_head_frame()
# tv.set_display_image(head_img)
logger_mp.info("=" * 80)
logger_mp.info("Common Data (always available):")
logger_mp.info(f"head_pose shape: {tv.head_pose.shape}\n{tv.head_pose}\n")
@ -89,7 +70,6 @@ def run_test_TeleVuer():
logger_mp.warning("KeyboardInterrupt, exiting program...")
finally:
tv.close()
# img_client.close()
logger_mp.warning("Finally, exiting program...")
exit(0)

28
test/_test_tv_wrapper.py

@ -6,40 +6,29 @@ if project_root not in sys.path:
import time
from televuer import TeleVuerWrapper
# image client. if you want to test with real image stream,
# please copy image_client.py and messaging.py from xr_teleoperate/teleop/image_server to the current directory before running this test script
# from image_client import ImageClient
import logging_mp
logger_mp = logging_mp.get_logger(__name__, level=logging_mp.INFO)
def run_test_tv_wrapper():
head_binocular = True
head_img_shape = (480, 1280, 3) # default image shape
# img_client = ImageClient(host="127.0.0.1") # 127.0.0.1 is localhost, 192.168.123.164 is unitree robot's host ip
# if not img_client.has_head_cam():
# logger_mp.error("Head camera is required. Please enable head camera on the image server side.")
# head_img_shape = img_client.get_head_shape()
# head_binocular = img_client.is_binocular()
# xr-mode
use_hand_track=False
use_image=True
webrtc=True
tv_wrapper = TeleVuerWrapper(binocular=head_binocular, use_hand_tracking=use_hand_track, img_shape=head_img_shape, return_hand_rot_data = True,
use_image=use_image, webrtc=webrtc)
tv_wrapper = TeleVuerWrapper(use_hand_tracking=use_hand_track, pass_through=True, return_hand_rot_data=False,
# binocular=False, img_shape=(480, 1280, 3),
# webrtc=False, webrtc_url="https://127.0.0.1:60001/offer"
)
try:
input("Press Enter to start tv_wrapper test...")
running = True
while running:
start_time = time.time()
# image client
# head_img, head_img_fps = img_client.get_head_frame()
# tv_wrapper.set_display_image(head_img)
logger_mp.info("---- TV Wrapper TeleData ----")
teleData = tv_wrapper.get_tele_data()
# import cv2
# img = cv2.videoCapture(0).read()[1]
# tv_wrapper.render_to_xr(img)
logger_mp.info("-------------------=== TeleData Snapshot ===-------------------")
logger_mp.info(f"[Head Pose]:\n{teleData.head_pose}")
logger_mp.info(f"[Left Wrist Pose]:\n{teleData.left_wrist_pose}")
@ -82,7 +71,6 @@ def run_test_tv_wrapper():
logger_mp.warning("KeyboardInterrupt, exiting program...")
finally:
tv_wrapper.close()
# img_client.close()
logger_mp.warning("Finally, exiting program...")
exit(0)

Loading…
Cancel
Save