shengda / robot_low_dim_FORMAT.md
SnoopyFan's picture
Add files using upload-large-folder tool
9e5e87b verified
|
Raw
History Blame Contribute Delete
5.38 kB

Allegro 配对数据 — robot_low_dim PKL 格式说明

本目录下的 robot_low_dim/*.pkl 为双臂 Allegro 灵巧手操作的 低维轨迹,与 robot_video/ 中同名视频逐帧对齐,用于 imitation / 行为克隆等任务。

导出脚本:spider/examples/export_mjwp_lowdim_per_view.py


目录结构

allegro_paired_data/
├── robot_low_dim/          # 本说明所描述的 .pkl
│   └── {task}-allegro-view{00,01,02}.pkl
├── robot_video/            # 配对 RGB 视频(同名 stem)
│   └── {task}-allegro-view{00,01,02}.mp4
└── robot_low_dim_FORMAT.md # 本文件

命名规则{sample}-{robot_type}-view{VV}.pkl,例如 p001-folder-0049-allegro-view01.pkl

  • sample:任务 ID,如 p001-folder-0049
  • robot_type:固定为 allegro
  • view00 / 01 / 02 三个相机视角

同一 sample 下,**action / state / time / chosen_video_frames 在三个 view 的 pkl 中完全相同**;仅 viewsource_video 不同。


PKL 逻辑结构(示例:p001-folder-0049-allegro-view01.pkl

p001-folder-0049-allegro-view01.pkl
│
├─ meta: task, trial, view=1, robot_type, seq_id, num_frames
├─ timing: sim_dt, ref_dt, ctrl_dt, ref_steps, ctrl_steps
│
├─ trajectory[N]                    # N = num_frames,与视频帧数一致
│   ├─ action[r, 0:44]            ← trajectory_mjwp.npz 的 ctrl[k, j]
│   ├─ state[r, 0:44]             ← qpos[k, j, :44]
│   ├─ time[r]                    ← time[k, j](秒)
│   └─ chosen_video_frames[r]     ← 人类演示视频的原始帧号
│
├─ names[44]: action_names == state_names   # MuJoCo joint 名
└─ provenance: source_npz, source_video     # 溯源路径(view01)

顶层为 Python dict,共 19 个键。


字段一览

元数据 meta

类型 说明 示例
task str 任务 / sample 名 "p001-folder-0049"
trial str trial 子目录名 "0"
view int 相机视角索引 1 → view01
robot_type str 机器人类型 "allegro"
seq_id int 从 task 末尾解析的序列号 49
num_frames int 轨迹行数 = 视频帧数 190

时间配置 timing

类型 典型值 含义
sim_dt float 0.005 MuJoCo 仿真步长 (s)
ref_dt float 0.04 参考 / 视频采样间隔 (s),25 Hz
ctrl_dt float 0.2 控制 knot 周期 (s)
ref_steps int 8 round(ref_dt / sim_dt)
ctrl_steps int 40 round(ctrl_dt / sim_dt)

轨迹数组 trajectory

shape dtype 含义
action (N, 44) float64 位置控制器的目标 ctrl
state (N, 44) float64 仿真关节位置 qpos 前 44 维
time (N,) float64 该帧对应的仿真时间 (s)
chosen_video_frames (N,) int32 对齐的人类演示原始帧 ID
  • actionstate 相近:action 为控制目标,state 为积分后的 qpos
  • r 行与 robot_video 中同名视频的 r 对齐。

维度名称 names

类型 说明
action_names list[str],长度 44 state_names 完全相同
state_names list[str],长度 44 MuJoCo <actuator joint="..."> 的关节名

顺序与 assets/robots/allegro/right.xmlleft.xml<actuator> 块一致(右手 22 + 左手 22),非字母序

溯源 provenance

类型 说明
source_npz str 源轨迹 .../{task}/{trial}/trajectory_mjwp.npz
source_video str 源渲染视频 .../output_mjwp_rgb_view{VV}.mp4

44 维关节名(action_names / state_names

[ 0- 5] 右手基座: right_pos_x, right_pos_y, right_pos_z, right_rot_x, right_rot_y, right_rot_z
[ 6- 9] 右手食指: right_index_base_joint … right_index_distal_joint
[10-13] 右手中指: right_middle_*_joint
[14-17] 右手无名指: right_ring_*_joint
[18-21] 右手拇指: right_thumb_*_joint
[22-27] 左手基座: left_pos_x … left_rot_z
[28-31] 左手无名指: left_ring_*_joint
[32-35] 左手中指: left_middle_*_joint
[36-39] 左手食指: left_index_*_joint
[40-43] 左手拇指: left_thumb_*_joint

完整列表见导出脚本 ACTION_STATE_JOINT_NAMESexport_mjwp_lowdim_per_view.py)。


帧索引:视频行 r → NPZ (k, j)

render_mjwp_textured_video.py 相同:

s = round(r * ref_steps)
k = s // ctrl_steps
j = s % ctrl_steps

action[r] = ctrl[k, j]
state[r]  = qpos[k, j, :44]
time[r]   = time[k, j]
r (k, j) 说明
0 (0, 0) 第一视频帧
1 (0, 8) 每隔 ref_steps=8 个子步采样
2 (0, 16)

源 NPZ 形状(典型):ctrl (K, 40, 44)qpos (K, 40, 58)time (K, 40)


robot_video 的配对关系

低维 视频
robot_low_dim/p001-folder-0049-allegro-view01.pkl robot_video/p001-folder-0049-allegro-view01.mp4

同一 stem、同一 num_frames;训练时按行索引 r 同时索引 pkl 与视频帧即可。