Browse Source

[update] pem path

main
silencht 4 months ago
parent
commit
bac8da8a4b
  1. 87
      README.md
  2. 27
      src/televuer/televuer.py
  3. 2
      src/televuer/tv_wrapper.py
  4. 0
      test/test_televuer.py
  5. 0
      test/test_tv_wrapper.py

87
README.md

@ -1,13 +1,10 @@
# TeleVuer # TeleVuer
The TeleVuer library is a specialized version of the Vuer library, designed to enable XR device-based teleoperation of Unitree Robotics robots. This library acts as a wrapper for Vuer, providing additional adaptations specifically tailored for Unitree Robotics. By integrating XR device capabilities, such as hand tracking and controller tracking, TeleVuer facilitates seamless interaction and control of robotic systems in immersive environments.
The TeleVuer library is a specialized version of the [Vuer](https://github.com/vuer-ai/vuer) library, designed to enable XR device-based teleoperation of Unitree Robotics robots. This library acts as a wrapper for Vuer, providing additional adaptations specifically tailored for Unitree Robotics. By integrating XR device capabilities, such as hand tracking and controller tracking, TeleVuer facilitates seamless interaction and control of robotic systems in immersive environments.
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. 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 ## Release Note
V4.0 brings updates:
0. Fix bugs.
V3.0 brings updates: V3.0 brings updates:
1. Added `pass_through` interface to enable/disable the pass-through mode. 1. Added `pass_through` interface to enable/disable the pass-through mode.
2. Support `webrtc` interface to enable/disable the webrtc streaming mode. 2. Support `webrtc` interface to enable/disable the webrtc streaming mode.
@ -22,7 +19,7 @@ V2.0 brings updates:
5. Streamlined the data structure: removed the nested `TeleStateData` and return everything in the unified `TeleData`. 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`. 6. Added new image-transport interfaces such as `set_display_image`.
## Diagram
## 1. Diagram
<p align="center"> <p align="center">
<a href="https://oss-global-cdn.unitree.com/static/5ae3c9ee9a3d40dc9fe002281e8aeac1_2975x3000.png"> <a href="https://oss-global-cdn.unitree.com/static/5ae3c9ee9a3d40dc9fe002281e8aeac1_2975x3000.png">
@ -30,20 +27,88 @@ V2.0 brings updates:
</a> </a>
</p> </p>
## Install
## 2. Install
### 2.1 Install televuer repository
```bash ```bash
git clone https://github.com/silencht/televuer
cd televuer cd televuer
pip install -e .
pip install -e . # or pip install .
```
### 2.2 Generate Certificate Files
The televuer module requires SSL certificates to allow XR devices (such as Pico / Quest / Apple Vision Pro) to connect securely via HTTPS / WebRTC.
1. For Pico / Quest XR Devices
```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
# Check the Generated Files
$ ls
build cert.pem key.pem LICENSE pyproject.toml README.md src test
```
2. For Apple Vision Pro
```bash
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 365 -out rootCA.pem -subj "/CN=xr-teleoperate"
openssl genrsa -out key.pem 2048
openssl req -new -key key.pem -out server.csr -subj "/CN=localhost"
vim server_ext.cnf
# Add the following content (make sure IP.2 matches your host machine’s IP address, which you can find with ifconfig or similar):
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
IP.1 = 192.168.123.164
IP.2 = 192.168.123.2
# Then sign the certificate:
openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out cert.pem -days 365 -sha256 -extfile server_ext.cnf
# Check the Generated Files
$ ls
build cert.pem key.pem LICENSE pyproject.toml README.md rootCA.key rootCA.pem rootCA.srl server.csr server_ext.cnf src test
# Use AirDrop to copy rootCA.pem to your Apple Vision Pro device and install it manually as a trusted certificate.
```
3. Allow Firewall Access
```bash
sudo ufw allow 8012
```
### 2.3 Configure Certificate Paths (Choose One Method)
You can tell televuer where to find the certificate files using either environment variables or a user config directory.
1. Environment Variable Configuration (Optional)
```bash
# This makes the configuration persistent for future terminal sessions.
echo 'export XR_TELEOP_CERT="your_file_path/cert.pem"' >> ~/.bashrc
echo 'export XR_TELEOP_KEY="your_file_path/key.pem"' >> ~/.bashrc
source ~/.bashrc
``` ```
2. User Configuration Directory (Optional)
```bash
# this repo belongs to xr_teleoperate, so we use its config dir
mkdir -p ~/.config/xr_teleoperate/
cp cert.pem key.pem ~/.config/xr_teleoperate/
```
3. Default Behavior
If neither of the above methods is used, televuer will look for the certificate files from the function parameters or fall back to the default paths within the module.
## Test
## 3. Test
```bash ```bash
python _test_televuer.py
python test_televuer.py
# or # or
python _test_tv_wrapper.py
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. # 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 # Next, open safari / pico browser, enter https://host machine's ip:8012/?ws=wss://host machine's ip:8012
@ -53,7 +118,7 @@ python _test_tv_wrapper.py
# Press Enter in the terminal to launch the program. # Press Enter in the terminal to launch the program.
``` ```
## Version History
## 4. Version History
`vuer==0.0.32rc7` `vuer==0.0.32rc7`

27
src/televuer/televuer.py

@ -11,7 +11,7 @@ from pathlib import Path
class TeleVuer: class TeleVuer:
def __init__(self, use_hand_tracking: bool, pass_through:bool=False, binocular: bool=True, img_shape: tuple=None, def __init__(self, use_hand_tracking: bool, pass_through:bool=False, binocular: bool=True, img_shape: tuple=None,
cert_file=None, key_file=None, webrtc: bool=False, webrtc_url: str=None, display_fps: float=30.0):
cert_file: str=None, key_file: str=None, webrtc: bool=False, webrtc_url: str=None, display_fps: float=30.0):
""" """
TeleVuer class for OpenXR-based XR teleoperate applications. TeleVuer class for OpenXR-based XR teleoperate applications.
This class handles the communication with the Vuer server and manages image and pose data. This class handles the communication with the Vuer server and manages image and pose data.
@ -46,11 +46,28 @@ class TeleVuer:
self.img_width = self.img_shape[1] self.img_width = self.img_shape[1]
self.aspect_ratio = self.img_width / self.img_height self.aspect_ratio = self.img_width / self.img_height
# SSL certificate path resolution
env_cert = os.getenv("XR_TELEOP_CERT")
env_key = os.getenv("XR_TELEOP_KEY")
if cert_file is None or key_file is None:
# 1.Try environment variables
if env_cert and env_key:
cert_file = cert_file or env_cert
key_file = key_file or env_key
else:
# 2.Try ~/.config/xr_teleoperate/
user_conf_dir = Path.home() / ".config" / "xr_teleoperate"
cert_path_user = user_conf_dir / "cert.pem"
key_path_user = user_conf_dir / "key.pem"
if cert_path_user.exists() and key_path_user.exists():
cert_file = cert_file or str(cert_path_user)
key_file = key_file or str(key_path_user)
else:
# 3.Fallback to package root (current logic)
current_module_dir = Path(__file__).resolve().parent.parent.parent current_module_dir = Path(__file__).resolve().parent.parent.parent
if cert_file is None:
cert_file = os.path.join(current_module_dir, "cert.pem")
if key_file is None:
key_file = os.path.join(current_module_dir, "key.pem")
cert_file = cert_file or str(current_module_dir / "cert.pem")
key_file = key_file or str(current_module_dir / "key.pem")
self.vuer = Vuer(host='0.0.0.0', cert=cert_file, key=key_file, queries=dict(grid=False), queue_len=3) self.vuer = Vuer(host='0.0.0.0', cert=cert_file, key=key_file, queries=dict(grid=False), queue_len=3)
self.vuer.add_handler("CAMERA_MOVE")(self.on_cam_move) self.vuer.add_handler("CAMERA_MOVE")(self.on_cam_move)

2
src/televuer/tv_wrapper.py

@ -194,7 +194,7 @@ class TeleData:
class TeleVuerWrapper: class TeleVuerWrapper:
def __init__(self, use_hand_tracking: bool, pass_through: bool=False, binocular: bool=True, img_shape: tuple=(480, 1280), def __init__(self, use_hand_tracking: bool, pass_through: bool=False, binocular: bool=True, img_shape: tuple=(480, 1280),
cert_file = None, key_file = None, webrtc: bool=False, webrtc_url: str=None, display_fps: float=30.0,
cert_file: str=None, key_file: str=None, webrtc: bool=False, webrtc_url: str=None, display_fps: float=30.0,
return_hand_rot_data: bool=False): return_hand_rot_data: bool=False):
""" """
TeleVuerWrapper is a wrapper for the TeleVuer class, which handles XR device's data suit for robot control. TeleVuerWrapper is a wrapper for the TeleVuer class, which handles XR device's data suit for robot control.

0
test/_test_televuer.py → test/test_televuer.py

0
test/_test_tv_wrapper.py → test/test_tv_wrapper.py

Loading…
Cancel
Save