ShengY1fei commited on
Commit
eef1d82
·
verified ·
1 Parent(s): 5d83a94

Document imagined data format and RoboTwin2.0 schema

Browse files
Files changed (1) hide show
  1. README.md +136 -0
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Imagined Data
2
+
3
+ This repository hosts imagined interaction data generated by world models across different environments, tasks, and data sources. Data are organized into separate subdatasets, with additional types of imagined data to be added over time.
4
+
5
+ The repository currently contains only the RoboTwin2.0 subdataset. Storage formats, field definitions, and loading instructions are documented in the corresponding section for each subdataset.
6
+
7
+ ## Dataset Index
8
+
9
+ | Subdataset | Directory | Contents |
10
+ | --- | --- | --- |
11
+ | RoboTwin2.0 | `RoboTwin2.0/` | Imagined interaction segments for 50 RoboTwin 2.0 tasks |
12
+
13
+ ## RoboTwin2.0
14
+
15
+ The directory structure, field definitions, array shapes, and reading examples below apply to the data under `RoboTwin2.0/`.
16
+
17
+ The RoboTwin2.0 subdataset contains imagined interaction segments generated by a world model for 50 RoboTwin 2.0 tasks. Data are organized by task. Each HDF5 file stores one fixed-length **chunk: 21 observation frames, 20 action steps, and the corresponding rewards and episode-ending flags**.
18
+
19
+ Observations include RGB images from three camera views—head, left wrist, and right wrist—along with joint states, gripper states, and end-effector poses for both arms. Frame 0 is the initial observation of the chunk; frames 1–20 are subsequent observations generated by the world model. Each file represents an interaction segment and should not be treated as a complete episode.
20
+
21
+ ### Directory Structure
22
+
23
+ ```text
24
+ RoboTwin2.0/
25
+ ├── adjust_bottle/
26
+ │ ├── chunk_<uid>.hdf5
27
+ │ └── ...
28
+ ├── handover_block/
29
+ │ ├── chunk_<uid>.hdf5
30
+ │ └── ...
31
+ ├── place_dual_shoes/
32
+ │ └── ...
33
+ └── ... # 50 task directories in total
34
+ ```
35
+
36
+ The task directory name identifies the task, whereas the `task` field inside each file contains the natural-language instruction for that sample.
37
+
38
+ ### File Schema
39
+
40
+ Each file contains **18 HDF5 datasets** and a root attribute named `source_identity`. All dataset paths in the table below are relative to the file root. The root attribute is documented separately below.
41
+
42
+ | Field | Shape | Dtype | Description |
43
+ | --- | --- | --- | --- |
44
+ | `task` | `()` | UTF-8 string | Natural-language task instruction for the current chunk |
45
+ | `obs/head_cam/rgb` | `(21, 240, 320, 3)` | `uint8` | RGB images from the head camera |
46
+ | `obs/left_wrist_cam/rgb` | `(21, 240, 320, 3)` | `uint8` | RGB images from the left wrist camera |
47
+ | `obs/right_wrist_cam/rgb` | `(21, 240, 320, 3)` | `uint8` | RGB images from the right wrist camera |
48
+ | `obs/left_joint_pos` | `(21, 6)` | `float32` | Commanded positions of the six left-arm joints (rad) |
49
+ | `obs/right_joint_pos` | `(21, 6)` | `float32` | Commanded positions of the six right-arm joints (rad) |
50
+ | `obs/left_gripper` | `(21,)` | `float32` | Commanded opening fraction of the left gripper |
51
+ | `obs/right_gripper` | `(21,)` | `float32` | Commanded opening fraction of the right gripper |
52
+ | `obs/left_ee_pose` | `(21, 7)` | `float32` | Left-arm end-effector pose: `[x, y, z, qw, qx, qy, qz]` |
53
+ | `obs/right_ee_pose` | `(21, 7)` | `float32` | Right-arm end-effector pose: `[x, y, z, qw, qx, qy, qz]` |
54
+ | `action/left_joint_pos` | `(20, 6)` | `float64` | Raw target position commands for the six left-arm joints (rad) |
55
+ | `action/right_joint_pos` | `(20, 6)` | `float64` | Raw target position commands for the six right-arm joints (rad) |
56
+ | `action/left_gripper` | `(20,)` | `float64` | Raw action values for the left gripper |
57
+ | `action/right_gripper` | `(20,)` | `float64` | Raw action values for the right gripper |
58
+ | `rewards` | `(20,)` | `float32` | Rewards associated with the 20 action steps |
59
+ | `terminations` | `(20,)` | `bool` | Task or environment termination flags |
60
+ | `truncations` | `(20,)` | `bool` | Truncation flags, for example due to time limits |
61
+ | `dones` | `(20,)` | `bool` | `terminations OR truncations` |
62
+
63
+ #### Images
64
+
65
+ Image arrays use the **`(T, H, W, C)`** layout, with **RGB** channel order and pixel values in `0–255`. The three views are aligned at each frame index, with a resolution of 240 pixels in height and 320 pixels in width.
66
+
67
+ RGB images are stored as pixel arrays using lossless HDF5 gzip compression at level 4, with an HDF5 storage chunk shape of `(1, 240, 320, 3)`. Reading a dataset returns image arrays directly; no additional JPEG or PNG decoding is required.
68
+
69
+ #### Joint States, Gripper States, and End-Effector Poses
70
+
71
+ The joint and gripper states of both arms can be combined into a 14-dimensional vector in the following order:
72
+
73
+ ```text
74
+ [left_joint_1, ..., left_joint_6, left_gripper,
75
+ right_joint_1, ..., right_joint_6, right_gripper]
76
+ ```
77
+
78
+ `obs/*_joint_pos` and `obs/*_gripper` store the control targets used as the policy state. Row 0 is the initial state of the chunk. For the subsequent 20 rows, `obs/*_joint_pos[t+1]` is taken from the target joint angles in `action/*_joint_pos[t]`, and `obs/*_gripper[t+1]` is obtained by clipping the corresponding gripper action to `[0, 1]`. Values are stored in the dtypes listed above and have not been normalized using the policy's normalization statistics. These fields do not represent measured joint or gripper feedback after robot motion.
79
+
80
+ **For RoboTwin, the policy input state should use the joint positions and gripper states described here, not the end-effector poses.**
81
+
82
+ Gripper values follow the convention **0 = closed, 1 = open**. `action/*_gripper` retains the raw policy output, which may be slightly below 0 or above 1. Commands used for imagined execution clip gripper values to `[0, 1]`, so a gripper action may differ from the gripper state in the next frame. Joint actions specify target positions, not joint increments.
83
+
84
+ The first three components of `obs/*_ee_pose` are positions in the world coordinate frame, expressed in meters. The remaining four components form a quaternion in **`wxyz`** order. The pose reference is the URDF `link6` joint frame after RoboTwin's joint-coordinate correction, not the tool center point (TCP).
85
+
86
+ End-effector poses in generated frames come directly from the world model's predictions. During export, they are not replaced with forward kinematics computed from joint commands. Each end-effector pose field contains only the seven pose components; the separate `obs/*_gripper` fields come from the control targets described above.
87
+
88
+ ### Temporal Alignment
89
+
90
+ For `t = 0, ..., 19`:
91
+
92
+ ```text
93
+ obs[t] -- action[t] --> obs[t + 1]
94
+ │
95
+ └── rewards[t], terminations[t], truncations[t], dones[t]
96
+ ```
97
+
98
+ - `obs[0]` is the last conditioning observation for the current chunk. For the first chunk of a branch, it comes from the offline data; for subsequent chunks, it is the final observation of the preceding chunk.
99
+ - `obs[1:21]` contains the 20 subsequent observations generated for the current chunk.
100
+ - `action[t]` corresponds to the transition from `obs[t]` to `obs[t+1]`. The reward array and all three flag arrays use the same action index.
101
+
102
+ Each file therefore contains one more observation than action. The policy generates an action sequence at each chunk boundary; 21 observation frames do not imply 21 policy calls. Files also do not include the world model's complete conditioning history across multiple frames.
103
+
104
+ #### Rewards and Episode-Ending Flags
105
+
106
+ This subdataset stores the sparse binary rewards used during data generation. The first 19 reward entries in each chunk are zero, and the final entry stores the chunk's `0/1` reward. A reward model assigns this reward based on the generated observations; it is not a human annotation for each frame.
107
+
108
+ `terminations` indicates termination, and `truncations` indicates truncation. At every step:
109
+
110
+ ```python
111
+ dones = terminations | truncations
112
+ ```
113
+
114
+ The last step of a chunk does not necessarily have `done=True`: the same branch may continue with another chunk. Use the stored flags to determine episode boundaries rather than inferring them from file boundaries alone.
115
+
116
+ ### Root Attribute
117
+
118
+ The root attribute `source_identity` in each HDF5 file stores a JSON string containing three provenance fields:
119
+
120
+ ```json
121
+ {
122
+ "branch_id": "<unique imagined branch identifier>",
123
+ "chunk_index": 0,
124
+ "transition_id": "<source record identifier>"
125
+ }
126
+ ```
127
+
128
+ | Field | Description |
129
+ | --- | --- |
130
+ | `branch_id` | Identifier of the imagined rollout branch to which this chunk belongs |
131
+ | `chunk_index` | Zero-based chunk index within the branch |
132
+ | `transition_id` | Transition identifier in the original export record |
133
+
134
+ Read this attribute with `json.loads(f.attrs["source_identity"])`. It is included in the distributed HDF5 files and is not counted among the 18 datasets listed above.
135
+
136
+ To link chunks, group them by `branch_id` and sort by `chunk_index`. Concatenate chunks only when both adjacent chunks are available and their indices are consecutive. Retain the shared boundary observation between adjacent chunks only once.