This project provides tools for collecting and processing motion data from Unitree humanoid robots (G1 and H1-2). It supports loading motion sequences from TXT files and collecting real-time robot state data during motion execution using ROS2.
-
Create and activate a Conda environment:
conda create -n unitree python=3.9 conda activate unitree
-
Install ROS2 Foxy: Follow the official ROS2 Foxy installation guide
-
Install Unitree SDK: Refer to Unitree_ros2 for detailed installation instructions
-
Install required Python packages:
pip install numpy scipy joblib
For G1 robot:
python scripts/run_real.py \
--robot-name g1 \
--motion-files 'path/to/motion.txt'\
--output-folder 'path/to/output'For H1-2 robot:
python scripts/run_real.py \
--robot-name h12 \
--motion-files 'path/to/motion.txt'\
--output-folder 'path/to/output'Motion files should be in CSV format:
joint1,joint2,joint3,joint4,joint5,joint6,...
0.1,0.2,0.3,0.4,0.5,0.6,...
0.2,0.3,0.4,0.5,0.6,0.7,...
...
- First row: Joint names (varies by robot type)
- Subsequent rows: Joint angles in radians for each motion frame
- Frequency: 50Hz
The system generates CSV files for each motion:
output/
└── motion_name/
├── joint_list.txt # List of joint names
├── control.csv # Command data sent to robot
├── event.csv # Motion events and timestamps
└── state_motor.csv # Actual robot state data
- G1: Unitree G1 humanoid robot
- H1-2: Unitree H1-2 humanoid robot
- Control Frequency: 200Hz
- Motion Frequency: 50Hz
- ROS2 Topics:
/lowcmd(command),/lowstate(feedback)