Skip to content

Commit 08d2263

Browse files
authored
website 2.0: add data collection tutorial (#492)
1 parent fa6ea6b commit 08d2263

10 files changed

Lines changed: 172 additions & 1 deletion

website/docs/tutorial/data-collection.mdx

Lines changed: 172 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,175 @@ title: Data collection
33
sidebar_position: 2
44
---
55

6-
## ...
6+
```mdx-code-block
7+
import BlockImage from '@site/src/components/BlockImage';
8+
```
9+
10+
# Data collection
11+
12+
## VR setup
13+
14+
### One time setup for VR teleoperation
15+
16+
Create a [Meta Quest Developer account](https://developers.meta.com/horizon/) and install [Meta Quest Developer Hub](https://developers.meta.com/horizon/documentation/unity/ts-mqdh/).
17+
18+
Download the teleoperation APK from the releases of the companion VR package.
19+
{/* add package link */}
20+
Sideload the APK onto your Quest 3 via Developer Hub.
21+
22+
### Per-session setup
23+
24+
1. Put on the headset and launch the teleoperation app. After the app is launched, you should see the following screen in the headset.
25+
<BlockImage src="tutorial/data-collection/in_vr_default.jpg" alt="Quest headset" width="90%" />
26+
27+
2. Press the left controller menu button — a settings panel will appear.
28+
<BlockImage src="tutorial/data-collection/in_vr_setting.jpg" alt="VR menu" width="90%" />
29+
30+
3. Enter the IP address of your PC host and the port (default: `5006`).
31+
32+
4. Verify communication from the PC host:
33+
`nc -lu 5006`
34+
35+
5. Tape the center-of-eye sensor on the headset to keep it constantly activated (prevents the display from sleeping when worn at the neck).
36+
Before taping the sensor:
37+
<BlockImage src="tutorial/data-collection/headset_uncover.png" alt="Headset sensor uncovered" width="90%" />
38+
39+
After taping the sensor:
40+
<BlockImage src="tutorial/data-collection/headset_covered.png" alt="Headset sensor covered" width="90%" />
41+
42+
6. Take off the headset and hang it around your neck — you will operate with the controllers while the headset rests there.
43+
<BlockImage src="tutorial/data-collection/how_to_wear_headset.png" alt="Headset around neck" width="90%" />
44+
45+
## Data collection in MuJoCo environment
46+
47+
Even if you don't have the physical robot, you can still go through the data collection process using the MuJoCo environment.
48+
This will allow you to understand the data collection process and the data format before collecting the data on the real robot.
49+
Also, this section is useful for testing your VR teleoperation setup and to make sure that everything is working properly before collecting the data on the real robot.
50+
51+
### Setup for MuJoCo environment
52+
53+
```bash
54+
cd path/to/openarm_vr_teleop
55+
uv sync
56+
source .venv/bin/activate
57+
dora build config/dataflow-mujoco.yaml --uv
58+
```
59+
60+
### Teleoperation in MuJoCo environment
61+
62+
```bash
63+
dora run config/dataflow-mujoco.yaml --uv
64+
```
65+
66+
If VR teleoperation is working properly, you should see the robot arm moving in the MuJoCo environment when you operate the VR controllers.
67+
68+
Also, data collection web UI will open automatically, and you can check the data collection status at `http://localhost:8000`.
69+
70+
<BlockImage src="tutorial/data-collection/mujoco_datacollection.gif" alt="MuJoCo teleoperation" />
71+
72+
left: MuJoCo environment, right: data collection web UI
73+
74+
### How to control data collection with VR controllers
75+
76+
You can use button A and B on the right VR controller to control the data collection.
77+
78+
<BlockImage src="tutorial/data-collection/quest_controller_right.jpg" alt="Controller button" width="40%" />
79+
80+
After the program starts, web UI will open.
81+
Please access `http://localhost:8000` to check the data collection status and control the data collection.
82+
83+
<BlockImage src="tutorial/data-collection/data_collection_start_quit.png" alt="UI top" width="80%" />
84+
When the web UI looks like the image above, you can start the data collection by pressing the A button on the right VR controller. This will start recording the data.
85+
86+
* **A** : start recording
87+
* **B** : stop recording and quit the program
88+
89+
<BlockImage src="tutorial/data-collection/data_collection_success_fail.png" alt="UI recording" width="80%" />
90+
91+
when you start recording, the data collection will start.
92+
If you successfully complete the task, press the A button again to stop recording and mark the episode as success.
93+
If you fail the task, press the B button to stop recording and mark the episode as failure.
94+
95+
* **A** : mark as success
96+
* **B** : mark as failure
97+
98+
### Check the collected data
99+
100+
Default data path can be found in `dataflow-mujoco.yaml` `DIRECTORY: "test_data/mujoco_collection"`.
101+
If you want to change the data path, you can change the value of `DIRECTORY` in the config file.
102+
103+
```yaml
104+
- id: recorder
105+
build: pip install -e node/dora-openarm-dataset-recorder
106+
path: dora-openarm-dataset-recorder
107+
env:
108+
METADATA_FILE: "../test_metadata.yaml"
109+
DIRECTORY: "test_data/mujoco_collection"
110+
```
111+
112+
After finishing the data collection, you can check the collected data in the specified directory. The data will be stored in the OpenArmDataset format.
113+
114+
If you don't have the real robot, skip the next section and move to the dataset format conversion section to convert the collected data to the LeRobot dataset format for training the policy.
115+
116+
## Data collection on the real robot
117+
118+
First, make sure that the CAN interface is up and running and the cameras are set up properly, VR teleoperation is working. Then, run the following command to start the data collection.
119+
120+
### Start data collection
121+
122+
```bash
123+
uv run dora build config/dataflow.yaml --uv
124+
uv run dora run config/dataflow.yaml --uv
125+
```
126+
127+
Same as the MuJoCo data collection, you can specify the output directory by modifying `config/dataflow.yaml`.
128+
129+
If the command runs successfully, the arm will move to the initial position. You need to align your VR controllers to the arm first by holding the trigger button.
130+
131+
Once the alignment completes, you can fully control the arm with the VR controllers.
132+
133+
{/*
134+
add photo of the real robot data collection.
135+
*/}
136+
137+
## Dataset format conversion to LeRobot dataset format
138+
139+
After collecting the dataset, we need to convert the dataset to the LeRobot dataset format for training the policy.
140+
141+
```bash
142+
git clone https://github.com/enactic/openarm_dataset.git
143+
cd openarm_dataset
144+
uv sync
145+
uv run openarm-dataset-convert path/to/collected_dataset_path path/to/output_path --format lerobot_v2.1
146+
```
147+
148+
LeRobot Dataset v2.1 format file structure:
149+
150+
```
151+
output_path/
152+
├── data/
153+
│ ├── chunk-000/
154+
│ │ ├── episode_000000.parquet
155+
│ │ ├── episode_000001.parquet
156+
│ │ └── ...
157+
├── meta/
158+
│ ├── info.json
159+
│ ├── episodes.jsonl
160+
│ ├── episodes_stats.jsonl
161+
│ ├── tasks.jsonl
162+
│ ├── stats.jsonl
163+
├── videos/
164+
│ ├── chunk-000/
165+
│ │ ├── observation.images.wrist_right/
166+
│ │ ├── observation.images.wrist_left/
167+
│ │ ├── observation.images.ceiling/
168+
│ │ ├── observation.images.head_left/
169+
│ │ ├── observation.images.head_right/
170+
│ │ | ├── episode_000000.mp4
171+
│ │ | ├── episode_000001.mp4
172+
│ │ | └── ...
173+
```
174+
175+
We are planning to support the conversion to LeRobot Dataset v3.0 format in the future, but for now, we only support the conversion to LeRobot Dataset v2.1 format.
176+
If you want to convert to the LeRobot Dataset v3.0 format please check the article below:
177+
[LeRobot Dataset v3.0 format conversion](https://huggingface.co/docs/lerobot/porting_datasets_v3#migrating-from-dataset-v21)
316 KB
Loading
346 KB
Loading
10.6 MB
Loading
10.6 MB
Loading
12.8 MB
Loading
770 KB
Loading
341 KB
Loading
840 KB
Loading
2.05 MB
Loading

0 commit comments

Comments
 (0)