Download real/README.md from Tinghong-Ye22/code-Psi0-yth-v21: direct link, hf CLI and curl.
- Browser
- Download file 7.58 kB
-
https://huggingface.co/Tinghong-Ye22/code-Psi0-yth-v21/resolve/main/real/README.md
- Command line
-
hf download hf://Tinghong-Ye22/code-Psi0-yth-v21/real/README.md
-
curl -L -o README.md https://huggingface.co/Tinghong-Ye22/code-Psi0-yth-v21/resolve/main/real/README.md
Introduction
This module contains the real-world deployment and data collection pipeline for Ψ₀.
Environment Setup
1. Create Conda Environment (Host only)
Create the conda environment from the provided YAML file. This installs all required dependencies, including inverse kinematics libraries and CUDA bindings.
conda env create -f psi_deploy_env.yaml
Activate the environment
conda activate psi_deploy
2. Install Unitree SDK2 (Python)
Clone and install our modified version of the Unitree SDK2 Python package:
git clone git@github.com:physical-superintelligence-lab/unitree_sdk2_python.git
cd unitree_sdk2_python
pip install -e .
cd ..
3. Install Local Package
pip install -e .
Ψ₀ Real-World Deployment
Image Server (Robot only)
On G1's PC, install the image server's requirements
conda create -n vision python=3.8
conda activate vision
pip install pyrealsense2 opencv-python zmq numpy
Copy realsense_server.py in the real/teleop/image_server directory to the PC of Unitree G_1, and execute the following command in the PC:
conda activate vision
python realsense_server.py
Start Client (Host only)
conda activate psi_deploy
cd real
bash ./scripts/deploy_psi0-rtc.sh
Teleoperation System Setup
Apple Vision Pro (AVP) Setup Local streaming (Host and AVP)
Apple does not allow WebXR on non-https connections. To test the application locally, we need to create a self-signed certificate and install it on the client. You need a ubuntu machine and a router. Connect the VisionPro and the ubuntu machine to the same router.
- install mkcert: https://github.com/FiloSottile/mkcert
- check local ip address:
ifconfig | grep inet
Suppose the local ip address of the ubuntu machine is 192.168.123.2
- create certificate:
mkcert -install && mkcert -cert-file cert.pem -key-file key.pem 192.168.123.2 localhost 127.0.0.1
ps. place the generated cert.pem and key.pem files in teleop.
cp cert.pem key.pem teleop/
- open firewall on server:
sudo ufw allow 8012
- install ca-certificates on VisionPro:
mkcert -CAROOT
Copy the rootCA.pem via AirDrop to VisionPro and install it.
Settings > General > About > Certificate Trust Settings. Under "Enable full trust for root certificates", turn on trust for the certificate.
settings > Apps > Safari > Advanced > Feature Flags > Enable WebXR Related Features
open the browser on Safari on VisionPro and go to https://192.168.123.2:8012?ws=wss://192.168.123.2:8012
Click
Enter VRandAllowto start the VR session.
PICO Only Setup Local streaming
- install PICO streaming python sdk on your host machine (Please follow TWIST2 related commands as follows)
conda activate psi_deploy
git clone https://github.com/YanjieZe/XRoboToolkit-PC-Service-Pybind.git
cd XRoboToolkit-PC-Service-Pybind
mkdir -p tmp
cd tmp
git clone https://github.com/XR-Robotics/XRoboToolkit-PC-Service.git
cd XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK
bash build.sh
cd ../../../..
mkdir -p lib
mkdir -p include
cp tmp/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK/PXREARobotSDK.h include/
cp -r tmp/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK/nlohmann include/nlohmann/
cp tmp/XRoboToolkit-PC-Service/RoboticsService/PXREARobotSDK/build/libPXREARobotSDK.so lib/
# rm -rf tmp
# Build the project
conda install -c conda-forge pybind11
pip uninstall -y xrobotoolkit_sdk
python setup.py install
follow the “Install XRoboToolkit-PC-Service” instructions from XR Robotics to install the PICO service on your workstation.
install PICO SDK on your PICO.
connect your PICO and workstation using the same WIFI. Suppose PICO IP is
192.168.0.128, Host IP is192.168.0.110
select
Head,ControllerandHandunder the Tracking Session, and then enable theSendSwitch.select
ZEDMINIunder the Remote Vision Session and click theListenbutton, then input your PC IP inside.put down pico controllers and wait until PICO activates its hand tracking mode automatically (You can see virtual hands around your own hands).
Start Teleoperation and Data Collection
Image Server (Robot only)
conda activate vision
python realsense_server.py
Data collection metadata preparation (Host only)
- Write down the task information in a json file inside
teleop/task_defsdirectory - In the
teleop/directory, runpython taskcreator.pyto generate the task metadata. Take a look atteleop/task_defs/example.jsonfor an example task's json format.
Teleoperating Data Collection Instruction
Warning : All persons must maintain an adequate safety distance from the robot to avoid danger!
- Connect your host computer to G1. Then, set up your local IP address to 192.168.123.123 with netmask 255.255.255.0 on G1's network interface.
- Connect both your computer and AVP to the same local router wifi in which you set up your cert with.
- Open robot and set to development mode using remote control by pressing L2 + B, then L2 + R2 (For some robots with lower software versions might need to press L1 + A and the L2 + R2).
- Hang the robot so that G1 is gently touching the ground.
- On G1 PC: start the image server as above.
- On host computer: run
export CYCLONEDDS_URI="<CycloneDDS><Domain><General><NetworkInterfaceAddress>192.168.123.123</NetworkInterfaceAddress></General></Domain></CycloneDDS>"
- (Vision Pro Option) On host computer: run
python main.py --robot g1under theteleop/directory and wait until the robot is standing in ready state. The terminal should signal both "master" and "worker" processes are waiting for starting signal. - On AVP, connect to robot using https://:8012/?ws=wss://:8012. Then, press
Enter VRand thenAllowto enter the web interface for teleoperating the G1. - (PICO Option) On host computer: run
python main.py --robot g1 --pico_streamer --pico_ip 192.168.0.128 (YOUR_PICO_IP)under theteleop/directory and wait until the robot is standing in ready state. The terminal should signal both "master" and "worker" processes are waiting for starting signal. - Back on host computer, enter
sto start recording an episode. - Type
qand enter if the episode is successful, otherwisedand enter to discard the last session. - Repeat by pressing
sto start recording the next episode. Record 40 episodes for each task. - Type
exitto shut down the program.
Acknowledgement
This code builds upon following open-source code-bases. Please visit the URLs to see the respective LICENSES:
- https://github.com/unitreerobotics/avp_teleoperate
- https://github.com/OpenTeleVision/TeleVision
- https://github.com/dexsuite/dex-retargeting
- https://github.com/vuer-ai/vuer
- https://github.com/stack-of-tasks/pinocchio
- https://github.com/casadi/casadi
- https://github.com/meshcat-dev/meshcat-python
- https://github.com/zeromq/pyzmq
- https://github.com/unitreerobotics/unitree_dds_wrapper
- https://github.com/tonyzhaozh/act
- https://github.com/facebookresearch/detr
- https://github.com/OpenTeleVision/AMO