Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +1 -0
- README.md +33 -0
- data/chunk-000/file-000.parquet +3 -0
- episode_mapping.json +1010 -0
- meta/episodes/chunk-000/file-000.parquet +3 -0
- meta/info.json +175 -0
- meta/stats.json +858 -0
- meta/tasks.parquet +3 -0
- provenance/camera_audit_hook.py +76 -0
- provenance/export_lerobot_completed.py +237 -0
- provenance/generation_code/h_s0_1/grader.py +89 -0
- provenance/generation_code/h_s0_1/scene.py +450 -0
- provenance/generation_code/h_s0_1/strategy/SUMMARY.txt +1 -0
- provenance/generation_code/h_s0_1/strategy/meta.json +9 -0
- provenance/generation_code/h_s0_1/strategy/parameters.json +10 -0
- provenance/generation_code/h_s0_1/strategy/solve.py +173 -0
- provenance/generation_code/h_s0_2/grader.py +89 -0
- provenance/generation_code/h_s0_2/scene.py +450 -0
- provenance/generation_code/h_s0_2/strategy/SUMMARY.txt +1 -0
- provenance/generation_code/h_s0_2/strategy/meta.json +9 -0
- provenance/generation_code/h_s0_2/strategy/parameters.json +10 -0
- provenance/generation_code/h_s0_2/strategy/solve.py +173 -0
- provenance/generation_code/h_s0_3/grader.py +89 -0
- provenance/generation_code/h_s0_3/scene.py +450 -0
- provenance/generation_code/h_s0_3/strategy/SUMMARY.txt +1 -0
- provenance/generation_code/h_s0_3/strategy/meta.json +10 -0
- provenance/generation_code/h_s0_3/strategy/parameters.json +10 -0
- provenance/generation_code/h_s0_3/strategy/solve.py +173 -0
- provenance/generation_code/p01_scene/grader.py +89 -0
- provenance/generation_code/p01_scene/scene.py +450 -0
- provenance/generation_code/p01_scene/strategy/SUMMARY.txt +1 -0
- provenance/generation_code/p01_scene/strategy/meta.json +7 -0
- provenance/generation_code/p01_scene/strategy/parameters.json +10 -0
- provenance/generation_code/p01_scene/strategy/solve.py +173 -0
- provenance/generation_code/p02_strategy/grader.py +89 -0
- provenance/generation_code/p02_strategy/scene.py +450 -0
- provenance/generation_code/p02_strategy/strategy/SUMMARY.txt +1 -0
- provenance/generation_code/p02_strategy/strategy/meta.json +7 -0
- provenance/generation_code/p02_strategy/strategy/parameters.json +10 -0
- provenance/generation_code/p02_strategy/strategy/phases/phase_0/SUMMARY.txt +1 -0
- provenance/generation_code/p02_strategy/strategy/phases/phase_0/meta.json +7 -0
- provenance/generation_code/p02_strategy/strategy/phases/phase_0/parameters.json +10 -0
- provenance/generation_code/p02_strategy/strategy/phases/phase_0/reset/preinsert.py +15 -0
- provenance/generation_code/p02_strategy/strategy/phases/phase_0/reset/start.py +12 -0
- provenance/generation_code/p02_strategy/strategy/phases/phase_0/solve_by_phase.py +178 -0
- provenance/generation_code/p02_strategy/strategy/solve.py +178 -0
- provenance/generation_code/p03_dynamics/grader.py +89 -0
- provenance/generation_code/p03_dynamics/scene.py +450 -0
- provenance/generation_code/p03_dynamics/strategy/SUMMARY.txt +1 -0
- provenance/generation_code/p03_dynamics/strategy/meta.json +7 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
provenance/lerobot_render8_camera_frames.jsonl filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
显卡安装 LeRobot 小数据集(用户提前停止扩增后的已完成部分)
|
| 2 |
+
|
| 3 |
+
dataset/ 是可独立移动的 LeRobot 数据根目录,使用官方 LeRobotDataset 创建并重新加载验证。
|
| 4 |
+
LeRobot Python 包:0.6.2;数据格式:v3.0。
|
| 5 |
+
共 8 个 episode,10020 帧,15Hz,front+wrist 双相机 RGB 320×240。
|
| 6 |
+
一条动作只有一套视觉画面;没有生成20条或60组,不宣称五阶段扩增已全部完成。
|
| 7 |
+
|
| 8 |
+
observation.state:7个臂关节角(rad)+夹爪闭合度 1-mean(clip(finger_q/.04,0,1))。
|
| 9 |
+
action:源NPZ的干净OSC8命令原样复制:3平移增量、3旋转轴角增量、2手指绝对位置(m)。
|
| 10 |
+
前6维通过对应控制器的比例/滤波解释,不应直接当作末端绝对位姿。
|
| 11 |
+
complementary_info.action_noise:实际施加的加性命令扰动。
|
| 12 |
+
complementary_info.executed_action:action+action_noise;之后仍经过原控制器。
|
| 13 |
+
源NPZ、完整控制器元信息、阶段入口、实际相机内外参和代码快照一起保留。
|
| 14 |
+
|
| 15 |
+
使用:
|
| 16 |
+
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
| 17 |
+
ds = LeRobotDataset('local/pc_gpu_data_engine_8_osc_15hz', root='/替换成你的绝对路径/dataset', video_backend='pyav')
|
| 18 |
+
print(len(ds), ds[0]['action'], ds[0]['observation.images.front'].shape)
|
| 19 |
+
|
| 20 |
+
数据格式可用于LeRobot,但未训练模型。与新RAW OSC8模型更接近;复用模型前仍需核对
|
| 21 |
+
控制器比例/滤波、图像尺寸和相机分布。不能直接用于旧430条的关节目标动作模型。
|
| 22 |
+
本小批次没有划分训练/验证集;meta/stats.json由本数据计算。
|
| 23 |
+
|
| 24 |
+
8条源轨迹均通过在线安装、松手和5秒稳定检查。其中1条从真实运行到插入前的状态开始记录;
|
| 25 |
+
其他7条为完整起点。引擎会裁掉部分成功等待尾段,所以保存的视频不一定包含最后5秒保持。
|
| 26 |
+
视频是已记录状态的渲染,不是动作开环回放验证;腕部有正常的显卡局部遮挡。
|
| 27 |
+
相机是本项目声明的视角,不声称与作者历史数据相机完全一致。
|
| 28 |
+
8条是有限样本,不能当作论文或VLA模型成功率。
|
| 29 |
+
|
| 30 |
+
episode_mapping.json:每条数据对应的源轨迹、策略、seed、阶段和控制器。
|
| 31 |
+
validation_report.json:全部数值行对齐,以及官方加载器实际读取双相机的验证。
|
| 32 |
+
source_trajectories/:原始NPZ和元数据。
|
| 33 |
+
provenance/:精确生成代码、日志、渲染参数和逐帧相机记录。
|
data/chunk-000/file-000.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:368875649cd3ca2b32dbf57e768a6b293ad5191a1a431c2170ee875bff52c2ba
|
| 3 |
+
size 1356632
|
episode_mapping.json
ADDED
|
@@ -0,0 +1,1010 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"episode_index": 0,
|
| 4 |
+
"source_episode": "data/h_s0_1/ep_0000",
|
| 5 |
+
"cell": "scene_1/strategy_0",
|
| 6 |
+
"seed": 101,
|
| 7 |
+
"entry": null,
|
| 8 |
+
"frames": 1350,
|
| 9 |
+
"controller": {
|
| 10 |
+
"class": "FrankaRobot",
|
| 11 |
+
"leaves": [
|
| 12 |
+
{
|
| 13 |
+
"class": "OperationalSpaceController",
|
| 14 |
+
"control_period": 16,
|
| 15 |
+
"control_dt": 0.06666666666666667,
|
| 16 |
+
"cfg": {
|
| 17 |
+
"dt": 0.06666666666666667,
|
| 18 |
+
"ee_body": "panda_hand",
|
| 19 |
+
"arm_joint_names": [
|
| 20 |
+
"panda_joint[1-7]"
|
| 21 |
+
],
|
| 22 |
+
"task_prop_gains": [
|
| 23 |
+
100.0,
|
| 24 |
+
100.0,
|
| 25 |
+
100.0,
|
| 26 |
+
30.0,
|
| 27 |
+
30.0,
|
| 28 |
+
30.0
|
| 29 |
+
],
|
| 30 |
+
"task_deriv_gains": [],
|
| 31 |
+
"pos_scale": 0.02,
|
| 32 |
+
"rot_scale": 0.097,
|
| 33 |
+
"unidirectional_rot": false,
|
| 34 |
+
"ema_factor": 0.2,
|
| 35 |
+
"nullspace_dof_pos": [
|
| 36 |
+
-1.3003,
|
| 37 |
+
-0.4015,
|
| 38 |
+
1.1791,
|
| 39 |
+
-2.1493,
|
| 40 |
+
0.4001,
|
| 41 |
+
1.9425,
|
| 42 |
+
0.4754
|
| 43 |
+
],
|
| 44 |
+
"kp_null": 10.0,
|
| 45 |
+
"kd_null": 6.3246,
|
| 46 |
+
"torque_limit": 100.0
|
| 47 |
+
},
|
| 48 |
+
"kp": [
|
| 49 |
+
100.0,
|
| 50 |
+
100.0,
|
| 51 |
+
100.0,
|
| 52 |
+
30.0,
|
| 53 |
+
30.0,
|
| 54 |
+
30.0
|
| 55 |
+
],
|
| 56 |
+
"kd": [
|
| 57 |
+
20.0,
|
| 58 |
+
20.0,
|
| 59 |
+
20.0,
|
| 60 |
+
10.954451560974121,
|
| 61 |
+
10.954451560974121,
|
| 62 |
+
10.954451560974121
|
| 63 |
+
],
|
| 64 |
+
"q_default": [
|
| 65 |
+
-1.3003000020980835,
|
| 66 |
+
-0.40149998664855957,
|
| 67 |
+
1.1791000366210938,
|
| 68 |
+
-2.1493000984191895,
|
| 69 |
+
0.4000999927520752,
|
| 70 |
+
1.9424999952316284,
|
| 71 |
+
0.47540000081062317
|
| 72 |
+
]
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"class": "JointController",
|
| 76 |
+
"control_period": 16,
|
| 77 |
+
"control_dt": 0.06666666666666667,
|
| 78 |
+
"cfg": {
|
| 79 |
+
"dt": 0.06666666666666667,
|
| 80 |
+
"joint_names": [
|
| 81 |
+
"panda_finger_joint.*"
|
| 82 |
+
],
|
| 83 |
+
"scale": 1.0,
|
| 84 |
+
"offset": 0.0
|
| 85 |
+
}
|
| 86 |
+
}
|
| 87 |
+
],
|
| 88 |
+
"joint_names": [
|
| 89 |
+
"panda_joint1",
|
| 90 |
+
"panda_joint2",
|
| 91 |
+
"panda_joint3",
|
| 92 |
+
"panda_joint4",
|
| 93 |
+
"panda_joint5",
|
| 94 |
+
"panda_joint6",
|
| 95 |
+
"panda_joint7",
|
| 96 |
+
"panda_finger_joint1",
|
| 97 |
+
"panda_finger_joint2"
|
| 98 |
+
],
|
| 99 |
+
"joint_stiffness": [
|
| 100 |
+
0.0,
|
| 101 |
+
0.0,
|
| 102 |
+
0.0,
|
| 103 |
+
0.0,
|
| 104 |
+
0.0,
|
| 105 |
+
0.0,
|
| 106 |
+
0.0,
|
| 107 |
+
2000.0,
|
| 108 |
+
2000.0
|
| 109 |
+
],
|
| 110 |
+
"joint_damping": [
|
| 111 |
+
0.0,
|
| 112 |
+
0.0,
|
| 113 |
+
0.0,
|
| 114 |
+
0.0,
|
| 115 |
+
0.0,
|
| 116 |
+
0.0,
|
| 117 |
+
0.0,
|
| 118 |
+
100.0,
|
| 119 |
+
100.0
|
| 120 |
+
]
|
| 121 |
+
},
|
| 122 |
+
"source_trajectory_sha256": "5b3eb381fd8cae17d2a518056b242dd78b2b95bff631a1e9f8b0b50e9ca0be16",
|
| 123 |
+
"perturbed_rows": 0,
|
| 124 |
+
"source_split_group": "5b3eb381fd8cae17d2a518056b242dd78b2b95bff631a1e9f8b0b50e9ca0be16",
|
| 125 |
+
"success": true,
|
| 126 |
+
"replay_checked": false
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"episode_index": 1,
|
| 130 |
+
"source_episode": "data/h_s0_2/ep_0000",
|
| 131 |
+
"cell": "scene_1/strategy_0",
|
| 132 |
+
"seed": 102,
|
| 133 |
+
"entry": null,
|
| 134 |
+
"frames": 1350,
|
| 135 |
+
"controller": {
|
| 136 |
+
"class": "FrankaRobot",
|
| 137 |
+
"leaves": [
|
| 138 |
+
{
|
| 139 |
+
"class": "OperationalSpaceController",
|
| 140 |
+
"control_period": 16,
|
| 141 |
+
"control_dt": 0.06666666666666667,
|
| 142 |
+
"cfg": {
|
| 143 |
+
"dt": 0.06666666666666667,
|
| 144 |
+
"ee_body": "panda_hand",
|
| 145 |
+
"arm_joint_names": [
|
| 146 |
+
"panda_joint[1-7]"
|
| 147 |
+
],
|
| 148 |
+
"task_prop_gains": [
|
| 149 |
+
100.0,
|
| 150 |
+
100.0,
|
| 151 |
+
100.0,
|
| 152 |
+
30.0,
|
| 153 |
+
30.0,
|
| 154 |
+
30.0
|
| 155 |
+
],
|
| 156 |
+
"task_deriv_gains": [],
|
| 157 |
+
"pos_scale": 0.02,
|
| 158 |
+
"rot_scale": 0.097,
|
| 159 |
+
"unidirectional_rot": false,
|
| 160 |
+
"ema_factor": 0.2,
|
| 161 |
+
"nullspace_dof_pos": [
|
| 162 |
+
-1.3003,
|
| 163 |
+
-0.4015,
|
| 164 |
+
1.1791,
|
| 165 |
+
-2.1493,
|
| 166 |
+
0.4001,
|
| 167 |
+
1.9425,
|
| 168 |
+
0.4754
|
| 169 |
+
],
|
| 170 |
+
"kp_null": 10.0,
|
| 171 |
+
"kd_null": 6.3246,
|
| 172 |
+
"torque_limit": 100.0
|
| 173 |
+
},
|
| 174 |
+
"kp": [
|
| 175 |
+
100.0,
|
| 176 |
+
100.0,
|
| 177 |
+
100.0,
|
| 178 |
+
30.0,
|
| 179 |
+
30.0,
|
| 180 |
+
30.0
|
| 181 |
+
],
|
| 182 |
+
"kd": [
|
| 183 |
+
20.0,
|
| 184 |
+
20.0,
|
| 185 |
+
20.0,
|
| 186 |
+
10.954451560974121,
|
| 187 |
+
10.954451560974121,
|
| 188 |
+
10.954451560974121
|
| 189 |
+
],
|
| 190 |
+
"q_default": [
|
| 191 |
+
-1.3003000020980835,
|
| 192 |
+
-0.40149998664855957,
|
| 193 |
+
1.1791000366210938,
|
| 194 |
+
-2.1493000984191895,
|
| 195 |
+
0.4000999927520752,
|
| 196 |
+
1.9424999952316284,
|
| 197 |
+
0.47540000081062317
|
| 198 |
+
]
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"class": "JointController",
|
| 202 |
+
"control_period": 16,
|
| 203 |
+
"control_dt": 0.06666666666666667,
|
| 204 |
+
"cfg": {
|
| 205 |
+
"dt": 0.06666666666666667,
|
| 206 |
+
"joint_names": [
|
| 207 |
+
"panda_finger_joint.*"
|
| 208 |
+
],
|
| 209 |
+
"scale": 1.0,
|
| 210 |
+
"offset": 0.0
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
],
|
| 214 |
+
"joint_names": [
|
| 215 |
+
"panda_joint1",
|
| 216 |
+
"panda_joint2",
|
| 217 |
+
"panda_joint3",
|
| 218 |
+
"panda_joint4",
|
| 219 |
+
"panda_joint5",
|
| 220 |
+
"panda_joint6",
|
| 221 |
+
"panda_joint7",
|
| 222 |
+
"panda_finger_joint1",
|
| 223 |
+
"panda_finger_joint2"
|
| 224 |
+
],
|
| 225 |
+
"joint_stiffness": [
|
| 226 |
+
0.0,
|
| 227 |
+
0.0,
|
| 228 |
+
0.0,
|
| 229 |
+
0.0,
|
| 230 |
+
0.0,
|
| 231 |
+
0.0,
|
| 232 |
+
0.0,
|
| 233 |
+
2000.0,
|
| 234 |
+
2000.0
|
| 235 |
+
],
|
| 236 |
+
"joint_damping": [
|
| 237 |
+
0.0,
|
| 238 |
+
0.0,
|
| 239 |
+
0.0,
|
| 240 |
+
0.0,
|
| 241 |
+
0.0,
|
| 242 |
+
0.0,
|
| 243 |
+
0.0,
|
| 244 |
+
100.0,
|
| 245 |
+
100.0
|
| 246 |
+
]
|
| 247 |
+
},
|
| 248 |
+
"source_trajectory_sha256": "0f6896868d106319c43601979ebbcc6fcab0b52eb5c408c8acdcb15fc1fc933a",
|
| 249 |
+
"perturbed_rows": 459,
|
| 250 |
+
"source_split_group": "0f6896868d106319c43601979ebbcc6fcab0b52eb5c408c8acdcb15fc1fc933a",
|
| 251 |
+
"success": true,
|
| 252 |
+
"replay_checked": false
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"episode_index": 2,
|
| 256 |
+
"source_episode": "data/h_s0_3/ep_0000",
|
| 257 |
+
"cell": "scene_1/strategy_0",
|
| 258 |
+
"seed": 103,
|
| 259 |
+
"entry": null,
|
| 260 |
+
"frames": 1350,
|
| 261 |
+
"controller": {
|
| 262 |
+
"class": "FrankaRobot",
|
| 263 |
+
"leaves": [
|
| 264 |
+
{
|
| 265 |
+
"class": "OperationalSpaceController",
|
| 266 |
+
"control_period": 16,
|
| 267 |
+
"control_dt": 0.06666666666666667,
|
| 268 |
+
"cfg": {
|
| 269 |
+
"dt": 0.06666666666666667,
|
| 270 |
+
"ee_body": "panda_hand",
|
| 271 |
+
"arm_joint_names": [
|
| 272 |
+
"panda_joint[1-7]"
|
| 273 |
+
],
|
| 274 |
+
"task_prop_gains": [
|
| 275 |
+
100.0,
|
| 276 |
+
100.0,
|
| 277 |
+
100.0,
|
| 278 |
+
30.0,
|
| 279 |
+
30.0,
|
| 280 |
+
30.0
|
| 281 |
+
],
|
| 282 |
+
"task_deriv_gains": [],
|
| 283 |
+
"pos_scale": 0.02,
|
| 284 |
+
"rot_scale": 0.097,
|
| 285 |
+
"unidirectional_rot": false,
|
| 286 |
+
"ema_factor": 0.2,
|
| 287 |
+
"nullspace_dof_pos": [
|
| 288 |
+
-1.3003,
|
| 289 |
+
-0.4015,
|
| 290 |
+
1.1791,
|
| 291 |
+
-2.1493,
|
| 292 |
+
0.4001,
|
| 293 |
+
1.9425,
|
| 294 |
+
0.4754
|
| 295 |
+
],
|
| 296 |
+
"kp_null": 10.0,
|
| 297 |
+
"kd_null": 6.3246,
|
| 298 |
+
"torque_limit": 100.0
|
| 299 |
+
},
|
| 300 |
+
"kp": [
|
| 301 |
+
100.0,
|
| 302 |
+
100.0,
|
| 303 |
+
100.0,
|
| 304 |
+
30.0,
|
| 305 |
+
30.0,
|
| 306 |
+
30.0
|
| 307 |
+
],
|
| 308 |
+
"kd": [
|
| 309 |
+
20.0,
|
| 310 |
+
20.0,
|
| 311 |
+
20.0,
|
| 312 |
+
10.954451560974121,
|
| 313 |
+
10.954451560974121,
|
| 314 |
+
10.954451560974121
|
| 315 |
+
],
|
| 316 |
+
"q_default": [
|
| 317 |
+
-1.3003000020980835,
|
| 318 |
+
-0.40149998664855957,
|
| 319 |
+
1.1791000366210938,
|
| 320 |
+
-2.1493000984191895,
|
| 321 |
+
0.4000999927520752,
|
| 322 |
+
1.9424999952316284,
|
| 323 |
+
0.47540000081062317
|
| 324 |
+
]
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"class": "JointController",
|
| 328 |
+
"control_period": 16,
|
| 329 |
+
"control_dt": 0.06666666666666667,
|
| 330 |
+
"cfg": {
|
| 331 |
+
"dt": 0.06666666666666667,
|
| 332 |
+
"joint_names": [
|
| 333 |
+
"panda_finger_joint.*"
|
| 334 |
+
],
|
| 335 |
+
"scale": 1.0,
|
| 336 |
+
"offset": 0.0
|
| 337 |
+
}
|
| 338 |
+
}
|
| 339 |
+
],
|
| 340 |
+
"joint_names": [
|
| 341 |
+
"panda_joint1",
|
| 342 |
+
"panda_joint2",
|
| 343 |
+
"panda_joint3",
|
| 344 |
+
"panda_joint4",
|
| 345 |
+
"panda_joint5",
|
| 346 |
+
"panda_joint6",
|
| 347 |
+
"panda_joint7",
|
| 348 |
+
"panda_finger_joint1",
|
| 349 |
+
"panda_finger_joint2"
|
| 350 |
+
],
|
| 351 |
+
"joint_stiffness": [
|
| 352 |
+
0.0,
|
| 353 |
+
0.0,
|
| 354 |
+
0.0,
|
| 355 |
+
0.0,
|
| 356 |
+
0.0,
|
| 357 |
+
0.0,
|
| 358 |
+
0.0,
|
| 359 |
+
2000.0,
|
| 360 |
+
2000.0
|
| 361 |
+
],
|
| 362 |
+
"joint_damping": [
|
| 363 |
+
0.0,
|
| 364 |
+
0.0,
|
| 365 |
+
0.0,
|
| 366 |
+
0.0,
|
| 367 |
+
0.0,
|
| 368 |
+
0.0,
|
| 369 |
+
0.0,
|
| 370 |
+
100.0,
|
| 371 |
+
100.0
|
| 372 |
+
]
|
| 373 |
+
},
|
| 374 |
+
"source_trajectory_sha256": "3d2bcf5a63959dbd7ad013ad87e2008b9a67ede39886c71be73357e39d30124c",
|
| 375 |
+
"perturbed_rows": 462,
|
| 376 |
+
"source_split_group": "3d2bcf5a63959dbd7ad013ad87e2008b9a67ede39886c71be73357e39d30124c",
|
| 377 |
+
"success": true,
|
| 378 |
+
"replay_checked": false
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"episode_index": 3,
|
| 382 |
+
"source_episode": "data/p01_scene/ep_0000",
|
| 383 |
+
"cell": "scene_1/strategy_0",
|
| 384 |
+
"seed": 100,
|
| 385 |
+
"entry": null,
|
| 386 |
+
"frames": 1350,
|
| 387 |
+
"controller": {
|
| 388 |
+
"class": "FrankaRobot",
|
| 389 |
+
"leaves": [
|
| 390 |
+
{
|
| 391 |
+
"class": "OperationalSpaceController",
|
| 392 |
+
"control_period": 16,
|
| 393 |
+
"control_dt": 0.06666666666666667,
|
| 394 |
+
"cfg": {
|
| 395 |
+
"dt": 0.06666666666666667,
|
| 396 |
+
"ee_body": "panda_hand",
|
| 397 |
+
"arm_joint_names": [
|
| 398 |
+
"panda_joint[1-7]"
|
| 399 |
+
],
|
| 400 |
+
"task_prop_gains": [
|
| 401 |
+
100.0,
|
| 402 |
+
100.0,
|
| 403 |
+
100.0,
|
| 404 |
+
30.0,
|
| 405 |
+
30.0,
|
| 406 |
+
30.0
|
| 407 |
+
],
|
| 408 |
+
"task_deriv_gains": [],
|
| 409 |
+
"pos_scale": 0.02,
|
| 410 |
+
"rot_scale": 0.097,
|
| 411 |
+
"unidirectional_rot": false,
|
| 412 |
+
"ema_factor": 0.2,
|
| 413 |
+
"nullspace_dof_pos": [
|
| 414 |
+
-1.3003,
|
| 415 |
+
-0.4015,
|
| 416 |
+
1.1791,
|
| 417 |
+
-2.1493,
|
| 418 |
+
0.4001,
|
| 419 |
+
1.9425,
|
| 420 |
+
0.4754
|
| 421 |
+
],
|
| 422 |
+
"kp_null": 10.0,
|
| 423 |
+
"kd_null": 6.3246,
|
| 424 |
+
"torque_limit": 100.0
|
| 425 |
+
},
|
| 426 |
+
"kp": [
|
| 427 |
+
100.0,
|
| 428 |
+
100.0,
|
| 429 |
+
100.0,
|
| 430 |
+
30.0,
|
| 431 |
+
30.0,
|
| 432 |
+
30.0
|
| 433 |
+
],
|
| 434 |
+
"kd": [
|
| 435 |
+
20.0,
|
| 436 |
+
20.0,
|
| 437 |
+
20.0,
|
| 438 |
+
10.954451560974121,
|
| 439 |
+
10.954451560974121,
|
| 440 |
+
10.954451560974121
|
| 441 |
+
],
|
| 442 |
+
"q_default": [
|
| 443 |
+
-1.3003000020980835,
|
| 444 |
+
-0.40149998664855957,
|
| 445 |
+
1.1791000366210938,
|
| 446 |
+
-2.1493000984191895,
|
| 447 |
+
0.4000999927520752,
|
| 448 |
+
1.9424999952316284,
|
| 449 |
+
0.47540000081062317
|
| 450 |
+
]
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"class": "JointController",
|
| 454 |
+
"control_period": 16,
|
| 455 |
+
"control_dt": 0.06666666666666667,
|
| 456 |
+
"cfg": {
|
| 457 |
+
"dt": 0.06666666666666667,
|
| 458 |
+
"joint_names": [
|
| 459 |
+
"panda_finger_joint.*"
|
| 460 |
+
],
|
| 461 |
+
"scale": 1.0,
|
| 462 |
+
"offset": 0.0
|
| 463 |
+
}
|
| 464 |
+
}
|
| 465 |
+
],
|
| 466 |
+
"joint_names": [
|
| 467 |
+
"panda_joint1",
|
| 468 |
+
"panda_joint2",
|
| 469 |
+
"panda_joint3",
|
| 470 |
+
"panda_joint4",
|
| 471 |
+
"panda_joint5",
|
| 472 |
+
"panda_joint6",
|
| 473 |
+
"panda_joint7",
|
| 474 |
+
"panda_finger_joint1",
|
| 475 |
+
"panda_finger_joint2"
|
| 476 |
+
],
|
| 477 |
+
"joint_stiffness": [
|
| 478 |
+
0.0,
|
| 479 |
+
0.0,
|
| 480 |
+
0.0,
|
| 481 |
+
0.0,
|
| 482 |
+
0.0,
|
| 483 |
+
0.0,
|
| 484 |
+
0.0,
|
| 485 |
+
2000.0,
|
| 486 |
+
2000.0
|
| 487 |
+
],
|
| 488 |
+
"joint_damping": [
|
| 489 |
+
0.0,
|
| 490 |
+
0.0,
|
| 491 |
+
0.0,
|
| 492 |
+
0.0,
|
| 493 |
+
0.0,
|
| 494 |
+
0.0,
|
| 495 |
+
0.0,
|
| 496 |
+
100.0,
|
| 497 |
+
100.0
|
| 498 |
+
]
|
| 499 |
+
},
|
| 500 |
+
"source_trajectory_sha256": "006656ffd4d6e1310c0f456fb85f45f6ebcc65f2e066a99fefbf97726ae5b663",
|
| 501 |
+
"perturbed_rows": 0,
|
| 502 |
+
"source_split_group": "006656ffd4d6e1310c0f456fb85f45f6ebcc65f2e066a99fefbf97726ae5b663",
|
| 503 |
+
"success": true,
|
| 504 |
+
"replay_checked": false
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"episode_index": 4,
|
| 508 |
+
"source_episode": "data/p02_strategy/ep_0000",
|
| 509 |
+
"cell": "scene_1/strategy_1",
|
| 510 |
+
"seed": 100,
|
| 511 |
+
"entry": null,
|
| 512 |
+
"frames": 1320,
|
| 513 |
+
"controller": {
|
| 514 |
+
"class": "FrankaRobot",
|
| 515 |
+
"leaves": [
|
| 516 |
+
{
|
| 517 |
+
"class": "OperationalSpaceController",
|
| 518 |
+
"control_period": 16,
|
| 519 |
+
"control_dt": 0.06666666666666667,
|
| 520 |
+
"cfg": {
|
| 521 |
+
"dt": 0.06666666666666667,
|
| 522 |
+
"ee_body": "panda_hand",
|
| 523 |
+
"arm_joint_names": [
|
| 524 |
+
"panda_joint[1-7]"
|
| 525 |
+
],
|
| 526 |
+
"task_prop_gains": [
|
| 527 |
+
100.0,
|
| 528 |
+
100.0,
|
| 529 |
+
100.0,
|
| 530 |
+
30.0,
|
| 531 |
+
30.0,
|
| 532 |
+
30.0
|
| 533 |
+
],
|
| 534 |
+
"task_deriv_gains": [],
|
| 535 |
+
"pos_scale": 0.02,
|
| 536 |
+
"rot_scale": 0.097,
|
| 537 |
+
"unidirectional_rot": false,
|
| 538 |
+
"ema_factor": 0.2,
|
| 539 |
+
"nullspace_dof_pos": [
|
| 540 |
+
-1.3003,
|
| 541 |
+
-0.4015,
|
| 542 |
+
1.1791,
|
| 543 |
+
-2.1493,
|
| 544 |
+
0.4001,
|
| 545 |
+
1.9425,
|
| 546 |
+
0.4754
|
| 547 |
+
],
|
| 548 |
+
"kp_null": 10.0,
|
| 549 |
+
"kd_null": 6.3246,
|
| 550 |
+
"torque_limit": 100.0
|
| 551 |
+
},
|
| 552 |
+
"kp": [
|
| 553 |
+
100.0,
|
| 554 |
+
100.0,
|
| 555 |
+
100.0,
|
| 556 |
+
30.0,
|
| 557 |
+
30.0,
|
| 558 |
+
30.0
|
| 559 |
+
],
|
| 560 |
+
"kd": [
|
| 561 |
+
20.0,
|
| 562 |
+
20.0,
|
| 563 |
+
20.0,
|
| 564 |
+
10.954451560974121,
|
| 565 |
+
10.954451560974121,
|
| 566 |
+
10.954451560974121
|
| 567 |
+
],
|
| 568 |
+
"q_default": [
|
| 569 |
+
-1.3003000020980835,
|
| 570 |
+
-0.40149998664855957,
|
| 571 |
+
1.1791000366210938,
|
| 572 |
+
-2.1493000984191895,
|
| 573 |
+
0.4000999927520752,
|
| 574 |
+
1.9424999952316284,
|
| 575 |
+
0.47540000081062317
|
| 576 |
+
]
|
| 577 |
+
},
|
| 578 |
+
{
|
| 579 |
+
"class": "JointController",
|
| 580 |
+
"control_period": 16,
|
| 581 |
+
"control_dt": 0.06666666666666667,
|
| 582 |
+
"cfg": {
|
| 583 |
+
"dt": 0.06666666666666667,
|
| 584 |
+
"joint_names": [
|
| 585 |
+
"panda_finger_joint.*"
|
| 586 |
+
],
|
| 587 |
+
"scale": 1.0,
|
| 588 |
+
"offset": 0.0
|
| 589 |
+
}
|
| 590 |
+
}
|
| 591 |
+
],
|
| 592 |
+
"joint_names": [
|
| 593 |
+
"panda_joint1",
|
| 594 |
+
"panda_joint2",
|
| 595 |
+
"panda_joint3",
|
| 596 |
+
"panda_joint4",
|
| 597 |
+
"panda_joint5",
|
| 598 |
+
"panda_joint6",
|
| 599 |
+
"panda_joint7",
|
| 600 |
+
"panda_finger_joint1",
|
| 601 |
+
"panda_finger_joint2"
|
| 602 |
+
],
|
| 603 |
+
"joint_stiffness": [
|
| 604 |
+
0.0,
|
| 605 |
+
0.0,
|
| 606 |
+
0.0,
|
| 607 |
+
0.0,
|
| 608 |
+
0.0,
|
| 609 |
+
0.0,
|
| 610 |
+
0.0,
|
| 611 |
+
2000.0,
|
| 612 |
+
2000.0
|
| 613 |
+
],
|
| 614 |
+
"joint_damping": [
|
| 615 |
+
0.0,
|
| 616 |
+
0.0,
|
| 617 |
+
0.0,
|
| 618 |
+
0.0,
|
| 619 |
+
0.0,
|
| 620 |
+
0.0,
|
| 621 |
+
0.0,
|
| 622 |
+
100.0,
|
| 623 |
+
100.0
|
| 624 |
+
]
|
| 625 |
+
},
|
| 626 |
+
"source_trajectory_sha256": "542ffe626535ed34a448d1250095ab7fd2502902c18676eb09be00e21a9ac3ef",
|
| 627 |
+
"perturbed_rows": 0,
|
| 628 |
+
"source_split_group": "542ffe626535ed34a448d1250095ab7fd2502902c18676eb09be00e21a9ac3ef",
|
| 629 |
+
"success": true,
|
| 630 |
+
"replay_checked": false
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"episode_index": 5,
|
| 634 |
+
"source_episode": "data/p03_dynamics/ep_0000",
|
| 635 |
+
"cell": "scene_1/strategy_1",
|
| 636 |
+
"seed": 100,
|
| 637 |
+
"entry": null,
|
| 638 |
+
"frames": 1320,
|
| 639 |
+
"controller": {
|
| 640 |
+
"class": "FrankaRobot",
|
| 641 |
+
"leaves": [
|
| 642 |
+
{
|
| 643 |
+
"class": "OperationalSpaceController",
|
| 644 |
+
"control_period": 16,
|
| 645 |
+
"control_dt": 0.06666666666666667,
|
| 646 |
+
"cfg": {
|
| 647 |
+
"dt": 0.06666666666666667,
|
| 648 |
+
"ee_body": "panda_hand",
|
| 649 |
+
"arm_joint_names": [
|
| 650 |
+
"panda_joint[1-7]"
|
| 651 |
+
],
|
| 652 |
+
"task_prop_gains": [
|
| 653 |
+
100.0,
|
| 654 |
+
100.0,
|
| 655 |
+
100.0,
|
| 656 |
+
30.0,
|
| 657 |
+
30.0,
|
| 658 |
+
30.0
|
| 659 |
+
],
|
| 660 |
+
"task_deriv_gains": [],
|
| 661 |
+
"pos_scale": 0.02,
|
| 662 |
+
"rot_scale": 0.097,
|
| 663 |
+
"unidirectional_rot": false,
|
| 664 |
+
"ema_factor": 0.2,
|
| 665 |
+
"nullspace_dof_pos": [
|
| 666 |
+
-1.3003,
|
| 667 |
+
-0.4015,
|
| 668 |
+
1.1791,
|
| 669 |
+
-2.1493,
|
| 670 |
+
0.4001,
|
| 671 |
+
1.9425,
|
| 672 |
+
0.4754
|
| 673 |
+
],
|
| 674 |
+
"kp_null": 10.0,
|
| 675 |
+
"kd_null": 6.3246,
|
| 676 |
+
"torque_limit": 100.0
|
| 677 |
+
},
|
| 678 |
+
"kp": [
|
| 679 |
+
100.0,
|
| 680 |
+
100.0,
|
| 681 |
+
100.0,
|
| 682 |
+
30.0,
|
| 683 |
+
30.0,
|
| 684 |
+
30.0
|
| 685 |
+
],
|
| 686 |
+
"kd": [
|
| 687 |
+
20.0,
|
| 688 |
+
20.0,
|
| 689 |
+
20.0,
|
| 690 |
+
10.954451560974121,
|
| 691 |
+
10.954451560974121,
|
| 692 |
+
10.954451560974121
|
| 693 |
+
],
|
| 694 |
+
"q_default": [
|
| 695 |
+
-1.3003000020980835,
|
| 696 |
+
-0.40149998664855957,
|
| 697 |
+
1.1791000366210938,
|
| 698 |
+
-2.1493000984191895,
|
| 699 |
+
0.4000999927520752,
|
| 700 |
+
1.9424999952316284,
|
| 701 |
+
0.47540000081062317
|
| 702 |
+
]
|
| 703 |
+
},
|
| 704 |
+
{
|
| 705 |
+
"class": "JointController",
|
| 706 |
+
"control_period": 16,
|
| 707 |
+
"control_dt": 0.06666666666666667,
|
| 708 |
+
"cfg": {
|
| 709 |
+
"dt": 0.06666666666666667,
|
| 710 |
+
"joint_names": [
|
| 711 |
+
"panda_finger_joint.*"
|
| 712 |
+
],
|
| 713 |
+
"scale": 1.0,
|
| 714 |
+
"offset": 0.0
|
| 715 |
+
}
|
| 716 |
+
}
|
| 717 |
+
],
|
| 718 |
+
"joint_names": [
|
| 719 |
+
"panda_joint1",
|
| 720 |
+
"panda_joint2",
|
| 721 |
+
"panda_joint3",
|
| 722 |
+
"panda_joint4",
|
| 723 |
+
"panda_joint5",
|
| 724 |
+
"panda_joint6",
|
| 725 |
+
"panda_joint7",
|
| 726 |
+
"panda_finger_joint1",
|
| 727 |
+
"panda_finger_joint2"
|
| 728 |
+
],
|
| 729 |
+
"joint_stiffness": [
|
| 730 |
+
0.0,
|
| 731 |
+
0.0,
|
| 732 |
+
0.0,
|
| 733 |
+
0.0,
|
| 734 |
+
0.0,
|
| 735 |
+
0.0,
|
| 736 |
+
0.0,
|
| 737 |
+
2000.0,
|
| 738 |
+
2000.0
|
| 739 |
+
],
|
| 740 |
+
"joint_damping": [
|
| 741 |
+
0.0,
|
| 742 |
+
0.0,
|
| 743 |
+
0.0,
|
| 744 |
+
0.0,
|
| 745 |
+
0.0,
|
| 746 |
+
0.0,
|
| 747 |
+
0.0,
|
| 748 |
+
100.0,
|
| 749 |
+
100.0
|
| 750 |
+
]
|
| 751 |
+
},
|
| 752 |
+
"source_trajectory_sha256": "22f561b73af4b311e35a1f3c490da9172effa7294ffb31ec2ae1c7f99e5d0153",
|
| 753 |
+
"perturbed_rows": 460,
|
| 754 |
+
"source_split_group": "22f561b73af4b311e35a1f3c490da9172effa7294ffb31ec2ae1c7f99e5d0153",
|
| 755 |
+
"success": true,
|
| 756 |
+
"replay_checked": false
|
| 757 |
+
},
|
| 758 |
+
{
|
| 759 |
+
"episode_index": 6,
|
| 760 |
+
"source_episode": "data/p04_phase/ep_0000",
|
| 761 |
+
"cell": "scene_1/strategy_1/phase_0",
|
| 762 |
+
"seed": 200,
|
| 763 |
+
"entry": "preinsert",
|
| 764 |
+
"frames": 660,
|
| 765 |
+
"controller": {
|
| 766 |
+
"class": "FrankaRobot",
|
| 767 |
+
"leaves": [
|
| 768 |
+
{
|
| 769 |
+
"class": "OperationalSpaceController",
|
| 770 |
+
"control_period": 16,
|
| 771 |
+
"control_dt": 0.06666666666666667,
|
| 772 |
+
"cfg": {
|
| 773 |
+
"dt": 0.06666666666666667,
|
| 774 |
+
"ee_body": "panda_hand",
|
| 775 |
+
"arm_joint_names": [
|
| 776 |
+
"panda_joint[1-7]"
|
| 777 |
+
],
|
| 778 |
+
"task_prop_gains": [
|
| 779 |
+
100.0,
|
| 780 |
+
100.0,
|
| 781 |
+
100.0,
|
| 782 |
+
30.0,
|
| 783 |
+
30.0,
|
| 784 |
+
30.0
|
| 785 |
+
],
|
| 786 |
+
"task_deriv_gains": [],
|
| 787 |
+
"pos_scale": 0.02,
|
| 788 |
+
"rot_scale": 0.097,
|
| 789 |
+
"unidirectional_rot": false,
|
| 790 |
+
"ema_factor": 0.2,
|
| 791 |
+
"nullspace_dof_pos": [
|
| 792 |
+
-1.3003,
|
| 793 |
+
-0.4015,
|
| 794 |
+
1.1791,
|
| 795 |
+
-2.1493,
|
| 796 |
+
0.4001,
|
| 797 |
+
1.9425,
|
| 798 |
+
0.4754
|
| 799 |
+
],
|
| 800 |
+
"kp_null": 10.0,
|
| 801 |
+
"kd_null": 6.3246,
|
| 802 |
+
"torque_limit": 100.0
|
| 803 |
+
},
|
| 804 |
+
"kp": [
|
| 805 |
+
100.0,
|
| 806 |
+
100.0,
|
| 807 |
+
100.0,
|
| 808 |
+
30.0,
|
| 809 |
+
30.0,
|
| 810 |
+
30.0
|
| 811 |
+
],
|
| 812 |
+
"kd": [
|
| 813 |
+
20.0,
|
| 814 |
+
20.0,
|
| 815 |
+
20.0,
|
| 816 |
+
10.954451560974121,
|
| 817 |
+
10.954451560974121,
|
| 818 |
+
10.954451560974121
|
| 819 |
+
],
|
| 820 |
+
"q_default": [
|
| 821 |
+
-1.3003000020980835,
|
| 822 |
+
-0.40149998664855957,
|
| 823 |
+
1.1791000366210938,
|
| 824 |
+
-2.1493000984191895,
|
| 825 |
+
0.4000999927520752,
|
| 826 |
+
1.9424999952316284,
|
| 827 |
+
0.47540000081062317
|
| 828 |
+
]
|
| 829 |
+
},
|
| 830 |
+
{
|
| 831 |
+
"class": "JointController",
|
| 832 |
+
"control_period": 16,
|
| 833 |
+
"control_dt": 0.06666666666666667,
|
| 834 |
+
"cfg": {
|
| 835 |
+
"dt": 0.06666666666666667,
|
| 836 |
+
"joint_names": [
|
| 837 |
+
"panda_finger_joint.*"
|
| 838 |
+
],
|
| 839 |
+
"scale": 1.0,
|
| 840 |
+
"offset": 0.0
|
| 841 |
+
}
|
| 842 |
+
}
|
| 843 |
+
],
|
| 844 |
+
"joint_names": [
|
| 845 |
+
"panda_joint1",
|
| 846 |
+
"panda_joint2",
|
| 847 |
+
"panda_joint3",
|
| 848 |
+
"panda_joint4",
|
| 849 |
+
"panda_joint5",
|
| 850 |
+
"panda_joint6",
|
| 851 |
+
"panda_joint7",
|
| 852 |
+
"panda_finger_joint1",
|
| 853 |
+
"panda_finger_joint2"
|
| 854 |
+
],
|
| 855 |
+
"joint_stiffness": [
|
| 856 |
+
0.0,
|
| 857 |
+
0.0,
|
| 858 |
+
0.0,
|
| 859 |
+
0.0,
|
| 860 |
+
0.0,
|
| 861 |
+
0.0,
|
| 862 |
+
0.0,
|
| 863 |
+
2000.0,
|
| 864 |
+
2000.0
|
| 865 |
+
],
|
| 866 |
+
"joint_damping": [
|
| 867 |
+
0.0,
|
| 868 |
+
0.0,
|
| 869 |
+
0.0,
|
| 870 |
+
0.0,
|
| 871 |
+
0.0,
|
| 872 |
+
0.0,
|
| 873 |
+
0.0,
|
| 874 |
+
100.0,
|
| 875 |
+
100.0
|
| 876 |
+
]
|
| 877 |
+
},
|
| 878 |
+
"source_trajectory_sha256": "d67d6e72cb347ddad8f174c2c87f4e079dc7e923976467e6cccd56bf9818de89",
|
| 879 |
+
"perturbed_rows": 0,
|
| 880 |
+
"source_split_group": "d67d6e72cb347ddad8f174c2c87f4e079dc7e923976467e6cccd56bf9818de89",
|
| 881 |
+
"success": true,
|
| 882 |
+
"replay_checked": false
|
| 883 |
+
},
|
| 884 |
+
{
|
| 885 |
+
"episode_index": 7,
|
| 886 |
+
"source_episode": "data/p04_phase/ep_0001",
|
| 887 |
+
"cell": "scene_1/strategy_1/phase_0",
|
| 888 |
+
"seed": 201,
|
| 889 |
+
"entry": "start",
|
| 890 |
+
"frames": 1320,
|
| 891 |
+
"controller": {
|
| 892 |
+
"class": "FrankaRobot",
|
| 893 |
+
"leaves": [
|
| 894 |
+
{
|
| 895 |
+
"class": "OperationalSpaceController",
|
| 896 |
+
"control_period": 16,
|
| 897 |
+
"control_dt": 0.06666666666666667,
|
| 898 |
+
"cfg": {
|
| 899 |
+
"dt": 0.06666666666666667,
|
| 900 |
+
"ee_body": "panda_hand",
|
| 901 |
+
"arm_joint_names": [
|
| 902 |
+
"panda_joint[1-7]"
|
| 903 |
+
],
|
| 904 |
+
"task_prop_gains": [
|
| 905 |
+
100.0,
|
| 906 |
+
100.0,
|
| 907 |
+
100.0,
|
| 908 |
+
30.0,
|
| 909 |
+
30.0,
|
| 910 |
+
30.0
|
| 911 |
+
],
|
| 912 |
+
"task_deriv_gains": [],
|
| 913 |
+
"pos_scale": 0.02,
|
| 914 |
+
"rot_scale": 0.097,
|
| 915 |
+
"unidirectional_rot": false,
|
| 916 |
+
"ema_factor": 0.2,
|
| 917 |
+
"nullspace_dof_pos": [
|
| 918 |
+
-1.3003,
|
| 919 |
+
-0.4015,
|
| 920 |
+
1.1791,
|
| 921 |
+
-2.1493,
|
| 922 |
+
0.4001,
|
| 923 |
+
1.9425,
|
| 924 |
+
0.4754
|
| 925 |
+
],
|
| 926 |
+
"kp_null": 10.0,
|
| 927 |
+
"kd_null": 6.3246,
|
| 928 |
+
"torque_limit": 100.0
|
| 929 |
+
},
|
| 930 |
+
"kp": [
|
| 931 |
+
100.0,
|
| 932 |
+
100.0,
|
| 933 |
+
100.0,
|
| 934 |
+
30.0,
|
| 935 |
+
30.0,
|
| 936 |
+
30.0
|
| 937 |
+
],
|
| 938 |
+
"kd": [
|
| 939 |
+
20.0,
|
| 940 |
+
20.0,
|
| 941 |
+
20.0,
|
| 942 |
+
10.954451560974121,
|
| 943 |
+
10.954451560974121,
|
| 944 |
+
10.954451560974121
|
| 945 |
+
],
|
| 946 |
+
"q_default": [
|
| 947 |
+
-1.3003000020980835,
|
| 948 |
+
-0.40149998664855957,
|
| 949 |
+
1.1791000366210938,
|
| 950 |
+
-2.1493000984191895,
|
| 951 |
+
0.4000999927520752,
|
| 952 |
+
1.9424999952316284,
|
| 953 |
+
0.47540000081062317
|
| 954 |
+
]
|
| 955 |
+
},
|
| 956 |
+
{
|
| 957 |
+
"class": "JointController",
|
| 958 |
+
"control_period": 16,
|
| 959 |
+
"control_dt": 0.06666666666666667,
|
| 960 |
+
"cfg": {
|
| 961 |
+
"dt": 0.06666666666666667,
|
| 962 |
+
"joint_names": [
|
| 963 |
+
"panda_finger_joint.*"
|
| 964 |
+
],
|
| 965 |
+
"scale": 1.0,
|
| 966 |
+
"offset": 0.0
|
| 967 |
+
}
|
| 968 |
+
}
|
| 969 |
+
],
|
| 970 |
+
"joint_names": [
|
| 971 |
+
"panda_joint1",
|
| 972 |
+
"panda_joint2",
|
| 973 |
+
"panda_joint3",
|
| 974 |
+
"panda_joint4",
|
| 975 |
+
"panda_joint5",
|
| 976 |
+
"panda_joint6",
|
| 977 |
+
"panda_joint7",
|
| 978 |
+
"panda_finger_joint1",
|
| 979 |
+
"panda_finger_joint2"
|
| 980 |
+
],
|
| 981 |
+
"joint_stiffness": [
|
| 982 |
+
0.0,
|
| 983 |
+
0.0,
|
| 984 |
+
0.0,
|
| 985 |
+
0.0,
|
| 986 |
+
0.0,
|
| 987 |
+
0.0,
|
| 988 |
+
0.0,
|
| 989 |
+
2000.0,
|
| 990 |
+
2000.0
|
| 991 |
+
],
|
| 992 |
+
"joint_damping": [
|
| 993 |
+
0.0,
|
| 994 |
+
0.0,
|
| 995 |
+
0.0,
|
| 996 |
+
0.0,
|
| 997 |
+
0.0,
|
| 998 |
+
0.0,
|
| 999 |
+
0.0,
|
| 1000 |
+
100.0,
|
| 1001 |
+
100.0
|
| 1002 |
+
]
|
| 1003 |
+
},
|
| 1004 |
+
"source_trajectory_sha256": "decaf4c129959bb995cc38f83da702b949014ba604185b183dc1c598cfcf6cdf",
|
| 1005 |
+
"perturbed_rows": 458,
|
| 1006 |
+
"source_split_group": "decaf4c129959bb995cc38f83da702b949014ba604185b183dc1c598cfcf6cdf",
|
| 1007 |
+
"success": true,
|
| 1008 |
+
"replay_checked": false
|
| 1009 |
+
}
|
| 1010 |
+
]
|
meta/episodes/chunk-000/file-000.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f741a4749bd8ab74f816b88184d7de8c05115bc88ae920fe942d1e702a9012cc
|
| 3 |
+
size 303502
|
meta/info.json
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"codebase_version": "v3.0",
|
| 3 |
+
"fps": 15,
|
| 4 |
+
"features": {
|
| 5 |
+
"observation.state": {
|
| 6 |
+
"dtype": "float32",
|
| 7 |
+
"shape": [
|
| 8 |
+
8
|
| 9 |
+
],
|
| 10 |
+
"names": [
|
| 11 |
+
"joint_1_rad",
|
| 12 |
+
"joint_2_rad",
|
| 13 |
+
"joint_3_rad",
|
| 14 |
+
"joint_4_rad",
|
| 15 |
+
"joint_5_rad",
|
| 16 |
+
"joint_6_rad",
|
| 17 |
+
"joint_7_rad",
|
| 18 |
+
"gripper_closedness"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
"action": {
|
| 22 |
+
"dtype": "float32",
|
| 23 |
+
"shape": [
|
| 24 |
+
8
|
| 25 |
+
],
|
| 26 |
+
"names": [
|
| 27 |
+
"dx",
|
| 28 |
+
"dy",
|
| 29 |
+
"dz",
|
| 30 |
+
"drot_x",
|
| 31 |
+
"drot_y",
|
| 32 |
+
"drot_z",
|
| 33 |
+
"finger1_m",
|
| 34 |
+
"finger2_m"
|
| 35 |
+
]
|
| 36 |
+
},
|
| 37 |
+
"complementary_info.action_noise": {
|
| 38 |
+
"dtype": "float32",
|
| 39 |
+
"shape": [
|
| 40 |
+
8
|
| 41 |
+
],
|
| 42 |
+
"names": [
|
| 43 |
+
"dx",
|
| 44 |
+
"dy",
|
| 45 |
+
"dz",
|
| 46 |
+
"drot_x",
|
| 47 |
+
"drot_y",
|
| 48 |
+
"drot_z",
|
| 49 |
+
"finger1_m",
|
| 50 |
+
"finger2_m"
|
| 51 |
+
]
|
| 52 |
+
},
|
| 53 |
+
"complementary_info.executed_action": {
|
| 54 |
+
"dtype": "float32",
|
| 55 |
+
"shape": [
|
| 56 |
+
8
|
| 57 |
+
],
|
| 58 |
+
"names": [
|
| 59 |
+
"dx",
|
| 60 |
+
"dy",
|
| 61 |
+
"dz",
|
| 62 |
+
"drot_x",
|
| 63 |
+
"drot_y",
|
| 64 |
+
"drot_z",
|
| 65 |
+
"finger1_m",
|
| 66 |
+
"finger2_m"
|
| 67 |
+
]
|
| 68 |
+
},
|
| 69 |
+
"observation.images.front": {
|
| 70 |
+
"dtype": "video",
|
| 71 |
+
"shape": [
|
| 72 |
+
240,
|
| 73 |
+
320,
|
| 74 |
+
3
|
| 75 |
+
],
|
| 76 |
+
"names": [
|
| 77 |
+
"height",
|
| 78 |
+
"width",
|
| 79 |
+
"channels"
|
| 80 |
+
],
|
| 81 |
+
"info": {
|
| 82 |
+
"video.height": 240,
|
| 83 |
+
"video.width": 320,
|
| 84 |
+
"video.codec": "h264",
|
| 85 |
+
"video.pix_fmt": "yuv420p",
|
| 86 |
+
"video.fps": 15,
|
| 87 |
+
"video.channels": 3,
|
| 88 |
+
"has_audio": false,
|
| 89 |
+
"video.g": 2,
|
| 90 |
+
"video.crf": 18,
|
| 91 |
+
"video.preset": "fast",
|
| 92 |
+
"video.fast_decode": 0,
|
| 93 |
+
"video.video_backend": "pyav",
|
| 94 |
+
"video.extra_options": {},
|
| 95 |
+
"is_depth_map": false
|
| 96 |
+
}
|
| 97 |
+
},
|
| 98 |
+
"observation.images.wrist": {
|
| 99 |
+
"dtype": "video",
|
| 100 |
+
"shape": [
|
| 101 |
+
240,
|
| 102 |
+
320,
|
| 103 |
+
3
|
| 104 |
+
],
|
| 105 |
+
"names": [
|
| 106 |
+
"height",
|
| 107 |
+
"width",
|
| 108 |
+
"channels"
|
| 109 |
+
],
|
| 110 |
+
"info": {
|
| 111 |
+
"video.height": 240,
|
| 112 |
+
"video.width": 320,
|
| 113 |
+
"video.codec": "h264",
|
| 114 |
+
"video.pix_fmt": "yuv420p",
|
| 115 |
+
"video.fps": 15,
|
| 116 |
+
"video.channels": 3,
|
| 117 |
+
"has_audio": false,
|
| 118 |
+
"video.g": 2,
|
| 119 |
+
"video.crf": 18,
|
| 120 |
+
"video.preset": "fast",
|
| 121 |
+
"video.fast_decode": 0,
|
| 122 |
+
"video.video_backend": "pyav",
|
| 123 |
+
"video.extra_options": {},
|
| 124 |
+
"is_depth_map": false
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
"timestamp": {
|
| 128 |
+
"dtype": "float32",
|
| 129 |
+
"shape": [
|
| 130 |
+
1
|
| 131 |
+
],
|
| 132 |
+
"names": null
|
| 133 |
+
},
|
| 134 |
+
"frame_index": {
|
| 135 |
+
"dtype": "int64",
|
| 136 |
+
"shape": [
|
| 137 |
+
1
|
| 138 |
+
],
|
| 139 |
+
"names": null
|
| 140 |
+
},
|
| 141 |
+
"episode_index": {
|
| 142 |
+
"dtype": "int64",
|
| 143 |
+
"shape": [
|
| 144 |
+
1
|
| 145 |
+
],
|
| 146 |
+
"names": null
|
| 147 |
+
},
|
| 148 |
+
"index": {
|
| 149 |
+
"dtype": "int64",
|
| 150 |
+
"shape": [
|
| 151 |
+
1
|
| 152 |
+
],
|
| 153 |
+
"names": null
|
| 154 |
+
},
|
| 155 |
+
"task_index": {
|
| 156 |
+
"dtype": "int64",
|
| 157 |
+
"shape": [
|
| 158 |
+
1
|
| 159 |
+
],
|
| 160 |
+
"names": null
|
| 161 |
+
}
|
| 162 |
+
},
|
| 163 |
+
"total_episodes": 8,
|
| 164 |
+
"total_frames": 10020,
|
| 165 |
+
"total_tasks": 1,
|
| 166 |
+
"chunks_size": 1000,
|
| 167 |
+
"data_files_size_in_mb": 100,
|
| 168 |
+
"video_files_size_in_mb": 200,
|
| 169 |
+
"data_path": "data/chunk-{chunk_index:03d}/file-{file_index:03d}.parquet",
|
| 170 |
+
"video_path": "videos/{video_key}/chunk-{chunk_index:03d}/file-{file_index:03d}.mp4",
|
| 171 |
+
"robot_type": "franka_osc",
|
| 172 |
+
"splits": {
|
| 173 |
+
"train": "0:8"
|
| 174 |
+
}
|
| 175 |
+
}
|
meta/stats.json
ADDED
|
@@ -0,0 +1,858 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"timestamp": {
|
| 3 |
+
"min": [
|
| 4 |
+
0.0
|
| 5 |
+
],
|
| 6 |
+
"max": [
|
| 7 |
+
89.93333333333334
|
| 8 |
+
],
|
| 9 |
+
"mean": [
|
| 10 |
+
43.0564870259481
|
| 11 |
+
],
|
| 12 |
+
"std": [
|
| 13 |
+
25.71053251281212
|
| 14 |
+
],
|
| 15 |
+
"count": [
|
| 16 |
+
10020
|
| 17 |
+
],
|
| 18 |
+
"q01": [
|
| 19 |
+
0.40067199990182406
|
| 20 |
+
],
|
| 21 |
+
"q10": [
|
| 22 |
+
4.340613333253094
|
| 23 |
+
],
|
| 24 |
+
"q50": [
|
| 25 |
+
21.94030666666655
|
| 26 |
+
],
|
| 27 |
+
"q90": [
|
| 28 |
+
80.94000000008
|
| 29 |
+
],
|
| 30 |
+
"q99": [
|
| 31 |
+
89.06098000009806
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
"complementary_info.executed_action": {
|
| 35 |
+
"min": [
|
| 36 |
+
-1.192927598953247,
|
| 37 |
+
-4.8213653564453125,
|
| 38 |
+
-6.9681854248046875,
|
| 39 |
+
-27.32980728149414,
|
| 40 |
+
-3.53182315826416,
|
| 41 |
+
-1.5483593940734863,
|
| 42 |
+
0.01720000058412552,
|
| 43 |
+
0.01720000058412552
|
| 44 |
+
],
|
| 45 |
+
"max": [
|
| 46 |
+
0.8919456601142883,
|
| 47 |
+
2.040548801422119,
|
| 48 |
+
2.556353807449341,
|
| 49 |
+
7.3572587966918945,
|
| 50 |
+
6.108026504516602,
|
| 51 |
+
2.833026885986328,
|
| 52 |
+
0.03999999910593033,
|
| 53 |
+
0.03999999910593033
|
| 54 |
+
],
|
| 55 |
+
"mean": [
|
| 56 |
+
-0.08648351766169071,
|
| 57 |
+
0.9225108921527863,
|
| 58 |
+
1.1013612490214273,
|
| 59 |
+
4.760189543227236,
|
| 60 |
+
0.43449598979093357,
|
| 61 |
+
-0.34911954188775157,
|
| 62 |
+
0.02178150823640966,
|
| 63 |
+
0.02178150823640966
|
| 64 |
+
],
|
| 65 |
+
"std": [
|
| 66 |
+
0.4510908035211494,
|
| 67 |
+
0.5622081114672041,
|
| 68 |
+
0.6889249583777496,
|
| 69 |
+
2.76173067013162,
|
| 70 |
+
2.6034700000173454,
|
| 71 |
+
0.612278021166472,
|
| 72 |
+
0.00905970509554574,
|
| 73 |
+
0.00905970509554574
|
| 74 |
+
],
|
| 75 |
+
"count": [
|
| 76 |
+
10020
|
| 77 |
+
],
|
| 78 |
+
"q01": [
|
| 79 |
+
-1.1153079271316528,
|
| 80 |
+
-0.07388143539428711,
|
| 81 |
+
-0.4089967608451843,
|
| 82 |
+
-0.5724983215332031,
|
| 83 |
+
-3.51198148727417,
|
| 84 |
+
-1.5050480365753174,
|
| 85 |
+
0.01720000058412552,
|
| 86 |
+
0.01720000058412552
|
| 87 |
+
],
|
| 88 |
+
"q10": [
|
| 89 |
+
-0.9509038925170898,
|
| 90 |
+
-0.002611324191093445,
|
| 91 |
+
-0.3101853132247925,
|
| 92 |
+
-0.0019207026647484822,
|
| 93 |
+
-3.3569037914276123,
|
| 94 |
+
-1.3758057753245037,
|
| 95 |
+
0.01720000058412552,
|
| 96 |
+
0.01720000058412552
|
| 97 |
+
],
|
| 98 |
+
"q50": [
|
| 99 |
+
-0.003383040428161621,
|
| 100 |
+
1.2040990591049194,
|
| 101 |
+
1.371724910206265,
|
| 102 |
+
6.2374587059021,
|
| 103 |
+
-3.1989541053771973,
|
| 104 |
+
-0.7735692262649536,
|
| 105 |
+
0.01720000058412552,
|
| 106 |
+
0.01720000058412552
|
| 107 |
+
],
|
| 108 |
+
"q90": [
|
| 109 |
+
0.4375326633453369,
|
| 110 |
+
1.406903346379598,
|
| 111 |
+
1.639123558998108,
|
| 112 |
+
7.244527101516724,
|
| 113 |
+
5.565688133239746,
|
| 114 |
+
0.4603039877755301,
|
| 115 |
+
0.03999782622613631,
|
| 116 |
+
0.03999782622613631
|
| 117 |
+
],
|
| 118 |
+
"q99": [
|
| 119 |
+
0.8008056044578552,
|
| 120 |
+
1.5939308404922485,
|
| 121 |
+
1.8017842769622803,
|
| 122 |
+
7.326128780841827,
|
| 123 |
+
6.07754921913147,
|
| 124 |
+
2.0114109992980955,
|
| 125 |
+
0.03999978181795093,
|
| 126 |
+
0.03999978181795093
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
"task_index": {
|
| 130 |
+
"min": [
|
| 131 |
+
0.0
|
| 132 |
+
],
|
| 133 |
+
"max": [
|
| 134 |
+
0.0
|
| 135 |
+
],
|
| 136 |
+
"mean": [
|
| 137 |
+
0.0
|
| 138 |
+
],
|
| 139 |
+
"std": [
|
| 140 |
+
0.0
|
| 141 |
+
],
|
| 142 |
+
"count": [
|
| 143 |
+
10020
|
| 144 |
+
],
|
| 145 |
+
"q01": [
|
| 146 |
+
3.9999999999994176e-16
|
| 147 |
+
],
|
| 148 |
+
"q10": [
|
| 149 |
+
3.999999999999417e-15
|
| 150 |
+
],
|
| 151 |
+
"q50": [
|
| 152 |
+
1.9999999999997088e-14
|
| 153 |
+
],
|
| 154 |
+
"q90": [
|
| 155 |
+
3.599999999999476e-14
|
| 156 |
+
],
|
| 157 |
+
"q99": [
|
| 158 |
+
3.9599999999994235e-14
|
| 159 |
+
]
|
| 160 |
+
},
|
| 161 |
+
"observation.images.front": {
|
| 162 |
+
"min": [
|
| 163 |
+
[
|
| 164 |
+
[
|
| 165 |
+
0.0
|
| 166 |
+
]
|
| 167 |
+
],
|
| 168 |
+
[
|
| 169 |
+
[
|
| 170 |
+
0.0
|
| 171 |
+
]
|
| 172 |
+
],
|
| 173 |
+
[
|
| 174 |
+
[
|
| 175 |
+
0.0
|
| 176 |
+
]
|
| 177 |
+
]
|
| 178 |
+
],
|
| 179 |
+
"max": [
|
| 180 |
+
[
|
| 181 |
+
[
|
| 182 |
+
0.9843137264251709
|
| 183 |
+
]
|
| 184 |
+
],
|
| 185 |
+
[
|
| 186 |
+
[
|
| 187 |
+
0.9764705896377563
|
| 188 |
+
]
|
| 189 |
+
],
|
| 190 |
+
[
|
| 191 |
+
[
|
| 192 |
+
1.0
|
| 193 |
+
]
|
| 194 |
+
]
|
| 195 |
+
],
|
| 196 |
+
"mean": [
|
| 197 |
+
[
|
| 198 |
+
[
|
| 199 |
+
0.6493919261558327
|
| 200 |
+
]
|
| 201 |
+
],
|
| 202 |
+
[
|
| 203 |
+
[
|
| 204 |
+
0.6370048792419318
|
| 205 |
+
]
|
| 206 |
+
],
|
| 207 |
+
[
|
| 208 |
+
[
|
| 209 |
+
0.610055156989012
|
| 210 |
+
]
|
| 211 |
+
]
|
| 212 |
+
],
|
| 213 |
+
"std": [
|
| 214 |
+
[
|
| 215 |
+
[
|
| 216 |
+
0.13048280371657883
|
| 217 |
+
]
|
| 218 |
+
],
|
| 219 |
+
[
|
| 220 |
+
[
|
| 221 |
+
0.12629314802150612
|
| 222 |
+
]
|
| 223 |
+
],
|
| 224 |
+
[
|
| 225 |
+
[
|
| 226 |
+
0.12787877064447073
|
| 227 |
+
]
|
| 228 |
+
]
|
| 229 |
+
],
|
| 230 |
+
"count": [
|
| 231 |
+
192384000
|
| 232 |
+
],
|
| 233 |
+
"q01": [
|
| 234 |
+
[
|
| 235 |
+
[
|
| 236 |
+
0.1332446568621464
|
| 237 |
+
]
|
| 238 |
+
],
|
| 239 |
+
[
|
| 240 |
+
[
|
| 241 |
+
0.1410924551350786
|
| 242 |
+
]
|
| 243 |
+
],
|
| 244 |
+
[
|
| 245 |
+
[
|
| 246 |
+
0.1411065357151727
|
| 247 |
+
]
|
| 248 |
+
]
|
| 249 |
+
],
|
| 250 |
+
"q10": [
|
| 251 |
+
[
|
| 252 |
+
[
|
| 253 |
+
0.48218600914454923
|
| 254 |
+
]
|
| 255 |
+
],
|
| 256 |
+
[
|
| 257 |
+
[
|
| 258 |
+
0.45488677530951216
|
| 259 |
+
]
|
| 260 |
+
],
|
| 261 |
+
[
|
| 262 |
+
[
|
| 263 |
+
0.3921642684245068
|
| 264 |
+
]
|
| 265 |
+
]
|
| 266 |
+
],
|
| 267 |
+
"q50": [
|
| 268 |
+
[
|
| 269 |
+
[
|
| 270 |
+
0.6117464392248848
|
| 271 |
+
]
|
| 272 |
+
],
|
| 273 |
+
[
|
| 274 |
+
[
|
| 275 |
+
0.6001141273586149
|
| 276 |
+
]
|
| 277 |
+
],
|
| 278 |
+
[
|
| 279 |
+
[
|
| 280 |
+
0.596063307148835
|
| 281 |
+
]
|
| 282 |
+
]
|
| 283 |
+
],
|
| 284 |
+
"q90": [
|
| 285 |
+
[
|
| 286 |
+
[
|
| 287 |
+
0.8155496688248666
|
| 288 |
+
]
|
| 289 |
+
],
|
| 290 |
+
[
|
| 291 |
+
[
|
| 292 |
+
0.7881721326515232
|
| 293 |
+
]
|
| 294 |
+
],
|
| 295 |
+
[
|
| 296 |
+
[
|
| 297 |
+
0.7411037616305317
|
| 298 |
+
]
|
| 299 |
+
]
|
| 300 |
+
],
|
| 301 |
+
"q99": [
|
| 302 |
+
[
|
| 303 |
+
[
|
| 304 |
+
0.8549452385318386
|
| 305 |
+
]
|
| 306 |
+
],
|
| 307 |
+
[
|
| 308 |
+
[
|
| 309 |
+
0.8548522205444578
|
| 310 |
+
]
|
| 311 |
+
],
|
| 312 |
+
[
|
| 313 |
+
[
|
| 314 |
+
0.8549512929696187
|
| 315 |
+
]
|
| 316 |
+
]
|
| 317 |
+
]
|
| 318 |
+
},
|
| 319 |
+
"index": {
|
| 320 |
+
"min": [
|
| 321 |
+
0.0
|
| 322 |
+
],
|
| 323 |
+
"max": [
|
| 324 |
+
10019.0
|
| 325 |
+
],
|
| 326 |
+
"mean": [
|
| 327 |
+
5009.5
|
| 328 |
+
],
|
| 329 |
+
"std": [
|
| 330 |
+
2892.5248342350783
|
| 331 |
+
],
|
| 332 |
+
"count": [
|
| 333 |
+
10020
|
| 334 |
+
],
|
| 335 |
+
"q01": [
|
| 336 |
+
13.08529999990194
|
| 337 |
+
],
|
| 338 |
+
"q10": [
|
| 339 |
+
134.0905999999199
|
| 340 |
+
],
|
| 341 |
+
"q50": [
|
| 342 |
+
674.2302
|
| 343 |
+
],
|
| 344 |
+
"q90": [
|
| 345 |
+
9887.10000000008
|
| 346 |
+
],
|
| 347 |
+
"q99": [
|
| 348 |
+
10006.021040000098
|
| 349 |
+
]
|
| 350 |
+
},
|
| 351 |
+
"episode_index": {
|
| 352 |
+
"min": [
|
| 353 |
+
0.0
|
| 354 |
+
],
|
| 355 |
+
"max": [
|
| 356 |
+
7.0
|
| 357 |
+
],
|
| 358 |
+
"mean": [
|
| 359 |
+
3.311377245508982
|
| 360 |
+
],
|
| 361 |
+
"std": [
|
| 362 |
+
2.269042351525235
|
| 363 |
+
],
|
| 364 |
+
"count": [
|
| 365 |
+
10020
|
| 366 |
+
],
|
| 367 |
+
"q01": [
|
| 368 |
+
3.9999999999994176e-16
|
| 369 |
+
],
|
| 370 |
+
"q10": [
|
| 371 |
+
3.999999999999417e-15
|
| 372 |
+
],
|
| 373 |
+
"q50": [
|
| 374 |
+
1.9999999999997088e-14
|
| 375 |
+
],
|
| 376 |
+
"q90": [
|
| 377 |
+
7.0000000000000355
|
| 378 |
+
],
|
| 379 |
+
"q99": [
|
| 380 |
+
7.00000000000004
|
| 381 |
+
]
|
| 382 |
+
},
|
| 383 |
+
"complementary_info.action_noise": {
|
| 384 |
+
"min": [
|
| 385 |
+
-0.10031559318304062,
|
| 386 |
+
-0.10328654199838638,
|
| 387 |
+
-0.10294100642204285,
|
| 388 |
+
0.0,
|
| 389 |
+
0.0,
|
| 390 |
+
0.0,
|
| 391 |
+
0.0,
|
| 392 |
+
0.0
|
| 393 |
+
],
|
| 394 |
+
"max": [
|
| 395 |
+
0.09702367335557938,
|
| 396 |
+
0.11048414558172226,
|
| 397 |
+
0.09299086034297943,
|
| 398 |
+
0.0,
|
| 399 |
+
0.0,
|
| 400 |
+
0.0,
|
| 401 |
+
0.0,
|
| 402 |
+
0.0
|
| 403 |
+
],
|
| 404 |
+
"mean": [
|
| 405 |
+
-3.435111983764978e-05,
|
| 406 |
+
-6.016886563993249e-05,
|
| 407 |
+
0.00020818806604732667,
|
| 408 |
+
0.0,
|
| 409 |
+
0.0,
|
| 410 |
+
0.0,
|
| 411 |
+
0.0,
|
| 412 |
+
0.0
|
| 413 |
+
],
|
| 414 |
+
"std": [
|
| 415 |
+
0.012560138812169722,
|
| 416 |
+
0.012419183841902536,
|
| 417 |
+
0.012935385062766171,
|
| 418 |
+
0.0,
|
| 419 |
+
0.0,
|
| 420 |
+
0.0,
|
| 421 |
+
0.0,
|
| 422 |
+
0.0
|
| 423 |
+
],
|
| 424 |
+
"count": [
|
| 425 |
+
10020
|
| 426 |
+
],
|
| 427 |
+
"q01": [
|
| 428 |
+
-0.05743747055530548,
|
| 429 |
+
-0.061476432532072064,
|
| 430 |
+
-0.056216320395469664,
|
| 431 |
+
3.9995784462121265e-16,
|
| 432 |
+
3.9995784462121265e-16,
|
| 433 |
+
3.9995784462121265e-16,
|
| 434 |
+
3.9995784462121265e-16,
|
| 435 |
+
3.9995784462121265e-16
|
| 436 |
+
],
|
| 437 |
+
"q10": [
|
| 438 |
+
-0.017193801701068878,
|
| 439 |
+
-0.01844063401222229,
|
| 440 |
+
-0.017125070095062256,
|
| 441 |
+
3.999578446212126e-15,
|
| 442 |
+
3.999578446212126e-15,
|
| 443 |
+
3.999578446212126e-15,
|
| 444 |
+
3.999578446212126e-15,
|
| 445 |
+
3.999578446212126e-15
|
| 446 |
+
],
|
| 447 |
+
"q50": [
|
| 448 |
+
-1.0532016555468239e-05,
|
| 449 |
+
-4.11286776842073e-06,
|
| 450 |
+
-1.1912494172641051e-05,
|
| 451 |
+
1.9997892231060632e-14,
|
| 452 |
+
1.9997892231060632e-14,
|
| 453 |
+
1.9997892231060632e-14,
|
| 454 |
+
1.9997892231060632e-14,
|
| 455 |
+
1.9997892231060632e-14
|
| 456 |
+
],
|
| 457 |
+
"q90": [
|
| 458 |
+
0.016823258250951767,
|
| 459 |
+
0.016254998743534088,
|
| 460 |
+
0.019154630601406097,
|
| 461 |
+
3.599620601590914e-14,
|
| 462 |
+
3.599620601590914e-14,
|
| 463 |
+
3.599620601590914e-14,
|
| 464 |
+
3.599620601590914e-14,
|
| 465 |
+
3.599620601590914e-14
|
| 466 |
+
],
|
| 467 |
+
"q99": [
|
| 468 |
+
0.05736614018678665,
|
| 469 |
+
0.06242603808641434,
|
| 470 |
+
0.061847159266471864,
|
| 471 |
+
3.959582661750005e-14,
|
| 472 |
+
3.959582661750005e-14,
|
| 473 |
+
3.959582661750005e-14,
|
| 474 |
+
3.959582661750005e-14,
|
| 475 |
+
3.959582661750005e-14
|
| 476 |
+
]
|
| 477 |
+
},
|
| 478 |
+
"observation.images.wrist": {
|
| 479 |
+
"min": [
|
| 480 |
+
[
|
| 481 |
+
[
|
| 482 |
+
0.0
|
| 483 |
+
]
|
| 484 |
+
],
|
| 485 |
+
[
|
| 486 |
+
[
|
| 487 |
+
0.0
|
| 488 |
+
]
|
| 489 |
+
],
|
| 490 |
+
[
|
| 491 |
+
[
|
| 492 |
+
0.0
|
| 493 |
+
]
|
| 494 |
+
]
|
| 495 |
+
],
|
| 496 |
+
"max": [
|
| 497 |
+
[
|
| 498 |
+
[
|
| 499 |
+
1.0
|
| 500 |
+
]
|
| 501 |
+
],
|
| 502 |
+
[
|
| 503 |
+
[
|
| 504 |
+
1.0
|
| 505 |
+
]
|
| 506 |
+
],
|
| 507 |
+
[
|
| 508 |
+
[
|
| 509 |
+
1.0
|
| 510 |
+
]
|
| 511 |
+
]
|
| 512 |
+
],
|
| 513 |
+
"mean": [
|
| 514 |
+
[
|
| 515 |
+
[
|
| 516 |
+
0.31499587284947583
|
| 517 |
+
]
|
| 518 |
+
],
|
| 519 |
+
[
|
| 520 |
+
[
|
| 521 |
+
0.3270711006518609
|
| 522 |
+
]
|
| 523 |
+
],
|
| 524 |
+
[
|
| 525 |
+
[
|
| 526 |
+
0.3236432301248619
|
| 527 |
+
]
|
| 528 |
+
]
|
| 529 |
+
],
|
| 530 |
+
"std": [
|
| 531 |
+
[
|
| 532 |
+
[
|
| 533 |
+
0.2748822970957793
|
| 534 |
+
]
|
| 535 |
+
],
|
| 536 |
+
[
|
| 537 |
+
[
|
| 538 |
+
0.28017536535171417
|
| 539 |
+
]
|
| 540 |
+
],
|
| 541 |
+
[
|
| 542 |
+
[
|
| 543 |
+
0.2771328274262199
|
| 544 |
+
]
|
| 545 |
+
]
|
| 546 |
+
],
|
| 547 |
+
"count": [
|
| 548 |
+
192384000
|
| 549 |
+
],
|
| 550 |
+
"q01": [
|
| 551 |
+
[
|
| 552 |
+
[
|
| 553 |
+
-1.000000013351432e-10
|
| 554 |
+
]
|
| 555 |
+
],
|
| 556 |
+
[
|
| 557 |
+
[
|
| 558 |
+
-1.000000013351432e-10
|
| 559 |
+
]
|
| 560 |
+
],
|
| 561 |
+
[
|
| 562 |
+
[
|
| 563 |
+
-1.000000013351432e-10
|
| 564 |
+
]
|
| 565 |
+
]
|
| 566 |
+
],
|
| 567 |
+
"q10": [
|
| 568 |
+
[
|
| 569 |
+
[
|
| 570 |
+
0.011738890798701846
|
| 571 |
+
]
|
| 572 |
+
],
|
| 573 |
+
[
|
| 574 |
+
[
|
| 575 |
+
0.011753173409107868
|
| 576 |
+
]
|
| 577 |
+
],
|
| 578 |
+
[
|
| 579 |
+
[
|
| 580 |
+
0.011736184418112122
|
| 581 |
+
]
|
| 582 |
+
]
|
| 583 |
+
],
|
| 584 |
+
"q50": [
|
| 585 |
+
[
|
| 586 |
+
[
|
| 587 |
+
0.1215985151103097
|
| 588 |
+
]
|
| 589 |
+
],
|
| 590 |
+
[
|
| 591 |
+
[
|
| 592 |
+
0.14110541699477114
|
| 593 |
+
]
|
| 594 |
+
],
|
| 595 |
+
[
|
| 596 |
+
[
|
| 597 |
+
0.1332753213438322
|
| 598 |
+
]
|
| 599 |
+
]
|
| 600 |
+
],
|
| 601 |
+
"q90": [
|
| 602 |
+
[
|
| 603 |
+
[
|
| 604 |
+
0.7453828626001331
|
| 605 |
+
]
|
| 606 |
+
],
|
| 607 |
+
[
|
| 608 |
+
[
|
| 609 |
+
0.7568375626963405
|
| 610 |
+
]
|
| 611 |
+
],
|
| 612 |
+
[
|
| 613 |
+
[
|
| 614 |
+
0.7529272492661963
|
| 615 |
+
]
|
| 616 |
+
]
|
| 617 |
+
],
|
| 618 |
+
"q99": [
|
| 619 |
+
[
|
| 620 |
+
[
|
| 621 |
+
0.8548546982560803
|
| 622 |
+
]
|
| 623 |
+
],
|
| 624 |
+
[
|
| 625 |
+
[
|
| 626 |
+
0.9294141918052381
|
| 627 |
+
]
|
| 628 |
+
],
|
| 629 |
+
[
|
| 630 |
+
[
|
| 631 |
+
0.9018160922892463
|
| 632 |
+
]
|
| 633 |
+
]
|
| 634 |
+
]
|
| 635 |
+
},
|
| 636 |
+
"frame_index": {
|
| 637 |
+
"min": [
|
| 638 |
+
0.0
|
| 639 |
+
],
|
| 640 |
+
"max": [
|
| 641 |
+
1349.0
|
| 642 |
+
],
|
| 643 |
+
"mean": [
|
| 644 |
+
645.8473053892216
|
| 645 |
+
],
|
| 646 |
+
"std": [
|
| 647 |
+
385.6579876921818
|
| 648 |
+
],
|
| 649 |
+
"count": [
|
| 650 |
+
10020
|
| 651 |
+
],
|
| 652 |
+
"q01": [
|
| 653 |
+
6.0100799999018255
|
| 654 |
+
],
|
| 655 |
+
"q10": [
|
| 656 |
+
65.10919999991977
|
| 657 |
+
],
|
| 658 |
+
"q50": [
|
| 659 |
+
329.10459999999995
|
| 660 |
+
],
|
| 661 |
+
"q90": [
|
| 662 |
+
1214.10000000008
|
| 663 |
+
],
|
| 664 |
+
"q99": [
|
| 665 |
+
1335.914700000098
|
| 666 |
+
]
|
| 667 |
+
},
|
| 668 |
+
"observation.state": {
|
| 669 |
+
"min": [
|
| 670 |
+
-2.6629040241241455,
|
| 671 |
+
-0.9707443714141846,
|
| 672 |
+
-0.00139999995008111,
|
| 673 |
+
-2.8248276710510254,
|
| 674 |
+
-0.0002800000074785203,
|
| 675 |
+
1.689454197883606,
|
| 676 |
+
-1.1979706287384033,
|
| 677 |
+
0.0
|
| 678 |
+
],
|
| 679 |
+
"max": [
|
| 680 |
+
0.001500000013038516,
|
| 681 |
+
-0.19699999690055847,
|
| 682 |
+
1.681524634361267,
|
| 683 |
+
-1.9759999513626099,
|
| 684 |
+
1.193623423576355,
|
| 685 |
+
2.7696967124938965,
|
| 686 |
+
0.7860000133514404,
|
| 687 |
+
0.5538171529769897
|
| 688 |
+
],
|
| 689 |
+
"mean": [
|
| 690 |
+
-1.7925470253664577,
|
| 691 |
+
-0.6693378328206296,
|
| 692 |
+
1.1522494854327447,
|
| 693 |
+
-2.5631897942034785,
|
| 694 |
+
0.7460712785135486,
|
| 695 |
+
2.1421918255126404,
|
| 696 |
+
-0.41110926812994264,
|
| 697 |
+
0.4416864119960876
|
| 698 |
+
],
|
| 699 |
+
"std": [
|
| 700 |
+
0.7203959542248837,
|
| 701 |
+
0.1380222003896954,
|
| 702 |
+
0.3612383707413262,
|
| 703 |
+
0.13529213807797963,
|
| 704 |
+
0.2415116117572613,
|
| 705 |
+
0.2606951023639512,
|
| 706 |
+
0.6166967290569723,
|
| 707 |
+
0.2191681345468733
|
| 708 |
+
],
|
| 709 |
+
"count": [
|
| 710 |
+
10020
|
| 711 |
+
],
|
| 712 |
+
"q01": [
|
| 713 |
+
-2.6557101011276245,
|
| 714 |
+
-0.9695837497711182,
|
| 715 |
+
0.632928803563118,
|
| 716 |
+
-2.8137674808502195,
|
| 717 |
+
0.2594849705696106,
|
| 718 |
+
1.6962623000144958,
|
| 719 |
+
-1.1632769107818604,
|
| 720 |
+
-1.000000013351432e-10
|
| 721 |
+
],
|
| 722 |
+
"q10": [
|
| 723 |
+
-2.6239187717437744,
|
| 724 |
+
-0.9069104790687561,
|
| 725 |
+
0.6933579444885254,
|
| 726 |
+
-2.783914089202881,
|
| 727 |
+
0.5080643892288208,
|
| 728 |
+
1.7516347765922546,
|
| 729 |
+
-1.1190085411071777,
|
| 730 |
+
-1.000000013351432e-10
|
| 731 |
+
],
|
| 732 |
+
"q50": [
|
| 733 |
+
-2.571694294611613,
|
| 734 |
+
-0.6813251376152039,
|
| 735 |
+
0.9314939975738525,
|
| 736 |
+
-2.6141486167907715,
|
| 737 |
+
0.6096886396408081,
|
| 738 |
+
2.1792736053466797,
|
| 739 |
+
-1.0438812971115112,
|
| 740 |
+
0.5516015672292865
|
| 741 |
+
],
|
| 742 |
+
"q90": [
|
| 743 |
+
-0.9007295370101929,
|
| 744 |
+
-0.4320572018623352,
|
| 745 |
+
1.6176453828811646,
|
| 746 |
+
-2.3596347173055015,
|
| 747 |
+
1.0723228454589844,
|
| 748 |
+
2.5126495361328125,
|
| 749 |
+
0.3515126705169678,
|
| 750 |
+
0.5538030751680924
|
| 751 |
+
],
|
| 752 |
+
"q99": [
|
| 753 |
+
-0.856689589364188,
|
| 754 |
+
-0.3517526149749756,
|
| 755 |
+
1.6760141849517822,
|
| 756 |
+
-2.0552183628082275,
|
| 757 |
+
1.160074770450592,
|
| 758 |
+
2.6160700798034666,
|
| 759 |
+
0.5732506513595581,
|
| 760 |
+
0.5538157451961
|
| 761 |
+
]
|
| 762 |
+
},
|
| 763 |
+
"action": {
|
| 764 |
+
"min": [
|
| 765 |
+
-1.1478731632232666,
|
| 766 |
+
-4.8213653564453125,
|
| 767 |
+
-6.9681854248046875,
|
| 768 |
+
-27.32980728149414,
|
| 769 |
+
-3.53182315826416,
|
| 770 |
+
-1.5483593940734863,
|
| 771 |
+
0.01720000058412552,
|
| 772 |
+
0.01720000058412552
|
| 773 |
+
],
|
| 774 |
+
"max": [
|
| 775 |
+
0.8919456601142883,
|
| 776 |
+
2.040548801422119,
|
| 777 |
+
2.556353807449341,
|
| 778 |
+
7.3572587966918945,
|
| 779 |
+
6.108026504516602,
|
| 780 |
+
2.833026885986328,
|
| 781 |
+
0.03999999910593033,
|
| 782 |
+
0.03999999910593033
|
| 783 |
+
],
|
| 784 |
+
"mean": [
|
| 785 |
+
-0.08644910675228133,
|
| 786 |
+
0.9225710551895782,
|
| 787 |
+
1.1011530246563301,
|
| 788 |
+
4.760189543227236,
|
| 789 |
+
0.43449598979093357,
|
| 790 |
+
-0.34911954188775157,
|
| 791 |
+
0.02178150823640966,
|
| 792 |
+
0.02178150823640966
|
| 793 |
+
],
|
| 794 |
+
"std": [
|
| 795 |
+
0.4509122991506937,
|
| 796 |
+
0.5622976402943648,
|
| 797 |
+
0.6886866775408784,
|
| 798 |
+
2.76173067013162,
|
| 799 |
+
2.6034700000173454,
|
| 800 |
+
0.612278021166472,
|
| 801 |
+
0.00905970509554574,
|
| 802 |
+
0.00905970509554574
|
| 803 |
+
],
|
| 804 |
+
"count": [
|
| 805 |
+
10020
|
| 806 |
+
],
|
| 807 |
+
"q01": [
|
| 808 |
+
-1.1225014925003052,
|
| 809 |
+
-0.07388143539428711,
|
| 810 |
+
-0.4089967608451843,
|
| 811 |
+
-0.5724983215332031,
|
| 812 |
+
-3.51198148727417,
|
| 813 |
+
-1.5050480365753174,
|
| 814 |
+
0.01720000058412552,
|
| 815 |
+
0.01720000058412552
|
| 816 |
+
],
|
| 817 |
+
"q10": [
|
| 818 |
+
-0.9399716258049011,
|
| 819 |
+
-0.002611324191093445,
|
| 820 |
+
-0.3101853132247925,
|
| 821 |
+
-0.0019207026647484822,
|
| 822 |
+
-3.3569037914276123,
|
| 823 |
+
-1.3758057753245037,
|
| 824 |
+
0.01720000058412552,
|
| 825 |
+
0.01720000058412552
|
| 826 |
+
],
|
| 827 |
+
"q50": [
|
| 828 |
+
-0.003410816192626953,
|
| 829 |
+
1.2040990591049194,
|
| 830 |
+
1.371724910206265,
|
| 831 |
+
6.2374587059021,
|
| 832 |
+
-3.1989541053771973,
|
| 833 |
+
-0.7735692262649536,
|
| 834 |
+
0.01720000058412552,
|
| 835 |
+
0.01720000058412552
|
| 836 |
+
],
|
| 837 |
+
"q90": [
|
| 838 |
+
0.4375326633453369,
|
| 839 |
+
1.4080634117126465,
|
| 840 |
+
1.6334465742111206,
|
| 841 |
+
7.244527101516724,
|
| 842 |
+
5.565688133239746,
|
| 843 |
+
0.4603039877755301,
|
| 844 |
+
0.03999782622613631,
|
| 845 |
+
0.03999782622613631
|
| 846 |
+
],
|
| 847 |
+
"q99": [
|
| 848 |
+
0.8008056044578552,
|
| 849 |
+
1.5859065651893616,
|
| 850 |
+
1.8017842769622803,
|
| 851 |
+
7.326128780841827,
|
| 852 |
+
6.07754921913147,
|
| 853 |
+
2.0114109992980955,
|
| 854 |
+
0.03999978181795093,
|
| 855 |
+
0.03999978181795093
|
| 856 |
+
]
|
| 857 |
+
}
|
| 858 |
+
}
|
meta/tasks.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3765f664e630606b2c4b9bb9caa5548e067d4d527665fc29f2a1be3117b14920
|
| 3 |
+
size 2399
|
provenance/camera_audit_hook.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Render-only camera persistence fix and actual camera/light telemetry."""
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import json, os
|
| 4 |
+
|
| 5 |
+
_context={'frame':None,'chunk':-1}
|
| 6 |
+
_logged=set()
|
| 7 |
+
|
| 8 |
+
def setup(env):
|
| 9 |
+
from isaaclab.utils.math import convert_camera_frame_orientation_convention
|
| 10 |
+
path=Path(os.environ['PILOT_CAMERA_LOG'])
|
| 11 |
+
episodes=json.loads(os.environ['PILOT_RENDER_EPISODES'])
|
| 12 |
+
gen=Path(os.environ.get('PILOT_GEN_ROOT',str(Path(__file__).parent/'data_gen/pilot')))
|
| 13 |
+
episodes.sort(key=lambda e:(json.loads((gen/e/'meta.json').read_text())['steps'],str(gen/e)))
|
| 14 |
+
lengths=[json.loads((gen/e/'meta.json').read_text())['steps'] for e in episodes]
|
| 15 |
+
stream=path.open('x',buffering=1)
|
| 16 |
+
origins=env.iscene.env_origins.detach().cpu().tolist()
|
| 17 |
+
from pxr import UsdLux
|
| 18 |
+
light = UsdLux.LightAPI(env.sim.stage.GetPrimAtPath('/World/light'))
|
| 19 |
+
path.with_suffix('.grid.json').write_text(json.dumps({'num_envs':env.num_envs,'origins':origins,
|
| 20 |
+
'actual_light_intensity':float(light.GetIntensityAttr().Get()),
|
| 21 |
+
'pilot_parts_box_prim_present':[bool(env.sim.stage.GetPrimAtPath(f'/World/envs/env_{i}/PilotPartsBox').IsValid()) for i in range(env.num_envs)],
|
| 22 |
+
'episodes_in_render_order':episodes,'pose_source':'Isaac camera XformPrimView after forced update',
|
| 23 |
+
'world_quaternion':'wxyz, +X forward +Z up','ros_quaternion':'wxyz, +Z forward -Y up'},indent=2))
|
| 24 |
+
for name,cam in env.iscene.sensors.items():
|
| 25 |
+
if not hasattr(cam.cfg,'data_types') or 'rgb' not in cam.cfg.data_types:continue
|
| 26 |
+
# TiledCamera otherwise returns INITIALIZATION poses even as pixels move.
|
| 27 |
+
cam.cfg.update_latest_camera_pose=True
|
| 28 |
+
if '/front' in cam.cfg.prim_path:
|
| 29 |
+
original_set=cam.set_world_poses
|
| 30 |
+
def persistent_set(positions=None,orientations=None,env_ids=None,convention='ros',
|
| 31 |
+
_original=original_set,_cam=cam):
|
| 32 |
+
_original(positions,orientations,env_ids,convention)
|
| 33 |
+
# In this installed Fabric backend, the next sim tick overwrites
|
| 34 |
+
# a world-only camera edit from its nominal USD local transform.
|
| 35 |
+
# External cameras are direct children of untranslated/identity
|
| 36 |
+
# env frames except for the audited env-origin translation.
|
| 37 |
+
ids=slice(None) if env_ids is None else env_ids
|
| 38 |
+
local=positions-env.iscene.env_origins[ids] if positions is not None else None
|
| 39 |
+
gl=convert_camera_frame_orientation_convention(orientations,origin=convention,target='opengl') if orientations is not None else None
|
| 40 |
+
_cam._view.set_local_poses(local,gl,env_ids)
|
| 41 |
+
_cam._pilot_expected_position=positions.detach().clone()
|
| 42 |
+
if convention=='world':_cam._pilot_expected_quat_world=orientations.detach().clone()
|
| 43 |
+
cam.set_world_poses=persistent_set
|
| 44 |
+
original=cam.update
|
| 45 |
+
def update(*a,_original=original,_cam=cam,_name=name,**kw):
|
| 46 |
+
result=_original(*a,**kw)
|
| 47 |
+
if kw.get('force_recompute') and _context['frame'] is not None:
|
| 48 |
+
d=_cam.data
|
| 49 |
+
for slot in range(env.num_envs):
|
| 50 |
+
j=_context['chunk']*env.num_envs+slot
|
| 51 |
+
if j>=len(episodes) or _context['frame']>=lengths[j]:continue
|
| 52 |
+
key=(j,_context['frame'],_name)
|
| 53 |
+
if key in _logged:continue
|
| 54 |
+
row={'episode':episodes[j],'env_slot':slot,'env_origin':origins[slot],
|
| 55 |
+
'frame_index':_context['frame'],'camera':_name,
|
| 56 |
+
'pos_w':d.pos_w[slot].detach().cpu().tolist(),
|
| 57 |
+
'quat_w_world':d.quat_w_world[slot].detach().cpu().tolist(),
|
| 58 |
+
'quat_w_ros':d.quat_w_ros[slot].detach().cpu().tolist(),
|
| 59 |
+
'intrinsic_matrix':d.intrinsic_matrices[slot].detach().cpu().tolist(),
|
| 60 |
+
'size':[_cam.cfg.width,_cam.cfg.height],
|
| 61 |
+
'clipping_range':list(_cam.cfg.spawn.clipping_range)}
|
| 62 |
+
if hasattr(_cam,'_pilot_expected_position'):
|
| 63 |
+
error=float((d.pos_w[slot]-_cam._pilot_expected_position[slot]).norm())
|
| 64 |
+
if error>.0001:raise RuntimeError(f'Camera pose did not persist: {_name} {error}')
|
| 65 |
+
row['requested_pose_error_m']=error
|
| 66 |
+
if hasattr(_cam,'_pilot_expected_quat_world'):
|
| 67 |
+
qerror=1-abs(float((d.quat_w_world[slot]*_cam._pilot_expected_quat_world[slot]).sum()))
|
| 68 |
+
if qerror>.0001:raise RuntimeError(f'Camera rotation did not persist: {_name} {qerror}')
|
| 69 |
+
row['requested_rotation_dot_error']=qerror
|
| 70 |
+
stream.write(json.dumps(row)+'\n');_logged.add(key)
|
| 71 |
+
return result
|
| 72 |
+
cam.update=update
|
| 73 |
+
|
| 74 |
+
def per_frame(env,t):
|
| 75 |
+
if t==0:_context['chunk']+=1
|
| 76 |
+
_context['frame']=int(t)
|
provenance/export_lerobot_completed.py
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Convert only frozen accepted motions with the installed official LeRobot API."""
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import argparse,hashlib,importlib.metadata,json,os,shutil,tarfile,time
|
| 4 |
+
os.environ.update(HF_HUB_OFFLINE='1',HF_DATASETS_OFFLINE='1')
|
| 5 |
+
import cv2
|
| 6 |
+
import numpy as np
|
| 7 |
+
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
| 8 |
+
from lerobot.configs.video import RGBEncoderConfig
|
| 9 |
+
from pipeline import ROOT,GEN,write_json,status
|
| 10 |
+
|
| 11 |
+
REPO_ID='local/pc_gpu_data_engine_8_osc_15hz'
|
| 12 |
+
TASK='Install the graphics card into the motherboard PCIe slot inside the computer case.'
|
| 13 |
+
ACTION_NAMES=['dx','dy','dz','drot_x','drot_y','drot_z','finger1_m','finger2_m']
|
| 14 |
+
STATE_NAMES=[f'joint_{i}_rad' for i in range(1,8)]+['gripper_closedness']
|
| 15 |
+
|
| 16 |
+
def sha(p):
|
| 17 |
+
h=hashlib.sha256()
|
| 18 |
+
with p.open('rb') as f:
|
| 19 |
+
for b in iter(lambda:f.read(2**20),b''):h.update(b)
|
| 20 |
+
return h.hexdigest()
|
| 21 |
+
|
| 22 |
+
def state(q):
|
| 23 |
+
q=q.astype(np.float32)
|
| 24 |
+
return np.concatenate([q[:,:7],(1-np.clip(q[:,7:9]/.04,0,1).mean(1))[:,None]],axis=1)
|
| 25 |
+
|
| 26 |
+
def preflight(selection):
|
| 27 |
+
grid=json.loads((ROOT/'evidence/lerobot_render8_camera_frames.grid.json').read_text())
|
| 28 |
+
assert grid['actual_light_intensity']==2500
|
| 29 |
+
assert all(grid['pilot_parts_box_prim_present'])
|
| 30 |
+
origins=np.asarray(grid['origins']);dist=np.linalg.norm(origins[:,None]-origins[None,:],axis=-1)
|
| 31 |
+
assert np.min(dist+np.eye(len(origins))*1e6)>=49.99
|
| 32 |
+
telemetry={}
|
| 33 |
+
for line in (ROOT/'evidence/lerobot_render8_camera_frames.jsonl').open():
|
| 34 |
+
r=json.loads(line);key=(r['episode'],r['camera'])
|
| 35 |
+
telemetry.setdefault(key,{})
|
| 36 |
+
assert r['frame_index'] not in telemetry[key]
|
| 37 |
+
assert np.isfinite(r['intrinsic_matrix']).all() and np.isfinite(r['pos_w']).all()
|
| 38 |
+
assert r['clipping_range'][1]<=40.001
|
| 39 |
+
telemetry[key][r['frame_index']]=r
|
| 40 |
+
audits=[]
|
| 41 |
+
for item in selection:
|
| 42 |
+
ep=GEN/item['episode'];m=json.loads((ep/'meta.json').read_text())
|
| 43 |
+
with np.load(ep/'traj.npz') as d:
|
| 44 |
+
a=d['action'];q=d['robot/joint_pos'];n=len(a)
|
| 45 |
+
assert a.shape==(m['steps'],8) and q.shape==(n,9)
|
| 46 |
+
assert np.isfinite(a).all() and np.isfinite(q).all()
|
| 47 |
+
for cam in ('front','wrist'):
|
| 48 |
+
name=cam+'_lerobot';r=json.loads((ep/'imgs'/f'render_{name}.json').read_text())
|
| 49 |
+
rows=telemetry[(item['episode'],name)]
|
| 50 |
+
assert r['frame_indices']==list(range(n))==sorted(rows)
|
| 51 |
+
assert r['fps']==15 and r['size']==[320,240]
|
| 52 |
+
audits.append({'episode':item['episode'],'camera':cam,'aligned_frames':n})
|
| 53 |
+
return audits
|
| 54 |
+
|
| 55 |
+
def convert(out,selection):
|
| 56 |
+
assert not out.exists(),f'Refusing overwrite: {out}'
|
| 57 |
+
out.mkdir()
|
| 58 |
+
features={
|
| 59 |
+
'observation.state':{'dtype':'float32','shape':(8,),'names':STATE_NAMES},
|
| 60 |
+
'action':{'dtype':'float32','shape':(8,),'names':ACTION_NAMES},
|
| 61 |
+
'complementary_info.action_noise':{'dtype':'float32','shape':(8,),'names':ACTION_NAMES},
|
| 62 |
+
'complementary_info.executed_action':{'dtype':'float32','shape':(8,),'names':ACTION_NAMES},
|
| 63 |
+
**{f'observation.images.{cam}':{'dtype':'video','shape':(240,320,3),
|
| 64 |
+
'names':['height','width','channels']} for cam in ('front','wrist')}}
|
| 65 |
+
ds=LeRobotDataset.create(REPO_ID,15,features,root=out/'dataset',robot_type='franka_osc',
|
| 66 |
+
use_videos=True,video_backend='pyav',streaming_encoding=True,encoder_threads=2,
|
| 67 |
+
rgb_encoder=RGBEncoderConfig(vcodec='h264',crf=18,preset='fast',g=2),
|
| 68 |
+
metadata_buffer_size=1)
|
| 69 |
+
mapping=[]
|
| 70 |
+
for i,item in enumerate(selection):
|
| 71 |
+
ep=GEN/item['episode'];m=json.loads((ep/'meta.json').read_text())
|
| 72 |
+
with np.load(ep/'traj.npz') as d:
|
| 73 |
+
action=d['action'].astype(np.float32);s=state(d['robot/joint_pos'])
|
| 74 |
+
noise=d['action_noise'].astype(np.float32) if 'action_noise' in d else np.zeros_like(action)
|
| 75 |
+
caps={cam:cv2.VideoCapture(str(ep/'imgs'/f'{cam}_lerobot.mp4')) for cam in ('front','wrist')}
|
| 76 |
+
for cam,cap in caps.items():
|
| 77 |
+
assert int(cap.get(cv2.CAP_PROP_FRAME_COUNT))==len(action)
|
| 78 |
+
assert abs(cap.get(cv2.CAP_PROP_FPS)-15)<.001
|
| 79 |
+
blank=[]
|
| 80 |
+
for t in range(len(action)):
|
| 81 |
+
frame={'task':TASK,'observation.state':s[t],'action':action[t],
|
| 82 |
+
'complementary_info.action_noise':noise[t],
|
| 83 |
+
'complementary_info.executed_action':(action[t]+noise[t]).astype(np.float32)}
|
| 84 |
+
for cam,cap in caps.items():
|
| 85 |
+
ok,img=cap.read();assert ok,(i,cam,t)
|
| 86 |
+
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
|
| 87 |
+
if gray.mean()<2 or gray.std()<1:blank.append([cam,t])
|
| 88 |
+
frame[f'observation.images.{cam}']=cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
|
| 89 |
+
ds.add_frame(frame)
|
| 90 |
+
assert not blank,blank
|
| 91 |
+
for cap in caps.values():cap.release()
|
| 92 |
+
ds.save_episode(parallel_encoding=False)
|
| 93 |
+
source=out/'source_trajectories'/f'episode_{i:03d}';source.mkdir(parents=True)
|
| 94 |
+
shutil.copy2(ep/'traj.npz',source/'traj.npz');shutil.copy2(ep/'meta.json',source/'meta.json')
|
| 95 |
+
for cam in caps:
|
| 96 |
+
shutil.copy2(ep/'imgs'/f'render_{cam}_lerobot.json',source/f'render_{cam}.json')
|
| 97 |
+
mapping.append(dict(episode_index=i,source_episode=item['episode'],cell=item['cell'],
|
| 98 |
+
seed=item['seed'],entry=m.get('entry'),frames=len(action),controller=m['controller'],
|
| 99 |
+
source_trajectory_sha256=item['trajectory_sha256'],perturbed_rows=int(np.any(noise!=0,axis=1).sum()),
|
| 100 |
+
source_split_group=item['trajectory_sha256'],success=True,replay_checked=False))
|
| 101 |
+
write_json(out/'episode_mapping.json',mapping)
|
| 102 |
+
status('LEROBOT_CONVERTING',completed_episodes=i+1,total=len(selection))
|
| 103 |
+
print('CONVERTED',i,len(action),flush=True)
|
| 104 |
+
ds.finalize()
|
| 105 |
+
audit=out/'provenance';audit.mkdir()
|
| 106 |
+
for name in ('lerobot_selection.json','evidence/user_stop_20261012.json',
|
| 107 |
+
'evidence/lerobot_render8_camera_frames.jsonl','evidence/lerobot_render8_camera_frames.grid.json',
|
| 108 |
+
'evidence/lerobot_render8_command.json','evidence/lerobot_render8_result.json',
|
| 109 |
+
'evidence/runtime_versions.json','evidence/source_hashes.json'):
|
| 110 |
+
shutil.copy2(ROOT/name,audit/Path(name).name)
|
| 111 |
+
for name in ('export_lerobot_completed.py','render_completed_for_export.py','pipeline.py','camera_audit_hook.py'):
|
| 112 |
+
shutil.copy2(ROOT/name,audit/name)
|
| 113 |
+
# Preserve exact code/parameters for accepted batches, excluding assets and unfinished runs.
|
| 114 |
+
for batch in sorted({Path(x['episode']).parts[1] for x in selection}):
|
| 115 |
+
shutil.copytree(ROOT/'evidence/attempts'/batch,audit/'generation_code'/batch,
|
| 116 |
+
ignore=shutil.ignore_patterns('__pycache__'))
|
| 117 |
+
shutil.copy2(ROOT/'evidence'/f'{batch}_result.json',audit/f'{batch}_result.json')
|
| 118 |
+
shutil.copy2(ROOT/'logs'/f'{batch}.log',audit/f'{batch}.log')
|
| 119 |
+
|
| 120 |
+
def validate(out,selection):
|
| 121 |
+
ds=LeRobotDataset(REPO_ID,root=out/'dataset',video_backend='pyav',tolerance_s=.005,
|
| 122 |
+
return_uint8=True)
|
| 123 |
+
assert ds.num_episodes==len(selection)==8
|
| 124 |
+
table=ds.hf_dataset
|
| 125 |
+
checks=[];offset=0
|
| 126 |
+
for i,item in enumerate(selection):
|
| 127 |
+
ep=GEN/item['episode']
|
| 128 |
+
with np.load(ep/'traj.npz') as d:
|
| 129 |
+
a=d['action'].astype(np.float32);s=state(d['robot/joint_pos'])
|
| 130 |
+
noise=d['action_noise'].astype(np.float32) if 'action_noise' in d else np.zeros_like(a)
|
| 131 |
+
rows=table.select(range(offset,offset+len(a)))
|
| 132 |
+
maxima={}
|
| 133 |
+
for key,ref in [('action',a),('observation.state',s),('complementary_info.action_noise',noise),
|
| 134 |
+
('complementary_info.executed_action',a+noise)]:
|
| 135 |
+
actual=np.asarray(rows[key],dtype=np.float32)
|
| 136 |
+
maxima[key]=float(np.max(np.abs(actual-ref)))
|
| 137 |
+
assert maxima[key]<=2e-6,(i,key,maxima[key])
|
| 138 |
+
assert np.array_equal(np.asarray(rows['frame_index']),np.arange(len(a)))
|
| 139 |
+
assert np.all(np.asarray(rows['episode_index'])==i)
|
| 140 |
+
assert np.max(abs(np.asarray(rows['timestamp'])-np.arange(len(a))/15))<.0001
|
| 141 |
+
images=[]
|
| 142 |
+
for t in sorted({0,len(a)//4,len(a)//2,3*len(a)//4,len(a)-1}):
|
| 143 |
+
sample=ds[offset+t]
|
| 144 |
+
for cam in ('front','wrist'):
|
| 145 |
+
actual=sample[f'observation.images.{cam}'].numpy().transpose(1,2,0)
|
| 146 |
+
assert actual.shape==(240,320,3)
|
| 147 |
+
cap=cv2.VideoCapture(str(ep/'imgs'/f'{cam}_lerobot.mp4'));cap.set(cv2.CAP_PROP_POS_FRAMES,t)
|
| 148 |
+
ok,ref=cap.read();cap.release();assert ok
|
| 149 |
+
ref=cv2.cvtColor(ref,cv2.COLOR_BGR2RGB)
|
| 150 |
+
mae=float(np.mean(abs(actual.astype(float)-ref.astype(float))))
|
| 151 |
+
assert mae<12,(i,t,cam,mae)
|
| 152 |
+
images.append(dict(frame=t,camera=cam,shape=list(actual.shape),rgb_mean_absolute_error=mae))
|
| 153 |
+
checks.append(dict(episode=i,frames=len(a),all_numeric_rows_max_error=maxima,decoded_image_checks=images))
|
| 154 |
+
offset+=len(a)
|
| 155 |
+
print('VALIDATED',i,flush=True)
|
| 156 |
+
assert len(ds)==offset
|
| 157 |
+
info=json.loads((out/'dataset/meta/info.json').read_text())
|
| 158 |
+
report=dict(passed=True,episodes=len(selection),frames=offset,fps=15,
|
| 159 |
+
lerobot_package=importlib.metadata.version('lerobot'),codebase_version=info['codebase_version'],
|
| 160 |
+
numeric_alignment='every row checked against source NPZ',camera_render_alignment=preflight(selection),
|
| 161 |
+
image_alignment='five times per episode per camera checked through official LeRobotDataset decoder',checks=checks,
|
| 162 |
+
all_source_video_frames_read_and_nonblank=True,action_replay_checked=False)
|
| 163 |
+
write_json(out/'validation_report.json',report)
|
| 164 |
+
return report
|
| 165 |
+
|
| 166 |
+
def package(out,report):
|
| 167 |
+
selection=json.loads((ROOT/'lerobot_selection.json').read_text())['selected']
|
| 168 |
+
sheet=np.full((8*150,4*320,3),245,np.uint8)
|
| 169 |
+
for i,item in enumerate(selection):
|
| 170 |
+
ep=GEN/item['episode']
|
| 171 |
+
n=item['steps']
|
| 172 |
+
for j,t in enumerate([0,n//3,2*n//3,n-1]):
|
| 173 |
+
for c,cam in enumerate(('front','wrist')):
|
| 174 |
+
cap=cv2.VideoCapture(str(ep/'imgs'/f'{cam}_lerobot.mp4'));cap.set(cv2.CAP_PROP_POS_FRAMES,t)
|
| 175 |
+
ok,img=cap.read();cap.release();assert ok
|
| 176 |
+
x=j*320+c*160;y=i*150+30
|
| 177 |
+
sheet[y:y+120,x:x+160]=cv2.resize(img,(160,120))
|
| 178 |
+
cv2.putText(sheet,f'ep{i} t={t/15:.1f}s front | wrist',(j*320+5,i*150+21),
|
| 179 |
+
cv2.FONT_HERSHEY_SIMPLEX,.42,(20,20,20),1,cv2.LINE_AA)
|
| 180 |
+
cv2.imwrite(str(out/'preview.jpg'),sheet)
|
| 181 |
+
readme=f'''显卡安装 LeRobot 小数据集(用户提前停止扩增后的已完成部分)
|
| 182 |
+
|
| 183 |
+
dataset/ 是可独立移动的 LeRobot 数据根目录,使用官方 LeRobotDataset 创建并重新加载验证。
|
| 184 |
+
LeRobot Python 包:{report['lerobot_package']};数据格式:{report['codebase_version']}。
|
| 185 |
+
共 {report['episodes']} 个 episode,{report['frames']} 帧,15Hz,front+wrist 双相机 RGB 320×240。
|
| 186 |
+
一条动作只有一套视觉画面;没有生成20条或60组,不宣称五阶段扩增已全部完成。
|
| 187 |
+
|
| 188 |
+
observation.state:7个臂关节角(rad)+夹爪闭合度 1-mean(clip(finger_q/.04,0,1))。
|
| 189 |
+
action:源NPZ的干净OSC8命令原样复制:3平移增量、3旋转轴角增量、2手指绝对位置(m)。
|
| 190 |
+
前6维通过对应控制器的比例/滤波解释,不应直接当作末端绝对位姿。
|
| 191 |
+
complementary_info.action_noise:实际施加的加性命令扰动。
|
| 192 |
+
complementary_info.executed_action:action+action_noise;之后仍经过原控制器。
|
| 193 |
+
源NPZ、完整控制器元信息、阶段入口、实际相机内外参和代码快照一起保留。
|
| 194 |
+
|
| 195 |
+
使用:
|
| 196 |
+
from lerobot.datasets.lerobot_dataset import LeRobotDataset
|
| 197 |
+
ds = LeRobotDataset('{REPO_ID}', root='/替换成你的绝对路径/dataset', video_backend='pyav')
|
| 198 |
+
print(len(ds), ds[0]['action'], ds[0]['observation.images.front'].shape)
|
| 199 |
+
|
| 200 |
+
数据格式可用于LeRobot,但未训练模型。与新RAW OSC8模型更接近;复用模型前仍需核对
|
| 201 |
+
控制器比例/滤波、图像尺寸和相机分布。不能直接用于旧430条的关节目标动作模型。
|
| 202 |
+
本小批次没有划分训练/验证集;meta/stats.json由本数据计算。
|
| 203 |
+
|
| 204 |
+
8条源轨迹均通过在线安装、松手和5秒稳定检查。其中1条从真实运行到插入前的状态开始记录;
|
| 205 |
+
其他7条为完整起点。引擎会裁掉部分成功等待尾段,所以保存的视频不一定包含最后5秒保持。
|
| 206 |
+
视频是已记录状态的渲染,不是动作开环回放验证;腕部有正常的显卡局部遮挡。
|
| 207 |
+
相机是本项目声明的视角,不声称与作者历史数据相机完全一致。
|
| 208 |
+
8条是有限样本,不能当作论文或VLA模型成功率。
|
| 209 |
+
|
| 210 |
+
episode_mapping.json:每条数据对应的源轨迹、策略、seed、阶段和控制器。
|
| 211 |
+
validation_report.json:全部数值行对齐,以及官方加载器实际读取双相机的验证。
|
| 212 |
+
source_trajectories/:原始NPZ和元数据。
|
| 213 |
+
provenance/:精确生成代码、日志、渲染参数和逐帧相机记录。
|
| 214 |
+
'''
|
| 215 |
+
(out/'README.txt').write_text(readme)
|
| 216 |
+
files=[p for p in sorted(out.rglob('*')) if p.is_file()]
|
| 217 |
+
assert not any(p.is_symlink() for p in out.rglob('*'))
|
| 218 |
+
total=sum(p.stat().st_size for p in files);assert total<10*1024**3,total
|
| 219 |
+
write_json(out/'checksums.json',dict(total_bytes_before_manifest=total,
|
| 220 |
+
files=[dict(path=str(p.relative_to(out)),bytes=p.stat().st_size,sha256=sha(p)) for p in files]))
|
| 221 |
+
archive=out.with_suffix('.tar.gz');assert not archive.exists()
|
| 222 |
+
with tarfile.open(archive,'w:gz') as tar:tar.add(out,arcname='pc_gpu_lerobot_20261012')
|
| 223 |
+
assert archive.stat().st_size<10*1024**3
|
| 224 |
+
write_json(out.with_suffix('.archive.json'),dict(archive=str(archive),bytes=archive.stat().st_size,
|
| 225 |
+
sha256=sha(archive),uncompressed_bytes=sum(p.stat().st_size for p in out.rglob('*') if p.is_file())))
|
| 226 |
+
status('LEROBOT_READY_FOR_MAC',episodes=8,frames=report['frames'],archive=str(archive),bytes=archive.stat().st_size)
|
| 227 |
+
print('READY',archive,archive.stat().st_size,flush=True)
|
| 228 |
+
|
| 229 |
+
if __name__=='__main__':
|
| 230 |
+
ap=argparse.ArgumentParser();ap.add_argument('--output',type=Path,default=ROOT/'lerobot_export_8')
|
| 231 |
+
ap.add_argument('--validate-only',action='store_true');args=ap.parse_args()
|
| 232 |
+
selection=json.loads((ROOT/'lerobot_selection.json').read_text())['selected']
|
| 233 |
+
assert len(selection)==8
|
| 234 |
+
preflight(selection)
|
| 235 |
+
if not args.validate_only:convert(args.output,selection)
|
| 236 |
+
report=validate(args.output,selection)
|
| 237 |
+
package(args.output,report)
|
provenance/generation_code/h_s0_1/grader.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Grader for the pc_gpu scene: the graphics card seated in the PCIe x16 slot.
|
| 2 |
+
|
| 3 |
+
Rubric stages (weights and modes live in RUBRIC):
|
| 4 |
+
grasped the card has been taken in the weld-on-closure grip (`scene.grasp_held`) — the
|
| 5 |
+
scene's own grasp state; a milestone, latched. Also true once the card is
|
| 6 |
+
aligned in the slot (a card in the slot was necessarily carried there), so the
|
| 7 |
+
rung nests under `aligned`. Under an embodiment with no gripper (the weld
|
| 8 |
+
contract disabled, e.g. robot="null") the grasp state does not exist and the
|
| 9 |
+
rung reads from that implication alone
|
| 10 |
+
aligned the card lined up on the slot — origin within `align_xy` of the seated point,
|
| 11 |
+
up axis within `align_axis_deg` of the slot axis, length axis within
|
| 12 |
+
`align_yaw_deg` of the slot heading: the scene's own three non-depth seat gates
|
| 13 |
+
pressed tab depth below the slot mouth (`slot_mouth_z`, the scene's own `engaged()`)
|
| 14 |
+
as a fraction of `seat_depth`, counted only while aligned — so it is 1.0 iff
|
| 15 |
+
the scene calls the card seated
|
| 16 |
+
Every stage is per env. The rungs nest (seated => aligned => grasped), so progress reaches
|
| 17 |
+
1.0 exactly when the card is seated, and for a grader built after the pick as well as one
|
| 18 |
+
that watched it. The rear-panel pass-through is NOT a rung: the cutout's geometry is not in
|
| 19 |
+
the scene cfg, so it cannot be read from state without an invented tolerance. Success is
|
| 20 |
+
the scene's `seated()` per env — depth, xy, tilt AND heading gates — read when the
|
| 21 |
+
delivery finishes.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
|
| 28 |
+
from robobench.core import BaseGrader
|
| 29 |
+
# baked by data_engine init: grade against the LOCAL scene copy (../scene/scene.py),
|
| 30 |
+
# exec'd at most once per process under a fixed module key.
|
| 31 |
+
import importlib.util as _ilu
|
| 32 |
+
import sys as _sys
|
| 33 |
+
from pathlib import Path as _Path
|
| 34 |
+
|
| 35 |
+
if "datagen_local_scene" not in _sys.modules:
|
| 36 |
+
import robobench as _rb
|
| 37 |
+
_rb.discover()
|
| 38 |
+
_p = _Path(__file__).resolve().parent.parent / "scene" / "scene.py"
|
| 39 |
+
_spec = _ilu.spec_from_file_location("datagen_local_scene", _p)
|
| 40 |
+
_m = _ilu.module_from_spec(_spec)
|
| 41 |
+
_sys.modules["datagen_local_scene"] = _m
|
| 42 |
+
_spec.loader.exec_module(_m)
|
| 43 |
+
PcGpuAssemblyScene = _sys.modules["datagen_local_scene"].PcGpuAssemblyScene
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PcGpuAssemblyGrader(BaseGrader):
|
| 47 |
+
"""The card seated in its slot — pressed to depth, centred, upright, heading along the slot.
|
| 48 |
+
|
| 49 |
+
Ladder: grasped 0.33 · aligned 0.67 · pressed 1.00 — three equal rungs for the three
|
| 50 |
+
steps of the task (take the card, line it up on the slot, press it home); the last rung
|
| 51 |
+
is a linear ramp of tab depth from the slot mouth (`slot_mouth_z`) to `seat_depth`.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
SCENE = PcGpuAssemblyScene
|
| 55 |
+
RUBRIC = (("grasped", 1, "once"), ("aligned", 1), ("pressed", 1))
|
| 56 |
+
scene: PcGpuAssemblyScene
|
| 57 |
+
|
| 58 |
+
def setup(self) -> None:
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# `grasp_held` exists only while the weld contract is live (a gripper on the stage).
|
| 62 |
+
self._has_grasp = hasattr(self.scene, "grasp_held")
|
| 63 |
+
self._grasped = torch.zeros(self.num_envs, dtype=torch.bool,
|
| 64 |
+
device=self.scene.engaged().device) # latch: card ever held
|
| 65 |
+
|
| 66 |
+
def check_success(self):
|
| 67 |
+
return self.scene.seated() # (num_envs,)
|
| 68 |
+
|
| 69 |
+
def _aligned(self):
|
| 70 |
+
"""(num_envs,) bool: the scene's xy + tilt + heading seat gates, without depth."""
|
| 71 |
+
c = self.scene.cfg
|
| 72 |
+
rel = self.scene._card_offset_in_case() # (n, 3), zero at the seated pose — privileged
|
| 73 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 74 |
+
up_ok = self.scene._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 75 |
+
yaw_ok = self.scene._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 76 |
+
return xy_ok & up_ok & yaw_ok
|
| 77 |
+
|
| 78 |
+
# ---- rubric stages — each returns a (num_envs,) value in [0, 1] ---------------------
|
| 79 |
+
def grasped(self):
|
| 80 |
+
if self._has_grasp:
|
| 81 |
+
self._grasped |= self.scene.grasp_held.any(dim=1)
|
| 82 |
+
return (self._grasped | self._aligned()).float()
|
| 83 |
+
|
| 84 |
+
def aligned(self):
|
| 85 |
+
return self._aligned().float()
|
| 86 |
+
|
| 87 |
+
def pressed(self):
|
| 88 |
+
depth = self.scene.engaged() # (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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PcGpuAssemblyScene — insert a graphics card into the PC's PCIe slot.
|
| 2 |
+
|
| 3 |
+
The same gaming-PC case as `pc_motherboard` lies on its side on the table, opening up, motherboard
|
| 4 |
+
facing the ceiling — but here the board's PCIe area is the work site. Beside the case lies a loose
|
| 5 |
+
RTX 2060 (extracted from the PC model as its own rigid body, backplate down). Goal (carried here,
|
| 6 |
+
no task layer): stand the card upright over the primary x16 slot, line its PCB edge up with the
|
| 7 |
+
slot, and press it straight down until it seats.
|
| 8 |
+
|
| 9 |
+
The case is one kinematic body that never moves — the PC model stays visual-only; its physics is
|
| 10 |
+
an invisible fixture inside the case body: a channel whose walls grip the card's 4 mm PCB tab at
|
| 11 |
+
0.15 mm/side (flaring to a 1.2 mm/side funnel mouth — idealizing the real slot's spring
|
| 12 |
+
contacts, and capping the unscrewed card's gravity roll at ~2 deg), a floor whose top is the
|
| 13 |
+
model's own seated tab height, end stops (~1.6 mm play), a flush board plate so a dropped card
|
| 14 |
+
rests on the board face, and a REAR I/O PANEL frame around the expansion-slot cutout — so the
|
| 15 |
+
card must be placed inside the case, slid rearward until its bracket/ports pass through the
|
| 16 |
+
opening, and only then pressed down (a straight vertical drop is physically blocked by the
|
| 17 |
+
panel above the cutout, exactly like a real build). The card's origin is its
|
| 18 |
+
PCB-tab bottom CENTRE with axes equal to the case's, so the seated pose is just `seat_pos` +
|
| 19 |
+
identity orientation in the case frame, and insertion depth is a z difference.
|
| 20 |
+
|
| 21 |
+
Heavy imports (isaaclab, pxr) are deferred so importing this module stays app-free.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
from robobench.core.assets import asset_path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, ClassVar
|
| 31 |
+
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
from robobench.core import GraspWeldContract, SCENES, BaseCfg, BaseScene, SimCfg
|
| 35 |
+
|
| 36 |
+
if TYPE_CHECKING:
|
| 37 |
+
from isaaclab.assets import RigidObject
|
| 38 |
+
|
| 39 |
+
from robobench.core import BaseEnv
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class PcGpuAssemblySceneCfg(BaseCfg):
|
| 44 |
+
"""Config for `PcGpuAssemblyScene`. Nothing is locked — a variant is just a copy with a few
|
| 45 |
+
fields changed."""
|
| 46 |
+
|
| 47 |
+
# --- the curriculum / difficulty dials -----------------------------------------------
|
| 48 |
+
# The card is "seated" when — in the case's frame — its tab is >= `seat_depth` below the slot
|
| 49 |
+
# mouth, its origin is within `align_xy` of the seated point, and its axes are within
|
| 50 |
+
# `align_axis_deg` (tilt) / `align_yaw_deg` (heading along the slot) of the case's. The full
|
| 51 |
+
# stroke from the slot mouth to the channel floor is 5 mm, so 4 mm separates "seated" from
|
| 52 |
+
# "merely resting in the mouth".
|
| 53 |
+
seat_depth: float = 0.004 # min tab depth below the slot mouth (m) to count as seated
|
| 54 |
+
align_xy: float = 0.003 # max distance (m) of the card origin from the seated point
|
| 55 |
+
align_axis_deg: float = 3.0 # max tilt of the card's up axis off the slot axis (deg)
|
| 56 |
+
align_yaw_deg: float = 3.0 # max heading error of the card's length axis (deg)
|
| 57 |
+
reset_pos_jitter: float = 0.01 # uniform +/- xy jitter for the loose card at reset (m)
|
| 58 |
+
# Part friction (static = dynamic), set on every shape at bind. The moving card runs moderately
|
| 59 |
+
# slick against a grippier fixed case, so it slides down the channel but holds seat.
|
| 60 |
+
card_friction: float = 0.3
|
| 61 |
+
case_friction: float = 0.75
|
| 62 |
+
# Weld-on-closure grasping (the benchmark's auto-weld contract, PhysX
|
| 63 |
+
# form — the grasp-weld machinery at the end of this scene class):
|
| 64 |
+
# close the fingers squarely across the card's body slab near its top edge and the card welds
|
| 65 |
+
# to the hand; open wide to release. Gripper envs only (no-op under robot="null").
|
| 66 |
+
grasp_weld: bool = True
|
| 67 |
+
grasp_weld_dist: float = 0.010 # pinch-point-to-grip-band engage radius (m)
|
| 68 |
+
|
| 69 |
+
pilot_jitter_x: float = 0.004
|
| 70 |
+
pilot_jitter_y: float = 0.0007
|
| 71 |
+
|
| 72 |
+
# --- structure, reset layout, masses, asset paths (fixed) -------------------------------
|
| 73 |
+
# Seated card origin (its PCB-tab bottom centre) in the case's local frame; orientation seated
|
| 74 |
+
# = the case's own axes (identity). Baked into the committed USDs (keep in sync if they change).
|
| 75 |
+
seat_pos: tuple[float, float, float] = (-0.01595, 0.0293, 0.0035)
|
| 76 |
+
slot_mouth_z: float = 0.0085 # slot top in the case frame: depth datum (5 mm at full seat)
|
| 77 |
+
board_top: float = 0.0 # board face height in the case frame (the asset's own origin)
|
| 78 |
+
case_lift: float = 0.0289 # board face above the side panel the case lies on
|
| 79 |
+
card_mass: float = 1.0 # dual-fan RTX 2060 (kg)
|
| 80 |
+
light_intensity: float = 2500.0
|
| 81 |
+
# Loose card start pose: lying backplate-down on the table beside the case (+x side; the case
|
| 82 |
+
# spans x < 0.13 and the lying card's tail reaches origin_x - 0.132).
|
| 83 |
+
card_init_xy: tuple[float, float] = (0.28, 0.0) # card start xy (table-rel.)
|
| 84 |
+
card_init_z: float = 0.0022 # origin height lying backplate-down (backplate plane -2 mm)
|
| 85 |
+
card_init_quat: tuple[float, float, float, float] = (0.70711, 0.70711, 0.0, 0.0) # flat
|
| 86 |
+
card_contact_offset: float = 0.0001 # well below the 0.15 mm/side channel grip
|
| 87 |
+
case_contact_offset: float = 0.0001 # ditto for the slot fixture's walls
|
| 88 |
+
# Optional foam holder (a floor pad + two rails flanking the card's 36 mm body slab) that
|
| 89 |
+
# presents the card UPRIGHT for a parallel-jaw grasp. The lying default is ungraspable by a
|
| 90 |
+
# Franka gripper: flat on its backplate the card's only sub-80 mm dimension (the 36 mm body
|
| 91 |
+
# thickness) points UP, so no top-down or side pinch can straddle it. Enable together with an
|
| 92 |
+
# upright `card_init_quat` (identity = the seated orientation) and `card_init_z` = the
|
| 93 |
+
# holder's floor top; the rails cap the free card's lean at ~3 deg and the pick pulls
|
| 94 |
+
# straight up out of them.
|
| 95 |
+
card_stand: bool = False
|
| 96 |
+
card_stand_gap: float = 0.0025 # rail clearance per side around the body slab (m)
|
| 97 |
+
# Selectable work surface (same presets as the sibling scenes).
|
| 98 |
+
table: str = "lab_table" # which work surface: "lab_table" | "packing"
|
| 99 |
+
surface_z: float | None = None # table-top height (m); None -> the preset's
|
| 100 |
+
workbench_pos: tuple[float, float] | None = None # xy the table sits at; None -> preset
|
| 101 |
+
workbench_usd: str = "" # empty -> the preset's vendored USD
|
| 102 |
+
TABLES: ClassVar[dict[str, dict[str, Any]]] = {
|
| 103 |
+
"lab_table": {"usd": ("lab_table", "table_instanceable.usd"), "scale": 1.0,
|
| 104 |
+
"orient": (0.70711, 0.0, 0.0, 0.70711), "surface_z": 0.0, "pos": (0.5, 0.0),
|
| 105 |
+
"top_offset": 0.0, "height": 1.05, "kinematic": False},
|
| 106 |
+
"packing": {"usd": ("packing_table", "SM_HeavyDutyPackingTable_C02_01_physics.usd"), "scale": 0.01,
|
| 107 |
+
"orient": (1.0, 0.0, 0.0, 0.0), "surface_z": 0.994, "pos": (0.0, 0.0),
|
| 108 |
+
"top_offset": 0.994, "height": 0.994, "kinematic": True},
|
| 109 |
+
}
|
| 110 |
+
# Asset USDs; empty -> the prebuilt assets committed under `assets/`.
|
| 111 |
+
asset_dir: str = ""
|
| 112 |
+
case_usd: str = ""
|
| 113 |
+
card_usd: str = ""
|
| 114 |
+
|
| 115 |
+
def __post_init__(self) -> None:
|
| 116 |
+
assets = asset_path(Path(__file__).resolve().parents[1] / "assets")
|
| 117 |
+
self.asset_dir = self.asset_dir or str(assets)
|
| 118 |
+
self.case_usd = self.case_usd or str(Path(self.asset_dir) / "pc" / "pc_case_gpu_assembly_mb.usd")
|
| 119 |
+
self.card_usd = self.card_usd or str(Path(self.asset_dir) / "pc" / "gpu_rtx2060.usd")
|
| 120 |
+
preset = self.TABLES[self.table]
|
| 121 |
+
if self.surface_z is None:
|
| 122 |
+
self.surface_z = preset["surface_z"]
|
| 123 |
+
if self.workbench_pos is None:
|
| 124 |
+
self.workbench_pos = preset["pos"]
|
| 125 |
+
self.workbench_usd = self.workbench_usd or str(assets / "props" / preset["usd"][0] / preset["usd"][1])
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@SCENES.register("pc_gpu_local")
|
| 129 |
+
class PcGpuAssemblyScene(BaseScene):
|
| 130 |
+
cfg: PcGpuAssemblySceneCfg
|
| 131 |
+
|
| 132 |
+
# Object physics remains nominal in this pilot; L4 uses the recorded noise channel.
|
| 133 |
+
PHYSICAL_PARAMS = {'card_mass': None, 'card_friction': None, 'case_friction': None}
|
| 134 |
+
VISUAL_PARAMS = {'light_intensity': {'dist': 'choice', 'options': [1600., 2500., 3400.]}}
|
| 135 |
+
CAMERAS = {'front': {'eye': (-.1, -1.06, 1.282), 'target': (.42, -.08, .06),
|
| 136 |
+
'focal': 16., 'bands': {
|
| 137 |
+
'eye_x': {'dist': 'uniform', 'lo': -.125, 'hi': -.075},
|
| 138 |
+
'eye_y': {'dist': 'uniform', 'lo': -1.085, 'hi': -1.035},
|
| 139 |
+
'target_x': {'dist': 'uniform', 'lo': .405, 'hi': .435}}}}
|
| 140 |
+
|
| 141 |
+
def apply_visual_params(self, env, values):
|
| 142 |
+
# Render-only light; never touches geometry, contact, or robot control.
|
| 143 |
+
from pxr import UsdLux
|
| 144 |
+
if 'light_intensity' in values:
|
| 145 |
+
prim = env.sim.stage.GetPrimAtPath('/World/light')
|
| 146 |
+
UsdLux.LightAPI(prim).GetIntensityAttr().Set(float(values['light_intensity']))
|
| 147 |
+
|
| 148 |
+
# Card-local y extent of the body collision slab (from gpu_rtx2060.usd `/gpu/collision/body`:
|
| 149 |
+
# backplate plane -2 mm, fan-shroud plane +32.8 mm around the PCB-tab-centre origin — the
|
| 150 |
+
# collider is trimmed to the VISUAL shell). The stand's rails flank THESE faces — the same
|
| 151 |
+
# pair a parallel-jaw grasp pinches.
|
| 152 |
+
CARD_BODY_Y: ClassVar[tuple[float, float]] = (-0.002, 0.0328)
|
| 153 |
+
|
| 154 |
+
def __init__(self, cfg: PcGpuAssemblySceneCfg | None = None) -> None:
|
| 155 |
+
super().__init__(cfg or PcGpuAssemblySceneCfg())
|
| 156 |
+
|
| 157 |
+
# ----- assets -------------------------------------------------------------------------------
|
| 158 |
+
def assets(self) -> dict[str, Any]:
|
| 159 |
+
"""Floor, dome light, table, the PC case lying on it (kinematic, with the invisible slot
|
| 160 |
+
fixture), and one loose graphics card. The card loads with the high solver-iteration count
|
| 161 |
+
the snug channel needs."""
|
| 162 |
+
import isaaclab.sim as sim_utils
|
| 163 |
+
from isaaclab.assets import AssetBaseCfg, RigidObjectCfg
|
| 164 |
+
|
| 165 |
+
c = self.cfg
|
| 166 |
+
for usd in (c.case_usd, c.card_usd):
|
| 167 |
+
if not Path(usd).is_file():
|
| 168 |
+
raise FileNotFoundError(
|
| 169 |
+
f"{usd} not found — the pc-gpu assets ship with the repo under "
|
| 170 |
+
f"`suites/assembly/assets/`"
|
| 171 |
+
)
|
| 172 |
+
preset = c.TABLES[c.table]
|
| 173 |
+
wx, wy = c.workbench_pos
|
| 174 |
+
table_z = c.surface_z - preset["top_offset"]
|
| 175 |
+
ground_z = c.surface_z - preset["height"]
|
| 176 |
+
table_spawn = sim_utils.UsdFileCfg(usd_path=c.workbench_usd, scale=(preset["scale"],) * 3)
|
| 177 |
+
if preset["kinematic"]:
|
| 178 |
+
table_spawn.rigid_props = sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True)
|
| 179 |
+
|
| 180 |
+
cx, cy = c.card_init_xy
|
| 181 |
+
assets: dict[str, Any] = {
|
| 182 |
+
"ground": AssetBaseCfg(
|
| 183 |
+
prim_path="/World/ground",
|
| 184 |
+
spawn=sim_utils.GroundPlaneCfg(usd_path=str(
|
| 185 |
+
asset_path(Path(__file__).resolve().parents[1] / "assets") / "props" / "ground" / "default_ground.usd")),
|
| 186 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, ground_z)),
|
| 187 |
+
),
|
| 188 |
+
"light": AssetBaseCfg(
|
| 189 |
+
prim_path="/World/light",
|
| 190 |
+
spawn=sim_utils.DomeLightCfg(intensity=c.light_intensity, color=(0.9, 0.9, 0.9)),
|
| 191 |
+
),
|
| 192 |
+
"workbench": AssetBaseCfg(
|
| 193 |
+
prim_path="{ENV_REGEX_NS}/Table",
|
| 194 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(wx, wy, table_z), rot=preset["orient"]),
|
| 195 |
+
spawn=table_spawn,
|
| 196 |
+
),
|
| 197 |
+
# The case: kinematic; the invisible fixture inside it (slot channel + rear-panel
|
| 198 |
+
# cutout frame) is what the card mates with. Fixture contact offsets are set here
|
| 199 |
+
# (not just authored in the asset) so the 0.15 mm/side channel grip never fights
|
| 200 |
+
# speculative contacts.
|
| 201 |
+
"case": RigidObjectCfg(
|
| 202 |
+
prim_path="{ENV_REGEX_NS}/Case",
|
| 203 |
+
spawn=sim_utils.UsdFileCfg(
|
| 204 |
+
usd_path=c.case_usd,
|
| 205 |
+
activate_contact_sensors=True,
|
| 206 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 207 |
+
contact_offset=c.case_contact_offset, rest_offset=0.0
|
| 208 |
+
),
|
| 209 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
|
| 210 |
+
),
|
| 211 |
+
init_state=RigidObjectCfg.InitialStateCfg(pos=(wx, wy, c.surface_z + c.case_lift)),
|
| 212 |
+
),
|
| 213 |
+
# Card contact offset must stay well below the channel grip (0.15 mm/side) or
|
| 214 |
+
# speculative contacts choke the fit.
|
| 215 |
+
"card": RigidObjectCfg(
|
| 216 |
+
prim_path="{ENV_REGEX_NS}/Card",
|
| 217 |
+
spawn=sim_utils.UsdFileCfg(
|
| 218 |
+
usd_path=c.card_usd,
|
| 219 |
+
activate_contact_sensors=True,
|
| 220 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 221 |
+
contact_offset=c.card_contact_offset, rest_offset=0.0
|
| 222 |
+
),
|
| 223 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(
|
| 224 |
+
solver_position_iteration_count=192,
|
| 225 |
+
solver_velocity_iteration_count=1,
|
| 226 |
+
max_depenetration_velocity=0.02,
|
| 227 |
+
linear_damping=2.0,
|
| 228 |
+
angular_damping=2.0,
|
| 229 |
+
),
|
| 230 |
+
mass_props=sim_utils.MassPropertiesCfg(mass=c.card_mass),
|
| 231 |
+
),
|
| 232 |
+
init_state=RigidObjectCfg.InitialStateCfg(
|
| 233 |
+
pos=(wx + cx, wy + cy, c.surface_z + c.card_init_z), rot=c.card_init_quat
|
| 234 |
+
),
|
| 235 |
+
),
|
| 236 |
+
}
|
| 237 |
+
if c.card_stand:
|
| 238 |
+
# Foam holder for a gripper env: three STATIC boxes (no rigid body). The floor pad's
|
| 239 |
+
# top is the card spawn height (`card_init_z` = the tab-bottom plane), the two rails
|
| 240 |
+
# flank the body slab's faces at `card_stand_gap` per side. Rail tops stay 35+ mm
|
| 241 |
+
# below the pick grip band, so descending open fingers never meet them.
|
| 242 |
+
y0, y1 = self.CARD_BODY_Y
|
| 243 |
+
mid_y = wy + cy + 0.5 * (y0 + y1) # body-slab mid-plane (the pinch/rail centre)
|
| 244 |
+
half_gap = 0.5 * (y1 - y0) + c.card_stand_gap # rail inner face off the mid-plane
|
| 245 |
+
rail_h, rail_t = 0.055, 0.008
|
| 246 |
+
foam = sim_utils.PreviewSurfaceCfg(diffuse_color=(0.17, 0.17, 0.2), roughness=0.9)
|
| 247 |
+
for name, size, pos in (
|
| 248 |
+
("card_stand_floor", (0.11, 0.09, c.card_init_z),
|
| 249 |
+
(wx + cx, mid_y, c.surface_z + 0.5 * c.card_init_z)),
|
| 250 |
+
("card_stand_rail_pcb", (0.11, rail_t, rail_h),
|
| 251 |
+
(wx + cx, mid_y - half_gap - 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 252 |
+
("card_stand_rail_fan", (0.11, rail_t, rail_h),
|
| 253 |
+
(wx + cx, mid_y + half_gap + 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 254 |
+
):
|
| 255 |
+
assets[name] = AssetBaseCfg(
|
| 256 |
+
prim_path="{ENV_REGEX_NS}/" + "".join(p.capitalize() for p in name.split("_")),
|
| 257 |
+
spawn=sim_utils.CuboidCfg(
|
| 258 |
+
size=size,
|
| 259 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 260 |
+
contact_offset=0.001, rest_offset=0.0
|
| 261 |
+
),
|
| 262 |
+
visual_material=foam,
|
| 263 |
+
),
|
| 264 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=pos),
|
| 265 |
+
)
|
| 266 |
+
# Immutable visual-only set dressing, clear of the arm/task swept volume.
|
| 267 |
+
assets['pilot_parts_box'] = AssetBaseCfg(
|
| 268 |
+
prim_path='{ENV_REGEX_NS}/PilotPartsBox',
|
| 269 |
+
spawn=sim_utils.CuboidCfg(size=(.075, .075, .045),
|
| 270 |
+
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(.08, .35, .65), roughness=.8)),
|
| 271 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(.90, .36, c.surface_z+.0225)))
|
| 272 |
+
return assets
|
| 273 |
+
|
| 274 |
+
def sim_cfg(self) -> SimCfg:
|
| 275 |
+
return SimCfg(
|
| 276 |
+
dt=1.0 / 120.0,
|
| 277 |
+
physx={
|
| 278 |
+
"solver_type": 1,
|
| 279 |
+
"bounce_threshold_velocity": 0.2,
|
| 280 |
+
"friction_offset_threshold": 0.01,
|
| 281 |
+
"friction_correlation_distance": 0.00625,
|
| 282 |
+
"gpu_max_rigid_contact_count": 2**23,
|
| 283 |
+
"gpu_max_rigid_patch_count": 2**23,
|
| 284 |
+
"gpu_collision_stack_size": 2**28,
|
| 285 |
+
"gpu_max_num_partitions": 1,
|
| 286 |
+
},
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# ----- lifecycle ----------------------------------------------------------------------------
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, name: str):
|
| 292 |
+
# Legacy surface: the grasp contract's state used to live directly on the scene
|
| 293 |
+
# (inline machinery era) and existing solutions read it there — forward to the
|
| 294 |
+
# composed contract. `__getattr__` only fires for attributes not found normally.
|
| 295 |
+
if name.startswith("_gw_") and "grasp_weld" in self.__dict__:
|
| 296 |
+
return getattr(self.grasp_weld, name)
|
| 297 |
+
raise AttributeError(name)
|
| 298 |
+
|
| 299 |
+
def bind(self, env: BaseEnv) -> None:
|
| 300 |
+
"""Grab the case + card handles, cache env origins, and set the part frictions."""
|
| 301 |
+
super().bind(env)
|
| 302 |
+
self.case: RigidObject = env.iscene["case"]
|
| 303 |
+
self.card: RigidObject = env.iscene["card"]
|
| 304 |
+
self.env_origins = env.iscene.env_origins
|
| 305 |
+
self._set_friction(self.case, self.cfg.case_friction)
|
| 306 |
+
self._set_friction(self.card, self.cfg.card_friction)
|
| 307 |
+
self.grasp_weld = GraspWeldContract(self) # composed, publishes self.grasp_held
|
| 308 |
+
self.grasp_weld.bind()
|
| 309 |
+
|
| 310 |
+
def grasp_sites(self) -> list:
|
| 311 |
+
"""One grip band: across the body slab (faces at CARD_BODY_Y, 34.8 mm wide), along the
|
| 312 |
+
card's upper length — band centre 15 mm below the shroud's top edge (z 0.1155)."""
|
| 313 |
+
y = 0.5 * (self.CARD_BODY_Y[0] + self.CARD_BODY_Y[1])
|
| 314 |
+
return [("card", self.card, (-0.045, y, 0.1005), (0.045, y, 0.1005), (0.030, 0.039))]
|
| 315 |
+
|
| 316 |
+
def post_step(self, env_ids: torch.Tensor | None = None) -> None:
|
| 317 |
+
"""Reconcile the weld-on-closure grasp contract every physics substep."""
|
| 318 |
+
self.grasp_weld.step()
|
| 319 |
+
|
| 320 |
+
def _set_friction(self, asset, value: float) -> None:
|
| 321 |
+
"""Overwrite the static + dynamic friction on every shape of `asset` (across all envs)."""
|
| 322 |
+
mats = asset.root_physx_view.get_material_properties()
|
| 323 |
+
mats[..., 0:2] = value # [static, dynamic, restitution]
|
| 324 |
+
asset.root_physx_view.set_material_properties(mats, torch.arange(self.env.num_envs, device="cpu"))
|
| 325 |
+
|
| 326 |
+
def reset(self, env_ids: torch.Tensor) -> None:
|
| 327 |
+
"""Fresh, unassembled start: the case pinned at spawn, the card lying backplate-down on
|
| 328 |
+
the table beside it, with xy jitter."""
|
| 329 |
+
c = self.cfg
|
| 330 |
+
dev = self.env.device
|
| 331 |
+
m = len(env_ids)
|
| 332 |
+
origin = self.env_origins[env_ids] # (m, 3)
|
| 333 |
+
wx, wy = c.workbench_pos
|
| 334 |
+
cx, cy = c.card_init_xy
|
| 335 |
+
|
| 336 |
+
st = torch.zeros(m, 13, device=dev)
|
| 337 |
+
st[:, 0:3] = origin + torch.tensor((wx + cx, wy + cy, c.surface_z + c.card_init_z), device=dev)
|
| 338 |
+
st[:, 0:2] += (torch.rand(m, 2, device=dev) * 2 - 1) * c.reset_pos_jitter
|
| 339 |
+
# Small in-holder variation: below rail clearance; no case/slot changes.
|
| 340 |
+
st[:, :2] += (torch.rand(m, 2, device=dev)*2-1) * torch.tensor(
|
| 341 |
+
[c.pilot_jitter_x, c.pilot_jitter_y], device=dev)
|
| 342 |
+
st[:, 3:7] = torch.tensor(c.card_init_quat, device=dev)
|
| 343 |
+
self.card.write_root_state_to_sim(st, env_ids)
|
| 344 |
+
self.grasp_weld.release_all(env_ids)
|
| 345 |
+
|
| 346 |
+
# ----- state (full, restorable) -------------------------------------------------------------
|
| 347 |
+
def get_state(self, env_ids: torch.Tensor) -> dict[str, Any]:
|
| 348 |
+
"""Restorable scene state: world root states (13) of the case and the card, plus the
|
| 349 |
+
grasp-weld holds."""
|
| 350 |
+
return {
|
| 351 |
+
"case": self.case.data.root_state_w[env_ids].clone(),
|
| 352 |
+
"card": self.card.data.root_state_w[env_ids].clone(),
|
| 353 |
+
**self.grasp_weld.state(env_ids),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
def set_state(self, state: dict[str, Any], env_ids: torch.Tensor) -> None:
|
| 357 |
+
"""Restore what `get_state` returned. The card's insertion depth is fully captured by its
|
| 358 |
+
root state, so the channel holds it on restore."""
|
| 359 |
+
self.case.write_root_pose_to_sim(state["case"][:, 0:7], env_ids)
|
| 360 |
+
self.card.write_root_state_to_sim(state["card"], env_ids)
|
| 361 |
+
self.grasp_weld.restore(state, env_ids)
|
| 362 |
+
|
| 363 |
+
# ----- description --------------------------------------------------------------------------
|
| 364 |
+
def describe(self) -> str:
|
| 365 |
+
if self.cfg.card_stand:
|
| 366 |
+
card = (
|
| 367 |
+
"Beside the case a loose graphics card stands upright in a foam holder, already "
|
| 368 |
+
"in its installation orientation.\nGoal: grip the card by its top edge, lift it "
|
| 369 |
+
"straight out of the holder, "
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
card = (
|
| 373 |
+
"Beside the case lies a loose graphics card, backplate down.\nGoal: lift the "
|
| 374 |
+
"card upright (fans toward the case front), "
|
| 375 |
+
)
|
| 376 |
+
return (
|
| 377 |
+
"A gaming-PC case lying on its side on a sturdy table, opening up, its motherboard "
|
| 378 |
+
"facing the ceiling. The board's primary PCIe x16 slot is empty, and the rear I/O "
|
| 379 |
+
f"panel has an open expansion-slot cutout. {card}"
|
| 380 |
+
"lower it into the case with its I/O bracket just forward of the rear panel, slide "
|
| 381 |
+
"it rearward until the bracket and ports pass through the cutout, line its PCB edge "
|
| 382 |
+
"connector up with the x16 slot, and press it straight down until it bottoms out. "
|
| 383 |
+
"A seated card stays put on its own. The task is complete once the card is fully "
|
| 384 |
+
"seated."
|
| 385 |
+
+ " A fixed blue parts box decorates the far corner, outside the task volume."
|
| 386 |
+
+ (
|
| 387 |
+
" The card holds in a firm pinch: close the fingers squarely across its body "
|
| 388 |
+
"slab near the top edge and the grip locks; open wide to release."
|
| 389 |
+
if self.cfg.grasp_weld
|
| 390 |
+
else ""
|
| 391 |
+
)
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# ----- progress (public: seated()/engaged(); reads how far the assembly has got) -------------
|
| 395 |
+
def engaged(self) -> torch.Tensor:
|
| 396 |
+
"""Tab depth below the slot mouth, shape (num_envs,), in metres (negative = still above
|
| 397 |
+
the slot). The card bottoms out on the channel floor at 0.005 depth."""
|
| 398 |
+
rel = self._card_offset_in_case() # (n, 3), zero at the seated pose
|
| 399 |
+
return (self.cfg.slot_mouth_z - self.cfg.seat_pos[2]) - rel[:, 2]
|
| 400 |
+
|
| 401 |
+
def seated(self) -> torch.Tensor:
|
| 402 |
+
"""Whether the card is seated in the slot, shape (num_envs,): pressed down to `seat_depth`
|
| 403 |
+
below the mouth, within `align_xy` of the seated point, and aligned in tilt AND heading."""
|
| 404 |
+
c = self.cfg
|
| 405 |
+
rel = self._card_offset_in_case() # (n, 3)
|
| 406 |
+
depth_ok = self.engaged() >= c.seat_depth
|
| 407 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 408 |
+
up_ok = self._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 409 |
+
yaw_ok = self._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 410 |
+
return depth_ok & xy_ok & up_ok & yaw_ok
|
| 411 |
+
|
| 412 |
+
def success(self) -> torch.Tensor:
|
| 413 |
+
"""(N,) bool: the card seated in its slot — this scene's assembled state
|
| 414 |
+
(scene-level success alias, matching the other suites' surface)."""
|
| 415 |
+
return self.seated()
|
| 416 |
+
|
| 417 |
+
def _card_offset_in_case(self) -> torch.Tensor:
|
| 418 |
+
"""The card origin's offset from the seated point, in the case's local frame, shape
|
| 419 |
+
(num_envs, 3). Zero means the card origin sits exactly at the seated pose."""
|
| 420 |
+
from isaaclab.utils.math import quat_apply_inverse
|
| 421 |
+
|
| 422 |
+
rel = quat_apply_inverse(
|
| 423 |
+
self.case.data.root_quat_w, self.card.data.root_pos_w - self.case.data.root_pos_w
|
| 424 |
+
)
|
| 425 |
+
return rel - torch.tensor(self.cfg.seat_pos, device=rel.device)
|
| 426 |
+
|
| 427 |
+
def _axis_cos(self, axis: int) -> torch.Tensor:
|
| 428 |
+
"""cos of the angle between the card's and the case's local `axis` (0=x: heading along the
|
| 429 |
+
slot, 2=z: insertion axis), shape (num_envs,). Seated orientation = the case's own axes."""
|
| 430 |
+
from isaaclab.utils.math import quat_apply
|
| 431 |
+
|
| 432 |
+
e = torch.zeros(3, device=self.env.device)
|
| 433 |
+
e[axis] = 1.0
|
| 434 |
+
e = e.expand(self.env.num_envs, 3)
|
| 435 |
+
case_ax = quat_apply(self.case.data.root_quat_w, e)
|
| 436 |
+
card_ax = quat_apply(self.card.data.root_quat_w, e)
|
| 437 |
+
return (card_ax * case_ax).sum(dim=-1)
|
| 438 |
+
|
| 439 |
+
# Grasp-weld contract: composed `GraspWeldContract` (robobench.core.grasp_weld),
|
| 440 |
+
# created in `bind()`; this scene supplies the part-side `grasp_sites()`.
|
| 441 |
+
# Grasp-weld contract constants — the scene's public knobs (solutions read these off the
|
| 442 |
+
# scene, e.g. `scene.GRASP_PINCH_OFFSET`); the composed GraspWeldContract consumes them.
|
| 443 |
+
GRASP_HAND_BODY: ClassVar[str] = "panda_hand"
|
| 444 |
+
GRASP_FINGER_JOINTS: ClassVar[str] = "panda_finger_joint.*"
|
| 445 |
+
GRASP_PINCH_OFFSET: ClassVar[float] = 0.1034 # hand origin -> finger-pad centre, along approach
|
| 446 |
+
GRASP_POOL: ClassVar[int] = 8 # engages per (env, site) per run; exhausted -> warn, no weld
|
| 447 |
+
GRASP_STALL: ClassVar[float] = 0.01 # max |finger vel| sum (m/s): fingers stopped ON the part
|
| 448 |
+
GRASP_DEBOUNCE: ClassVar[int] = 8 # consecutive qualifying substeps before the weld engages
|
| 449 |
+
GRASP_RELEASE_MARGIN: ClassVar[float] = 0.008 # release at window-top + this (m), hysteresis
|
| 450 |
+
|
provenance/generation_code/h_s0_1/strategy/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Base state-feedback program; Original central grasp and direct high transfer. DART offered only during high free-space transport. Initially UNTESTED; see pilot_report.json.
|
provenance/generation_code/h_s0_1/strategy/meta.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 1,
|
| 3 |
+
"successes": 1,
|
| 4 |
+
"success_rate": 1.0,
|
| 5 |
+
"batches": [
|
| 6 |
+
"p01_scene"
|
| 7 |
+
],
|
| 8 |
+
"refreshed": "2026-10-12T11:18:52+00:00"
|
| 9 |
+
}
|
provenance/generation_code/h_s0_1/strategy/parameters.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compensate_action_filter": true,
|
| 3 |
+
"integral_position": 0.8,
|
| 4 |
+
"integral_rotation": 0.5,
|
| 5 |
+
"speed": 0.03,
|
| 6 |
+
"carry_height": 0.26,
|
| 7 |
+
"forward_clearance": -0.045,
|
| 8 |
+
"slide_height": 0.018,
|
| 9 |
+
"press_speed": 0.003
|
| 10 |
+
}
|
provenance/generation_code/h_s0_1/strategy/solve.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# plan: [stages 1-3] card held; card aligned above slot; card seated and released
|
| 2 |
+
# origin=fresh
|
| 3 |
+
"""A state-feedback program for the registered Franka/OSC GPU-install task.
|
| 4 |
+
|
| 5 |
+
Only env.step(action) changes the world. No dataset, checkpoint, reset, state
|
| 6 |
+
restoration, controller replacement, or scene-parameter writes are used.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
DART_SIGMA = 0.03
|
| 14 |
+
SOLVE_PARAMS = {'DART_SIGMA': None}
|
| 15 |
+
ENTRIES = {'start': 'unassembled card upright in holder, hand free',
|
| 16 |
+
'preinsert': 'card genuinely held, above front entry, clear of all contacts'}
|
| 17 |
+
|
| 18 |
+
def solve(env, entry=None, stop_after=None) -> None:
|
| 19 |
+
import torch
|
| 20 |
+
from isaaclab.utils.math import (
|
| 21 |
+
axis_angle_from_quat, quat_apply, quat_conjugate, quat_mul,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
params = json.loads(Path(__file__).with_name('parameters.json').read_text())
|
| 25 |
+
scene, robot = env.scene, env.robot
|
| 26 |
+
art = robot.articulation
|
| 27 |
+
dev, n = env.device, env.num_envs
|
| 28 |
+
assert n == 1, 'This initial phase-1 delivery handles one environment per process'
|
| 29 |
+
osc = robot.controller.controllers[0]
|
| 30 |
+
assert type(osc).__name__ == 'OperationalSpaceController'
|
| 31 |
+
assert robot.action_dim == 8
|
| 32 |
+
hand = art.body_names.index('panda_hand')
|
| 33 |
+
dt = env.dt * robot.control_period
|
| 34 |
+
offset = float(scene.GRASP_PINCH_OFFSET)
|
| 35 |
+
zero = torch.zeros(3, device=dev)
|
| 36 |
+
integral_p, integral_r = zero.clone(), zero.clone()
|
| 37 |
+
steps = 0
|
| 38 |
+
active_phase = 'start'
|
| 39 |
+
if entry not in (None, 'start', 'preinsert'): raise ValueError(entry)
|
| 40 |
+
|
| 41 |
+
def v(values): return torch.tensor(values, device=dev, dtype=torch.float32)
|
| 42 |
+
def mul(a,b): return quat_mul(a[None],b[None])[0]
|
| 43 |
+
def inv(q): return quat_conjugate(q[None])[0]
|
| 44 |
+
def rotate(q,x): return quat_apply(q[None],x[None])[0]
|
| 45 |
+
def orientation_error(goal,current):
|
| 46 |
+
if float(torch.dot(goal,current)) < 0: goal = -goal
|
| 47 |
+
return axis_angle_from_quat(mul(goal, inv(current))[None])[0]
|
| 48 |
+
def hp(): return art.data.body_pos_w[0,hand].clone()
|
| 49 |
+
def hq(): return art.data.body_quat_w[0,hand].clone()
|
| 50 |
+
def cp(): return scene.card.data.root_pos_w[0].clone()
|
| 51 |
+
def cq(): return scene.card.data.root_quat_w[0].clone()
|
| 52 |
+
def held(): return bool(scene.grasp_held[0].any())
|
| 53 |
+
def pinch(): return hp() + rotate(hq(),v([0,0,offset]))
|
| 54 |
+
def band(): return cp()+rotate(cq(),v([0,sum(scene.CARD_BODY_Y)/2,.1005]))
|
| 55 |
+
|
| 56 |
+
def log(phase,**extra):
|
| 57 |
+
print('PHASE1 '+json.dumps(dict(phase=phase,steps=steps,seconds=steps*dt,
|
| 58 |
+
held=held(),card=cp().tolist(),hand=hp().tolist(),
|
| 59 |
+
offset=scene._card_offset_in_case()[0].tolist(),
|
| 60 |
+
depth=float(scene.engaged()[0]),integral_position=integral_p.tolist(),
|
| 61 |
+
integral_rotation=integral_r.tolist(),**extra)),flush=True)
|
| 62 |
+
|
| 63 |
+
def tick(goal,quat,finger):
|
| 64 |
+
nonlocal integral_p, integral_r, steps
|
| 65 |
+
ep, er = goal-hp(), orientation_error(quat,hq())
|
| 66 |
+
integral_p=(integral_p+ep*dt).clamp(-.10,.10)
|
| 67 |
+
integral_r=(integral_r+er*dt).clamp(-4.0,4.0)
|
| 68 |
+
dp=ep+params['integral_position']*integral_p
|
| 69 |
+
dr=er+params['integral_rotation']*integral_r
|
| 70 |
+
dr=dr*min(1,2.5/max(float(dr.norm()),1e-9))
|
| 71 |
+
action=torch.zeros((1,8),device=dev)
|
| 72 |
+
action[0,:3]=(dp/osc.cfg.pos_scale).clamp(-6,6)
|
| 73 |
+
action[0,3:6]=(dr/osc.cfg.rot_scale).clamp(-20,20)
|
| 74 |
+
action[0,6:]=finger
|
| 75 |
+
# The preset smooths pose DELTAS, rather than absolute targets. Account
|
| 76 |
+
# for its documented filter in the command; never write controller state.
|
| 77 |
+
if params.get('compensate_action_filter',False) and osc._prev_action is not None:
|
| 78 |
+
alpha=float(osc.cfg.ema_factor)
|
| 79 |
+
action[0,:6]=(action[0,:6]-(1-alpha)*osc._prev_action[0])/alpha
|
| 80 |
+
assert torch.isfinite(action).all()
|
| 81 |
+
# Noise offered independently of noise_scale. Recorder keeps labels clean.
|
| 82 |
+
disturbance = torch.zeros_like(action)
|
| 83 |
+
if active_phase in ('lift_clear', 'transport_waypoint', 'above_case') and float(hp()[2]) > .38:
|
| 84 |
+
disturbance[0, :3] = DART_SIGMA * torch.randn(3, device=dev)
|
| 85 |
+
env.step(action, noise=disturbance)
|
| 86 |
+
steps+=1
|
| 87 |
+
|
| 88 |
+
def move(goal_fn,grip,timeout,tag,tol=.002,rot_tol=.035,card_check=None):
|
| 89 |
+
nonlocal active_phase
|
| 90 |
+
active_phase = tag
|
| 91 |
+
ref=hp(); good=0
|
| 92 |
+
for _ in range(max(1,math.ceil(timeout/dt))):
|
| 93 |
+
goal,quat=goal_fn()
|
| 94 |
+
delta=goal-ref; length=float(delta.norm())
|
| 95 |
+
ref=ref+delta*min(1,params['speed']*dt/max(length,1e-9))
|
| 96 |
+
tick(ref,quat,grip)
|
| 97 |
+
goal,quat=goal_fn()
|
| 98 |
+
ok=float((hp()-goal).norm())<tol and float(orientation_error(quat,hq()).norm())<rot_tol
|
| 99 |
+
if card_check is not None:ok=ok and card_check()
|
| 100 |
+
good=good+1 if ok else 0
|
| 101 |
+
if good>=8:log(tag,result='reached');return
|
| 102 |
+
log(tag,result='timeout',position_error=float((hp()-goal).norm()),rotation_error=float(orientation_error(quat,hq()).norm()))
|
| 103 |
+
raise RuntimeError('Stage did not reach its measured gate: '+tag)
|
| 104 |
+
|
| 105 |
+
def hold(goal_fn,finger,seconds):
|
| 106 |
+
nonlocal active_phase
|
| 107 |
+
active_phase = 'hold'
|
| 108 |
+
for _ in range(math.ceil(seconds/dt)):
|
| 109 |
+
goal,quat=goal_fn();tick(goal,quat,finger)
|
| 110 |
+
|
| 111 |
+
log('start')
|
| 112 |
+
if entry != 'preinsert':
|
| 113 |
+
# Stage 1: acquire the top band and verify a real grasp.
|
| 114 |
+
down=[mul(cq(),v([0,0,1,0])),mul(cq(),v([0,1,0,0]))]
|
| 115 |
+
pick_q=max(down,key=lambda q:abs(float(torch.dot(q,hq())))).clone()
|
| 116 |
+
def pick_goal(height=0):
|
| 117 |
+
return band()-rotate(pick_q,v([0,0,offset]))+v([0,0,height]),pick_q
|
| 118 |
+
move(lambda:pick_goal(.10),.04,18,'above_card',tol=.004,rot_tol=.05)
|
| 119 |
+
move(pick_goal,.04,16,'pinch_aligned',tol=.0025)
|
| 120 |
+
for k in range(math.ceil(2/dt)):
|
| 121 |
+
goal,quat=pick_goal()
|
| 122 |
+
tick(goal,quat,.04+(.0172-.04)*min(1,(k+1)*dt/1.5))
|
| 123 |
+
hold(pick_goal,.0172,1)
|
| 124 |
+
if not held():log('grasp_failed');raise RuntimeError('No grasp after controlled closure')
|
| 125 |
+
log('card_held')
|
| 126 |
+
elif not held():
|
| 127 |
+
raise RuntimeError('preinsert entry requires an actual grasp')
|
| 128 |
+
rel_p=rotate(inv(hq()),cp()-hp())
|
| 129 |
+
rel_q=mul(inv(hq()),cq())
|
| 130 |
+
def card_goal(position,quat):
|
| 131 |
+
# The grasp joint fixes this measured card-in-hand transform. A fixed
|
| 132 |
+
# world-frame hand goal avoids moving the goal in response to its own lag.
|
| 133 |
+
target_q=mul(quat,inv(rel_q))
|
| 134 |
+
return position-rotate(target_q,rel_p),target_q
|
| 135 |
+
def case_point(local):
|
| 136 |
+
return scene.case.data.root_pos_w[0]+rotate(scene.case.data.root_quat_w[0],v(local))
|
| 137 |
+
case_q=scene.case.data.root_quat_w[0].clone()
|
| 138 |
+
seat=list(scene.cfg.seat_pos)
|
| 139 |
+
forward=seat[0]+params['forward_clearance']
|
| 140 |
+
if entry != 'preinsert':
|
| 141 |
+
lift=cp();lift[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 142 |
+
move(lambda:card_goal(lift,case_q),.0172,25,'lift_clear',tol=.003)
|
| 143 |
+
if not held():raise RuntimeError('Grasp lost during lift')
|
| 144 |
+
|
| 145 |
+
# Stage 2: enter forward of the rear panel, then slide through its cutout.
|
| 146 |
+
high=[forward,seat[1],params['carry_height']-float(scene.cfg.case_lift)]
|
| 147 |
+
move(lambda:card_goal(case_point(high),case_q),.0172,40,'above_case',tol=.003)
|
| 148 |
+
if stop_after == 'above_case': return
|
| 149 |
+
above=[forward,seat[1],float(scene.cfg.slot_mouth_z)+params['slide_height']]
|
| 150 |
+
move(lambda:card_goal(case_point(above),case_q),.0172,20,'inside_case',tol=.002)
|
| 151 |
+
aligned=[seat[0],seat[1],above[2]]
|
| 152 |
+
def card_aligned():
|
| 153 |
+
return float((cp()-case_point(aligned)).norm())<.0007 and float(orientation_error(case_q,cq()).norm())<.004
|
| 154 |
+
move(lambda:card_goal(case_point(aligned),case_q),.0172,30,'slot_aligned',tol=.0004,rot_tol=.003,card_check=card_aligned)
|
| 155 |
+
|
| 156 |
+
# Stage 3: press, release, retract, then leave the installed card unsupported.
|
| 157 |
+
pressed=[seat[0],seat[1],seat[2]-.001]
|
| 158 |
+
active_phase='press'
|
| 159 |
+
press_z=aligned[2]
|
| 160 |
+
for _ in range(math.ceil(25/dt)):
|
| 161 |
+
press_z=max(pressed[2],press_z-params['press_speed']*dt)
|
| 162 |
+
target,quat=card_goal(case_point([seat[0],seat[1],press_z]),case_q)
|
| 163 |
+
tick(target,quat,.0172)
|
| 164 |
+
if bool(scene.seated()[0]):break
|
| 165 |
+
if not bool(scene.seated()[0]):log('press_failed');raise RuntimeError('Card did not seat')
|
| 166 |
+
log('seated_before_release')
|
| 167 |
+
keep=hp(); keep_q=hq()
|
| 168 |
+
hold(lambda:(keep,keep_q),.04,2)
|
| 169 |
+
up=keep+v([0,0,.14])
|
| 170 |
+
move(lambda:(up,keep_q),.04,16,'hand_clear',tol=.004,rot_tol=.06)
|
| 171 |
+
hold(lambda:(up,keep_q),.04,5)
|
| 172 |
+
log('finished',seated=bool(scene.seated()[0]))
|
| 173 |
+
if held() or not bool(scene.seated()[0]):raise RuntimeError('Card did not remain seated after release')
|
provenance/generation_code/h_s0_2/grader.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Grader for the pc_gpu scene: the graphics card seated in the PCIe x16 slot.
|
| 2 |
+
|
| 3 |
+
Rubric stages (weights and modes live in RUBRIC):
|
| 4 |
+
grasped the card has been taken in the weld-on-closure grip (`scene.grasp_held`) — the
|
| 5 |
+
scene's own grasp state; a milestone, latched. Also true once the card is
|
| 6 |
+
aligned in the slot (a card in the slot was necessarily carried there), so the
|
| 7 |
+
rung nests under `aligned`. Under an embodiment with no gripper (the weld
|
| 8 |
+
contract disabled, e.g. robot="null") the grasp state does not exist and the
|
| 9 |
+
rung reads from that implication alone
|
| 10 |
+
aligned the card lined up on the slot — origin within `align_xy` of the seated point,
|
| 11 |
+
up axis within `align_axis_deg` of the slot axis, length axis within
|
| 12 |
+
`align_yaw_deg` of the slot heading: the scene's own three non-depth seat gates
|
| 13 |
+
pressed tab depth below the slot mouth (`slot_mouth_z`, the scene's own `engaged()`)
|
| 14 |
+
as a fraction of `seat_depth`, counted only while aligned — so it is 1.0 iff
|
| 15 |
+
the scene calls the card seated
|
| 16 |
+
Every stage is per env. The rungs nest (seated => aligned => grasped), so progress reaches
|
| 17 |
+
1.0 exactly when the card is seated, and for a grader built after the pick as well as one
|
| 18 |
+
that watched it. The rear-panel pass-through is NOT a rung: the cutout's geometry is not in
|
| 19 |
+
the scene cfg, so it cannot be read from state without an invented tolerance. Success is
|
| 20 |
+
the scene's `seated()` per env — depth, xy, tilt AND heading gates — read when the
|
| 21 |
+
delivery finishes.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
|
| 28 |
+
from robobench.core import BaseGrader
|
| 29 |
+
# baked by data_engine init: grade against the LOCAL scene copy (../scene/scene.py),
|
| 30 |
+
# exec'd at most once per process under a fixed module key.
|
| 31 |
+
import importlib.util as _ilu
|
| 32 |
+
import sys as _sys
|
| 33 |
+
from pathlib import Path as _Path
|
| 34 |
+
|
| 35 |
+
if "datagen_local_scene" not in _sys.modules:
|
| 36 |
+
import robobench as _rb
|
| 37 |
+
_rb.discover()
|
| 38 |
+
_p = _Path(__file__).resolve().parent.parent / "scene" / "scene.py"
|
| 39 |
+
_spec = _ilu.spec_from_file_location("datagen_local_scene", _p)
|
| 40 |
+
_m = _ilu.module_from_spec(_spec)
|
| 41 |
+
_sys.modules["datagen_local_scene"] = _m
|
| 42 |
+
_spec.loader.exec_module(_m)
|
| 43 |
+
PcGpuAssemblyScene = _sys.modules["datagen_local_scene"].PcGpuAssemblyScene
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PcGpuAssemblyGrader(BaseGrader):
|
| 47 |
+
"""The card seated in its slot — pressed to depth, centred, upright, heading along the slot.
|
| 48 |
+
|
| 49 |
+
Ladder: grasped 0.33 · aligned 0.67 · pressed 1.00 — three equal rungs for the three
|
| 50 |
+
steps of the task (take the card, line it up on the slot, press it home); the last rung
|
| 51 |
+
is a linear ramp of tab depth from the slot mouth (`slot_mouth_z`) to `seat_depth`.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
SCENE = PcGpuAssemblyScene
|
| 55 |
+
RUBRIC = (("grasped", 1, "once"), ("aligned", 1), ("pressed", 1))
|
| 56 |
+
scene: PcGpuAssemblyScene
|
| 57 |
+
|
| 58 |
+
def setup(self) -> None:
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# `grasp_held` exists only while the weld contract is live (a gripper on the stage).
|
| 62 |
+
self._has_grasp = hasattr(self.scene, "grasp_held")
|
| 63 |
+
self._grasped = torch.zeros(self.num_envs, dtype=torch.bool,
|
| 64 |
+
device=self.scene.engaged().device) # latch: card ever held
|
| 65 |
+
|
| 66 |
+
def check_success(self):
|
| 67 |
+
return self.scene.seated() # (num_envs,)
|
| 68 |
+
|
| 69 |
+
def _aligned(self):
|
| 70 |
+
"""(num_envs,) bool: the scene's xy + tilt + heading seat gates, without depth."""
|
| 71 |
+
c = self.scene.cfg
|
| 72 |
+
rel = self.scene._card_offset_in_case() # (n, 3), zero at the seated pose — privileged
|
| 73 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 74 |
+
up_ok = self.scene._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 75 |
+
yaw_ok = self.scene._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 76 |
+
return xy_ok & up_ok & yaw_ok
|
| 77 |
+
|
| 78 |
+
# ---- rubric stages — each returns a (num_envs,) value in [0, 1] ---------------------
|
| 79 |
+
def grasped(self):
|
| 80 |
+
if self._has_grasp:
|
| 81 |
+
self._grasped |= self.scene.grasp_held.any(dim=1)
|
| 82 |
+
return (self._grasped | self._aligned()).float()
|
| 83 |
+
|
| 84 |
+
def aligned(self):
|
| 85 |
+
return self._aligned().float()
|
| 86 |
+
|
| 87 |
+
def pressed(self):
|
| 88 |
+
depth = self.scene.engaged() # (n,) tab depth below the slot mouth (m)
|
| 89 |
+
return self._aligned() * (depth / self.scene.cfg.seat_depth).clamp(0.0, 1.0)
|
provenance/generation_code/h_s0_2/scene.py
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PcGpuAssemblyScene — insert a graphics card into the PC's PCIe slot.
|
| 2 |
+
|
| 3 |
+
The same gaming-PC case as `pc_motherboard` lies on its side on the table, opening up, motherboard
|
| 4 |
+
facing the ceiling — but here the board's PCIe area is the work site. Beside the case lies a loose
|
| 5 |
+
RTX 2060 (extracted from the PC model as its own rigid body, backplate down). Goal (carried here,
|
| 6 |
+
no task layer): stand the card upright over the primary x16 slot, line its PCB edge up with the
|
| 7 |
+
slot, and press it straight down until it seats.
|
| 8 |
+
|
| 9 |
+
The case is one kinematic body that never moves — the PC model stays visual-only; its physics is
|
| 10 |
+
an invisible fixture inside the case body: a channel whose walls grip the card's 4 mm PCB tab at
|
| 11 |
+
0.15 mm/side (flaring to a 1.2 mm/side funnel mouth — idealizing the real slot's spring
|
| 12 |
+
contacts, and capping the unscrewed card's gravity roll at ~2 deg), a floor whose top is the
|
| 13 |
+
model's own seated tab height, end stops (~1.6 mm play), a flush board plate so a dropped card
|
| 14 |
+
rests on the board face, and a REAR I/O PANEL frame around the expansion-slot cutout — so the
|
| 15 |
+
card must be placed inside the case, slid rearward until its bracket/ports pass through the
|
| 16 |
+
opening, and only then pressed down (a straight vertical drop is physically blocked by the
|
| 17 |
+
panel above the cutout, exactly like a real build). The card's origin is its
|
| 18 |
+
PCB-tab bottom CENTRE with axes equal to the case's, so the seated pose is just `seat_pos` +
|
| 19 |
+
identity orientation in the case frame, and insertion depth is a z difference.
|
| 20 |
+
|
| 21 |
+
Heavy imports (isaaclab, pxr) are deferred so importing this module stays app-free.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
from robobench.core.assets import asset_path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, ClassVar
|
| 31 |
+
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
from robobench.core import GraspWeldContract, SCENES, BaseCfg, BaseScene, SimCfg
|
| 35 |
+
|
| 36 |
+
if TYPE_CHECKING:
|
| 37 |
+
from isaaclab.assets import RigidObject
|
| 38 |
+
|
| 39 |
+
from robobench.core import BaseEnv
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class PcGpuAssemblySceneCfg(BaseCfg):
|
| 44 |
+
"""Config for `PcGpuAssemblyScene`. Nothing is locked — a variant is just a copy with a few
|
| 45 |
+
fields changed."""
|
| 46 |
+
|
| 47 |
+
# --- the curriculum / difficulty dials -----------------------------------------------
|
| 48 |
+
# The card is "seated" when — in the case's frame — its tab is >= `seat_depth` below the slot
|
| 49 |
+
# mouth, its origin is within `align_xy` of the seated point, and its axes are within
|
| 50 |
+
# `align_axis_deg` (tilt) / `align_yaw_deg` (heading along the slot) of the case's. The full
|
| 51 |
+
# stroke from the slot mouth to the channel floor is 5 mm, so 4 mm separates "seated" from
|
| 52 |
+
# "merely resting in the mouth".
|
| 53 |
+
seat_depth: float = 0.004 # min tab depth below the slot mouth (m) to count as seated
|
| 54 |
+
align_xy: float = 0.003 # max distance (m) of the card origin from the seated point
|
| 55 |
+
align_axis_deg: float = 3.0 # max tilt of the card's up axis off the slot axis (deg)
|
| 56 |
+
align_yaw_deg: float = 3.0 # max heading error of the card's length axis (deg)
|
| 57 |
+
reset_pos_jitter: float = 0.01 # uniform +/- xy jitter for the loose card at reset (m)
|
| 58 |
+
# Part friction (static = dynamic), set on every shape at bind. The moving card runs moderately
|
| 59 |
+
# slick against a grippier fixed case, so it slides down the channel but holds seat.
|
| 60 |
+
card_friction: float = 0.3
|
| 61 |
+
case_friction: float = 0.75
|
| 62 |
+
# Weld-on-closure grasping (the benchmark's auto-weld contract, PhysX
|
| 63 |
+
# form — the grasp-weld machinery at the end of this scene class):
|
| 64 |
+
# close the fingers squarely across the card's body slab near its top edge and the card welds
|
| 65 |
+
# to the hand; open wide to release. Gripper envs only (no-op under robot="null").
|
| 66 |
+
grasp_weld: bool = True
|
| 67 |
+
grasp_weld_dist: float = 0.010 # pinch-point-to-grip-band engage radius (m)
|
| 68 |
+
|
| 69 |
+
pilot_jitter_x: float = 0.004
|
| 70 |
+
pilot_jitter_y: float = 0.0007
|
| 71 |
+
|
| 72 |
+
# --- structure, reset layout, masses, asset paths (fixed) -------------------------------
|
| 73 |
+
# Seated card origin (its PCB-tab bottom centre) in the case's local frame; orientation seated
|
| 74 |
+
# = the case's own axes (identity). Baked into the committed USDs (keep in sync if they change).
|
| 75 |
+
seat_pos: tuple[float, float, float] = (-0.01595, 0.0293, 0.0035)
|
| 76 |
+
slot_mouth_z: float = 0.0085 # slot top in the case frame: depth datum (5 mm at full seat)
|
| 77 |
+
board_top: float = 0.0 # board face height in the case frame (the asset's own origin)
|
| 78 |
+
case_lift: float = 0.0289 # board face above the side panel the case lies on
|
| 79 |
+
card_mass: float = 1.0 # dual-fan RTX 2060 (kg)
|
| 80 |
+
light_intensity: float = 2500.0
|
| 81 |
+
# Loose card start pose: lying backplate-down on the table beside the case (+x side; the case
|
| 82 |
+
# spans x < 0.13 and the lying card's tail reaches origin_x - 0.132).
|
| 83 |
+
card_init_xy: tuple[float, float] = (0.28, 0.0) # card start xy (table-rel.)
|
| 84 |
+
card_init_z: float = 0.0022 # origin height lying backplate-down (backplate plane -2 mm)
|
| 85 |
+
card_init_quat: tuple[float, float, float, float] = (0.70711, 0.70711, 0.0, 0.0) # flat
|
| 86 |
+
card_contact_offset: float = 0.0001 # well below the 0.15 mm/side channel grip
|
| 87 |
+
case_contact_offset: float = 0.0001 # ditto for the slot fixture's walls
|
| 88 |
+
# Optional foam holder (a floor pad + two rails flanking the card's 36 mm body slab) that
|
| 89 |
+
# presents the card UPRIGHT for a parallel-jaw grasp. The lying default is ungraspable by a
|
| 90 |
+
# Franka gripper: flat on its backplate the card's only sub-80 mm dimension (the 36 mm body
|
| 91 |
+
# thickness) points UP, so no top-down or side pinch can straddle it. Enable together with an
|
| 92 |
+
# upright `card_init_quat` (identity = the seated orientation) and `card_init_z` = the
|
| 93 |
+
# holder's floor top; the rails cap the free card's lean at ~3 deg and the pick pulls
|
| 94 |
+
# straight up out of them.
|
| 95 |
+
card_stand: bool = False
|
| 96 |
+
card_stand_gap: float = 0.0025 # rail clearance per side around the body slab (m)
|
| 97 |
+
# Selectable work surface (same presets as the sibling scenes).
|
| 98 |
+
table: str = "lab_table" # which work surface: "lab_table" | "packing"
|
| 99 |
+
surface_z: float | None = None # table-top height (m); None -> the preset's
|
| 100 |
+
workbench_pos: tuple[float, float] | None = None # xy the table sits at; None -> preset
|
| 101 |
+
workbench_usd: str = "" # empty -> the preset's vendored USD
|
| 102 |
+
TABLES: ClassVar[dict[str, dict[str, Any]]] = {
|
| 103 |
+
"lab_table": {"usd": ("lab_table", "table_instanceable.usd"), "scale": 1.0,
|
| 104 |
+
"orient": (0.70711, 0.0, 0.0, 0.70711), "surface_z": 0.0, "pos": (0.5, 0.0),
|
| 105 |
+
"top_offset": 0.0, "height": 1.05, "kinematic": False},
|
| 106 |
+
"packing": {"usd": ("packing_table", "SM_HeavyDutyPackingTable_C02_01_physics.usd"), "scale": 0.01,
|
| 107 |
+
"orient": (1.0, 0.0, 0.0, 0.0), "surface_z": 0.994, "pos": (0.0, 0.0),
|
| 108 |
+
"top_offset": 0.994, "height": 0.994, "kinematic": True},
|
| 109 |
+
}
|
| 110 |
+
# Asset USDs; empty -> the prebuilt assets committed under `assets/`.
|
| 111 |
+
asset_dir: str = ""
|
| 112 |
+
case_usd: str = ""
|
| 113 |
+
card_usd: str = ""
|
| 114 |
+
|
| 115 |
+
def __post_init__(self) -> None:
|
| 116 |
+
assets = asset_path(Path(__file__).resolve().parents[1] / "assets")
|
| 117 |
+
self.asset_dir = self.asset_dir or str(assets)
|
| 118 |
+
self.case_usd = self.case_usd or str(Path(self.asset_dir) / "pc" / "pc_case_gpu_assembly_mb.usd")
|
| 119 |
+
self.card_usd = self.card_usd or str(Path(self.asset_dir) / "pc" / "gpu_rtx2060.usd")
|
| 120 |
+
preset = self.TABLES[self.table]
|
| 121 |
+
if self.surface_z is None:
|
| 122 |
+
self.surface_z = preset["surface_z"]
|
| 123 |
+
if self.workbench_pos is None:
|
| 124 |
+
self.workbench_pos = preset["pos"]
|
| 125 |
+
self.workbench_usd = self.workbench_usd or str(assets / "props" / preset["usd"][0] / preset["usd"][1])
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@SCENES.register("pc_gpu_local")
|
| 129 |
+
class PcGpuAssemblyScene(BaseScene):
|
| 130 |
+
cfg: PcGpuAssemblySceneCfg
|
| 131 |
+
|
| 132 |
+
# Object physics remains nominal in this pilot; L4 uses the recorded noise channel.
|
| 133 |
+
PHYSICAL_PARAMS = {'card_mass': None, 'card_friction': None, 'case_friction': None}
|
| 134 |
+
VISUAL_PARAMS = {'light_intensity': {'dist': 'choice', 'options': [1600., 2500., 3400.]}}
|
| 135 |
+
CAMERAS = {'front': {'eye': (-.1, -1.06, 1.282), 'target': (.42, -.08, .06),
|
| 136 |
+
'focal': 16., 'bands': {
|
| 137 |
+
'eye_x': {'dist': 'uniform', 'lo': -.125, 'hi': -.075},
|
| 138 |
+
'eye_y': {'dist': 'uniform', 'lo': -1.085, 'hi': -1.035},
|
| 139 |
+
'target_x': {'dist': 'uniform', 'lo': .405, 'hi': .435}}}}
|
| 140 |
+
|
| 141 |
+
def apply_visual_params(self, env, values):
|
| 142 |
+
# Render-only light; never touches geometry, contact, or robot control.
|
| 143 |
+
from pxr import UsdLux
|
| 144 |
+
if 'light_intensity' in values:
|
| 145 |
+
prim = env.sim.stage.GetPrimAtPath('/World/light')
|
| 146 |
+
UsdLux.LightAPI(prim).GetIntensityAttr().Set(float(values['light_intensity']))
|
| 147 |
+
|
| 148 |
+
# Card-local y extent of the body collision slab (from gpu_rtx2060.usd `/gpu/collision/body`:
|
| 149 |
+
# backplate plane -2 mm, fan-shroud plane +32.8 mm around the PCB-tab-centre origin — the
|
| 150 |
+
# collider is trimmed to the VISUAL shell). The stand's rails flank THESE faces — the same
|
| 151 |
+
# pair a parallel-jaw grasp pinches.
|
| 152 |
+
CARD_BODY_Y: ClassVar[tuple[float, float]] = (-0.002, 0.0328)
|
| 153 |
+
|
| 154 |
+
def __init__(self, cfg: PcGpuAssemblySceneCfg | None = None) -> None:
|
| 155 |
+
super().__init__(cfg or PcGpuAssemblySceneCfg())
|
| 156 |
+
|
| 157 |
+
# ----- assets -------------------------------------------------------------------------------
|
| 158 |
+
def assets(self) -> dict[str, Any]:
|
| 159 |
+
"""Floor, dome light, table, the PC case lying on it (kinematic, with the invisible slot
|
| 160 |
+
fixture), and one loose graphics card. The card loads with the high solver-iteration count
|
| 161 |
+
the snug channel needs."""
|
| 162 |
+
import isaaclab.sim as sim_utils
|
| 163 |
+
from isaaclab.assets import AssetBaseCfg, RigidObjectCfg
|
| 164 |
+
|
| 165 |
+
c = self.cfg
|
| 166 |
+
for usd in (c.case_usd, c.card_usd):
|
| 167 |
+
if not Path(usd).is_file():
|
| 168 |
+
raise FileNotFoundError(
|
| 169 |
+
f"{usd} not found — the pc-gpu assets ship with the repo under "
|
| 170 |
+
f"`suites/assembly/assets/`"
|
| 171 |
+
)
|
| 172 |
+
preset = c.TABLES[c.table]
|
| 173 |
+
wx, wy = c.workbench_pos
|
| 174 |
+
table_z = c.surface_z - preset["top_offset"]
|
| 175 |
+
ground_z = c.surface_z - preset["height"]
|
| 176 |
+
table_spawn = sim_utils.UsdFileCfg(usd_path=c.workbench_usd, scale=(preset["scale"],) * 3)
|
| 177 |
+
if preset["kinematic"]:
|
| 178 |
+
table_spawn.rigid_props = sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True)
|
| 179 |
+
|
| 180 |
+
cx, cy = c.card_init_xy
|
| 181 |
+
assets: dict[str, Any] = {
|
| 182 |
+
"ground": AssetBaseCfg(
|
| 183 |
+
prim_path="/World/ground",
|
| 184 |
+
spawn=sim_utils.GroundPlaneCfg(usd_path=str(
|
| 185 |
+
asset_path(Path(__file__).resolve().parents[1] / "assets") / "props" / "ground" / "default_ground.usd")),
|
| 186 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, ground_z)),
|
| 187 |
+
),
|
| 188 |
+
"light": AssetBaseCfg(
|
| 189 |
+
prim_path="/World/light",
|
| 190 |
+
spawn=sim_utils.DomeLightCfg(intensity=c.light_intensity, color=(0.9, 0.9, 0.9)),
|
| 191 |
+
),
|
| 192 |
+
"workbench": AssetBaseCfg(
|
| 193 |
+
prim_path="{ENV_REGEX_NS}/Table",
|
| 194 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(wx, wy, table_z), rot=preset["orient"]),
|
| 195 |
+
spawn=table_spawn,
|
| 196 |
+
),
|
| 197 |
+
# The case: kinematic; the invisible fixture inside it (slot channel + rear-panel
|
| 198 |
+
# cutout frame) is what the card mates with. Fixture contact offsets are set here
|
| 199 |
+
# (not just authored in the asset) so the 0.15 mm/side channel grip never fights
|
| 200 |
+
# speculative contacts.
|
| 201 |
+
"case": RigidObjectCfg(
|
| 202 |
+
prim_path="{ENV_REGEX_NS}/Case",
|
| 203 |
+
spawn=sim_utils.UsdFileCfg(
|
| 204 |
+
usd_path=c.case_usd,
|
| 205 |
+
activate_contact_sensors=True,
|
| 206 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 207 |
+
contact_offset=c.case_contact_offset, rest_offset=0.0
|
| 208 |
+
),
|
| 209 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
|
| 210 |
+
),
|
| 211 |
+
init_state=RigidObjectCfg.InitialStateCfg(pos=(wx, wy, c.surface_z + c.case_lift)),
|
| 212 |
+
),
|
| 213 |
+
# Card contact offset must stay well below the channel grip (0.15 mm/side) or
|
| 214 |
+
# speculative contacts choke the fit.
|
| 215 |
+
"card": RigidObjectCfg(
|
| 216 |
+
prim_path="{ENV_REGEX_NS}/Card",
|
| 217 |
+
spawn=sim_utils.UsdFileCfg(
|
| 218 |
+
usd_path=c.card_usd,
|
| 219 |
+
activate_contact_sensors=True,
|
| 220 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 221 |
+
contact_offset=c.card_contact_offset, rest_offset=0.0
|
| 222 |
+
),
|
| 223 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(
|
| 224 |
+
solver_position_iteration_count=192,
|
| 225 |
+
solver_velocity_iteration_count=1,
|
| 226 |
+
max_depenetration_velocity=0.02,
|
| 227 |
+
linear_damping=2.0,
|
| 228 |
+
angular_damping=2.0,
|
| 229 |
+
),
|
| 230 |
+
mass_props=sim_utils.MassPropertiesCfg(mass=c.card_mass),
|
| 231 |
+
),
|
| 232 |
+
init_state=RigidObjectCfg.InitialStateCfg(
|
| 233 |
+
pos=(wx + cx, wy + cy, c.surface_z + c.card_init_z), rot=c.card_init_quat
|
| 234 |
+
),
|
| 235 |
+
),
|
| 236 |
+
}
|
| 237 |
+
if c.card_stand:
|
| 238 |
+
# Foam holder for a gripper env: three STATIC boxes (no rigid body). The floor pad's
|
| 239 |
+
# top is the card spawn height (`card_init_z` = the tab-bottom plane), the two rails
|
| 240 |
+
# flank the body slab's faces at `card_stand_gap` per side. Rail tops stay 35+ mm
|
| 241 |
+
# below the pick grip band, so descending open fingers never meet them.
|
| 242 |
+
y0, y1 = self.CARD_BODY_Y
|
| 243 |
+
mid_y = wy + cy + 0.5 * (y0 + y1) # body-slab mid-plane (the pinch/rail centre)
|
| 244 |
+
half_gap = 0.5 * (y1 - y0) + c.card_stand_gap # rail inner face off the mid-plane
|
| 245 |
+
rail_h, rail_t = 0.055, 0.008
|
| 246 |
+
foam = sim_utils.PreviewSurfaceCfg(diffuse_color=(0.17, 0.17, 0.2), roughness=0.9)
|
| 247 |
+
for name, size, pos in (
|
| 248 |
+
("card_stand_floor", (0.11, 0.09, c.card_init_z),
|
| 249 |
+
(wx + cx, mid_y, c.surface_z + 0.5 * c.card_init_z)),
|
| 250 |
+
("card_stand_rail_pcb", (0.11, rail_t, rail_h),
|
| 251 |
+
(wx + cx, mid_y - half_gap - 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 252 |
+
("card_stand_rail_fan", (0.11, rail_t, rail_h),
|
| 253 |
+
(wx + cx, mid_y + half_gap + 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 254 |
+
):
|
| 255 |
+
assets[name] = AssetBaseCfg(
|
| 256 |
+
prim_path="{ENV_REGEX_NS}/" + "".join(p.capitalize() for p in name.split("_")),
|
| 257 |
+
spawn=sim_utils.CuboidCfg(
|
| 258 |
+
size=size,
|
| 259 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 260 |
+
contact_offset=0.001, rest_offset=0.0
|
| 261 |
+
),
|
| 262 |
+
visual_material=foam,
|
| 263 |
+
),
|
| 264 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=pos),
|
| 265 |
+
)
|
| 266 |
+
# Immutable visual-only set dressing, clear of the arm/task swept volume.
|
| 267 |
+
assets['pilot_parts_box'] = AssetBaseCfg(
|
| 268 |
+
prim_path='{ENV_REGEX_NS}/PilotPartsBox',
|
| 269 |
+
spawn=sim_utils.CuboidCfg(size=(.075, .075, .045),
|
| 270 |
+
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(.08, .35, .65), roughness=.8)),
|
| 271 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(.90, .36, c.surface_z+.0225)))
|
| 272 |
+
return assets
|
| 273 |
+
|
| 274 |
+
def sim_cfg(self) -> SimCfg:
|
| 275 |
+
return SimCfg(
|
| 276 |
+
dt=1.0 / 120.0,
|
| 277 |
+
physx={
|
| 278 |
+
"solver_type": 1,
|
| 279 |
+
"bounce_threshold_velocity": 0.2,
|
| 280 |
+
"friction_offset_threshold": 0.01,
|
| 281 |
+
"friction_correlation_distance": 0.00625,
|
| 282 |
+
"gpu_max_rigid_contact_count": 2**23,
|
| 283 |
+
"gpu_max_rigid_patch_count": 2**23,
|
| 284 |
+
"gpu_collision_stack_size": 2**28,
|
| 285 |
+
"gpu_max_num_partitions": 1,
|
| 286 |
+
},
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# ----- lifecycle ----------------------------------------------------------------------------
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, name: str):
|
| 292 |
+
# Legacy surface: the grasp contract's state used to live directly on the scene
|
| 293 |
+
# (inline machinery era) and existing solutions read it there — forward to the
|
| 294 |
+
# composed contract. `__getattr__` only fires for attributes not found normally.
|
| 295 |
+
if name.startswith("_gw_") and "grasp_weld" in self.__dict__:
|
| 296 |
+
return getattr(self.grasp_weld, name)
|
| 297 |
+
raise AttributeError(name)
|
| 298 |
+
|
| 299 |
+
def bind(self, env: BaseEnv) -> None:
|
| 300 |
+
"""Grab the case + card handles, cache env origins, and set the part frictions."""
|
| 301 |
+
super().bind(env)
|
| 302 |
+
self.case: RigidObject = env.iscene["case"]
|
| 303 |
+
self.card: RigidObject = env.iscene["card"]
|
| 304 |
+
self.env_origins = env.iscene.env_origins
|
| 305 |
+
self._set_friction(self.case, self.cfg.case_friction)
|
| 306 |
+
self._set_friction(self.card, self.cfg.card_friction)
|
| 307 |
+
self.grasp_weld = GraspWeldContract(self) # composed, publishes self.grasp_held
|
| 308 |
+
self.grasp_weld.bind()
|
| 309 |
+
|
| 310 |
+
def grasp_sites(self) -> list:
|
| 311 |
+
"""One grip band: across the body slab (faces at CARD_BODY_Y, 34.8 mm wide), along the
|
| 312 |
+
card's upper length — band centre 15 mm below the shroud's top edge (z 0.1155)."""
|
| 313 |
+
y = 0.5 * (self.CARD_BODY_Y[0] + self.CARD_BODY_Y[1])
|
| 314 |
+
return [("card", self.card, (-0.045, y, 0.1005), (0.045, y, 0.1005), (0.030, 0.039))]
|
| 315 |
+
|
| 316 |
+
def post_step(self, env_ids: torch.Tensor | None = None) -> None:
|
| 317 |
+
"""Reconcile the weld-on-closure grasp contract every physics substep."""
|
| 318 |
+
self.grasp_weld.step()
|
| 319 |
+
|
| 320 |
+
def _set_friction(self, asset, value: float) -> None:
|
| 321 |
+
"""Overwrite the static + dynamic friction on every shape of `asset` (across all envs)."""
|
| 322 |
+
mats = asset.root_physx_view.get_material_properties()
|
| 323 |
+
mats[..., 0:2] = value # [static, dynamic, restitution]
|
| 324 |
+
asset.root_physx_view.set_material_properties(mats, torch.arange(self.env.num_envs, device="cpu"))
|
| 325 |
+
|
| 326 |
+
def reset(self, env_ids: torch.Tensor) -> None:
|
| 327 |
+
"""Fresh, unassembled start: the case pinned at spawn, the card lying backplate-down on
|
| 328 |
+
the table beside it, with xy jitter."""
|
| 329 |
+
c = self.cfg
|
| 330 |
+
dev = self.env.device
|
| 331 |
+
m = len(env_ids)
|
| 332 |
+
origin = self.env_origins[env_ids] # (m, 3)
|
| 333 |
+
wx, wy = c.workbench_pos
|
| 334 |
+
cx, cy = c.card_init_xy
|
| 335 |
+
|
| 336 |
+
st = torch.zeros(m, 13, device=dev)
|
| 337 |
+
st[:, 0:3] = origin + torch.tensor((wx + cx, wy + cy, c.surface_z + c.card_init_z), device=dev)
|
| 338 |
+
st[:, 0:2] += (torch.rand(m, 2, device=dev) * 2 - 1) * c.reset_pos_jitter
|
| 339 |
+
# Small in-holder variation: below rail clearance; no case/slot changes.
|
| 340 |
+
st[:, :2] += (torch.rand(m, 2, device=dev)*2-1) * torch.tensor(
|
| 341 |
+
[c.pilot_jitter_x, c.pilot_jitter_y], device=dev)
|
| 342 |
+
st[:, 3:7] = torch.tensor(c.card_init_quat, device=dev)
|
| 343 |
+
self.card.write_root_state_to_sim(st, env_ids)
|
| 344 |
+
self.grasp_weld.release_all(env_ids)
|
| 345 |
+
|
| 346 |
+
# ----- state (full, restorable) -------------------------------------------------------------
|
| 347 |
+
def get_state(self, env_ids: torch.Tensor) -> dict[str, Any]:
|
| 348 |
+
"""Restorable scene state: world root states (13) of the case and the card, plus the
|
| 349 |
+
grasp-weld holds."""
|
| 350 |
+
return {
|
| 351 |
+
"case": self.case.data.root_state_w[env_ids].clone(),
|
| 352 |
+
"card": self.card.data.root_state_w[env_ids].clone(),
|
| 353 |
+
**self.grasp_weld.state(env_ids),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
def set_state(self, state: dict[str, Any], env_ids: torch.Tensor) -> None:
|
| 357 |
+
"""Restore what `get_state` returned. The card's insertion depth is fully captured by its
|
| 358 |
+
root state, so the channel holds it on restore."""
|
| 359 |
+
self.case.write_root_pose_to_sim(state["case"][:, 0:7], env_ids)
|
| 360 |
+
self.card.write_root_state_to_sim(state["card"], env_ids)
|
| 361 |
+
self.grasp_weld.restore(state, env_ids)
|
| 362 |
+
|
| 363 |
+
# ----- description --------------------------------------------------------------------------
|
| 364 |
+
def describe(self) -> str:
|
| 365 |
+
if self.cfg.card_stand:
|
| 366 |
+
card = (
|
| 367 |
+
"Beside the case a loose graphics card stands upright in a foam holder, already "
|
| 368 |
+
"in its installation orientation.\nGoal: grip the card by its top edge, lift it "
|
| 369 |
+
"straight out of the holder, "
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
card = (
|
| 373 |
+
"Beside the case lies a loose graphics card, backplate down.\nGoal: lift the "
|
| 374 |
+
"card upright (fans toward the case front), "
|
| 375 |
+
)
|
| 376 |
+
return (
|
| 377 |
+
"A gaming-PC case lying on its side on a sturdy table, opening up, its motherboard "
|
| 378 |
+
"facing the ceiling. The board's primary PCIe x16 slot is empty, and the rear I/O "
|
| 379 |
+
f"panel has an open expansion-slot cutout. {card}"
|
| 380 |
+
"lower it into the case with its I/O bracket just forward of the rear panel, slide "
|
| 381 |
+
"it rearward until the bracket and ports pass through the cutout, line its PCB edge "
|
| 382 |
+
"connector up with the x16 slot, and press it straight down until it bottoms out. "
|
| 383 |
+
"A seated card stays put on its own. The task is complete once the card is fully "
|
| 384 |
+
"seated."
|
| 385 |
+
+ " A fixed blue parts box decorates the far corner, outside the task volume."
|
| 386 |
+
+ (
|
| 387 |
+
" The card holds in a firm pinch: close the fingers squarely across its body "
|
| 388 |
+
"slab near the top edge and the grip locks; open wide to release."
|
| 389 |
+
if self.cfg.grasp_weld
|
| 390 |
+
else ""
|
| 391 |
+
)
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# ----- progress (public: seated()/engaged(); reads how far the assembly has got) -------------
|
| 395 |
+
def engaged(self) -> torch.Tensor:
|
| 396 |
+
"""Tab depth below the slot mouth, shape (num_envs,), in metres (negative = still above
|
| 397 |
+
the slot). The card bottoms out on the channel floor at 0.005 depth."""
|
| 398 |
+
rel = self._card_offset_in_case() # (n, 3), zero at the seated pose
|
| 399 |
+
return (self.cfg.slot_mouth_z - self.cfg.seat_pos[2]) - rel[:, 2]
|
| 400 |
+
|
| 401 |
+
def seated(self) -> torch.Tensor:
|
| 402 |
+
"""Whether the card is seated in the slot, shape (num_envs,): pressed down to `seat_depth`
|
| 403 |
+
below the mouth, within `align_xy` of the seated point, and aligned in tilt AND heading."""
|
| 404 |
+
c = self.cfg
|
| 405 |
+
rel = self._card_offset_in_case() # (n, 3)
|
| 406 |
+
depth_ok = self.engaged() >= c.seat_depth
|
| 407 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 408 |
+
up_ok = self._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 409 |
+
yaw_ok = self._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 410 |
+
return depth_ok & xy_ok & up_ok & yaw_ok
|
| 411 |
+
|
| 412 |
+
def success(self) -> torch.Tensor:
|
| 413 |
+
"""(N,) bool: the card seated in its slot — this scene's assembled state
|
| 414 |
+
(scene-level success alias, matching the other suites' surface)."""
|
| 415 |
+
return self.seated()
|
| 416 |
+
|
| 417 |
+
def _card_offset_in_case(self) -> torch.Tensor:
|
| 418 |
+
"""The card origin's offset from the seated point, in the case's local frame, shape
|
| 419 |
+
(num_envs, 3). Zero means the card origin sits exactly at the seated pose."""
|
| 420 |
+
from isaaclab.utils.math import quat_apply_inverse
|
| 421 |
+
|
| 422 |
+
rel = quat_apply_inverse(
|
| 423 |
+
self.case.data.root_quat_w, self.card.data.root_pos_w - self.case.data.root_pos_w
|
| 424 |
+
)
|
| 425 |
+
return rel - torch.tensor(self.cfg.seat_pos, device=rel.device)
|
| 426 |
+
|
| 427 |
+
def _axis_cos(self, axis: int) -> torch.Tensor:
|
| 428 |
+
"""cos of the angle between the card's and the case's local `axis` (0=x: heading along the
|
| 429 |
+
slot, 2=z: insertion axis), shape (num_envs,). Seated orientation = the case's own axes."""
|
| 430 |
+
from isaaclab.utils.math import quat_apply
|
| 431 |
+
|
| 432 |
+
e = torch.zeros(3, device=self.env.device)
|
| 433 |
+
e[axis] = 1.0
|
| 434 |
+
e = e.expand(self.env.num_envs, 3)
|
| 435 |
+
case_ax = quat_apply(self.case.data.root_quat_w, e)
|
| 436 |
+
card_ax = quat_apply(self.card.data.root_quat_w, e)
|
| 437 |
+
return (card_ax * case_ax).sum(dim=-1)
|
| 438 |
+
|
| 439 |
+
# Grasp-weld contract: composed `GraspWeldContract` (robobench.core.grasp_weld),
|
| 440 |
+
# created in `bind()`; this scene supplies the part-side `grasp_sites()`.
|
| 441 |
+
# Grasp-weld contract constants — the scene's public knobs (solutions read these off the
|
| 442 |
+
# scene, e.g. `scene.GRASP_PINCH_OFFSET`); the composed GraspWeldContract consumes them.
|
| 443 |
+
GRASP_HAND_BODY: ClassVar[str] = "panda_hand"
|
| 444 |
+
GRASP_FINGER_JOINTS: ClassVar[str] = "panda_finger_joint.*"
|
| 445 |
+
GRASP_PINCH_OFFSET: ClassVar[float] = 0.1034 # hand origin -> finger-pad centre, along approach
|
| 446 |
+
GRASP_POOL: ClassVar[int] = 8 # engages per (env, site) per run; exhausted -> warn, no weld
|
| 447 |
+
GRASP_STALL: ClassVar[float] = 0.01 # max |finger vel| sum (m/s): fingers stopped ON the part
|
| 448 |
+
GRASP_DEBOUNCE: ClassVar[int] = 8 # consecutive qualifying substeps before the weld engages
|
| 449 |
+
GRASP_RELEASE_MARGIN: ClassVar[float] = 0.008 # release at window-top + this (m), hysteresis
|
| 450 |
+
|
provenance/generation_code/h_s0_2/strategy/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Base state-feedback program; Original central grasp and direct high transfer. DART offered only during high free-space transport. Initially UNTESTED; see pilot_report.json.
|
provenance/generation_code/h_s0_2/strategy/meta.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 1,
|
| 3 |
+
"successes": 1,
|
| 4 |
+
"success_rate": 1.0,
|
| 5 |
+
"batches": [
|
| 6 |
+
"p01_scene"
|
| 7 |
+
],
|
| 8 |
+
"refreshed": "2026-10-12T11:18:52+00:00"
|
| 9 |
+
}
|
provenance/generation_code/h_s0_2/strategy/parameters.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compensate_action_filter": true,
|
| 3 |
+
"integral_position": 0.8,
|
| 4 |
+
"integral_rotation": 0.5,
|
| 5 |
+
"speed": 0.03,
|
| 6 |
+
"carry_height": 0.26,
|
| 7 |
+
"forward_clearance": -0.045,
|
| 8 |
+
"slide_height": 0.018,
|
| 9 |
+
"press_speed": 0.003
|
| 10 |
+
}
|
provenance/generation_code/h_s0_2/strategy/solve.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# plan: [stages 1-3] card held; card aligned above slot; card seated and released
|
| 2 |
+
# origin=fresh
|
| 3 |
+
"""A state-feedback program for the registered Franka/OSC GPU-install task.
|
| 4 |
+
|
| 5 |
+
Only env.step(action) changes the world. No dataset, checkpoint, reset, state
|
| 6 |
+
restoration, controller replacement, or scene-parameter writes are used.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
DART_SIGMA = 0.03
|
| 14 |
+
SOLVE_PARAMS = {'DART_SIGMA': None}
|
| 15 |
+
ENTRIES = {'start': 'unassembled card upright in holder, hand free',
|
| 16 |
+
'preinsert': 'card genuinely held, above front entry, clear of all contacts'}
|
| 17 |
+
|
| 18 |
+
def solve(env, entry=None, stop_after=None) -> None:
|
| 19 |
+
import torch
|
| 20 |
+
from isaaclab.utils.math import (
|
| 21 |
+
axis_angle_from_quat, quat_apply, quat_conjugate, quat_mul,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
params = json.loads(Path(__file__).with_name('parameters.json').read_text())
|
| 25 |
+
scene, robot = env.scene, env.robot
|
| 26 |
+
art = robot.articulation
|
| 27 |
+
dev, n = env.device, env.num_envs
|
| 28 |
+
assert n == 1, 'This initial phase-1 delivery handles one environment per process'
|
| 29 |
+
osc = robot.controller.controllers[0]
|
| 30 |
+
assert type(osc).__name__ == 'OperationalSpaceController'
|
| 31 |
+
assert robot.action_dim == 8
|
| 32 |
+
hand = art.body_names.index('panda_hand')
|
| 33 |
+
dt = env.dt * robot.control_period
|
| 34 |
+
offset = float(scene.GRASP_PINCH_OFFSET)
|
| 35 |
+
zero = torch.zeros(3, device=dev)
|
| 36 |
+
integral_p, integral_r = zero.clone(), zero.clone()
|
| 37 |
+
steps = 0
|
| 38 |
+
active_phase = 'start'
|
| 39 |
+
if entry not in (None, 'start', 'preinsert'): raise ValueError(entry)
|
| 40 |
+
|
| 41 |
+
def v(values): return torch.tensor(values, device=dev, dtype=torch.float32)
|
| 42 |
+
def mul(a,b): return quat_mul(a[None],b[None])[0]
|
| 43 |
+
def inv(q): return quat_conjugate(q[None])[0]
|
| 44 |
+
def rotate(q,x): return quat_apply(q[None],x[None])[0]
|
| 45 |
+
def orientation_error(goal,current):
|
| 46 |
+
if float(torch.dot(goal,current)) < 0: goal = -goal
|
| 47 |
+
return axis_angle_from_quat(mul(goal, inv(current))[None])[0]
|
| 48 |
+
def hp(): return art.data.body_pos_w[0,hand].clone()
|
| 49 |
+
def hq(): return art.data.body_quat_w[0,hand].clone()
|
| 50 |
+
def cp(): return scene.card.data.root_pos_w[0].clone()
|
| 51 |
+
def cq(): return scene.card.data.root_quat_w[0].clone()
|
| 52 |
+
def held(): return bool(scene.grasp_held[0].any())
|
| 53 |
+
def pinch(): return hp() + rotate(hq(),v([0,0,offset]))
|
| 54 |
+
def band(): return cp()+rotate(cq(),v([0,sum(scene.CARD_BODY_Y)/2,.1005]))
|
| 55 |
+
|
| 56 |
+
def log(phase,**extra):
|
| 57 |
+
print('PHASE1 '+json.dumps(dict(phase=phase,steps=steps,seconds=steps*dt,
|
| 58 |
+
held=held(),card=cp().tolist(),hand=hp().tolist(),
|
| 59 |
+
offset=scene._card_offset_in_case()[0].tolist(),
|
| 60 |
+
depth=float(scene.engaged()[0]),integral_position=integral_p.tolist(),
|
| 61 |
+
integral_rotation=integral_r.tolist(),**extra)),flush=True)
|
| 62 |
+
|
| 63 |
+
def tick(goal,quat,finger):
|
| 64 |
+
nonlocal integral_p, integral_r, steps
|
| 65 |
+
ep, er = goal-hp(), orientation_error(quat,hq())
|
| 66 |
+
integral_p=(integral_p+ep*dt).clamp(-.10,.10)
|
| 67 |
+
integral_r=(integral_r+er*dt).clamp(-4.0,4.0)
|
| 68 |
+
dp=ep+params['integral_position']*integral_p
|
| 69 |
+
dr=er+params['integral_rotation']*integral_r
|
| 70 |
+
dr=dr*min(1,2.5/max(float(dr.norm()),1e-9))
|
| 71 |
+
action=torch.zeros((1,8),device=dev)
|
| 72 |
+
action[0,:3]=(dp/osc.cfg.pos_scale).clamp(-6,6)
|
| 73 |
+
action[0,3:6]=(dr/osc.cfg.rot_scale).clamp(-20,20)
|
| 74 |
+
action[0,6:]=finger
|
| 75 |
+
# The preset smooths pose DELTAS, rather than absolute targets. Account
|
| 76 |
+
# for its documented filter in the command; never write controller state.
|
| 77 |
+
if params.get('compensate_action_filter',False) and osc._prev_action is not None:
|
| 78 |
+
alpha=float(osc.cfg.ema_factor)
|
| 79 |
+
action[0,:6]=(action[0,:6]-(1-alpha)*osc._prev_action[0])/alpha
|
| 80 |
+
assert torch.isfinite(action).all()
|
| 81 |
+
# Noise offered independently of noise_scale. Recorder keeps labels clean.
|
| 82 |
+
disturbance = torch.zeros_like(action)
|
| 83 |
+
if active_phase in ('lift_clear', 'transport_waypoint', 'above_case') and float(hp()[2]) > .38:
|
| 84 |
+
disturbance[0, :3] = DART_SIGMA * torch.randn(3, device=dev)
|
| 85 |
+
env.step(action, noise=disturbance)
|
| 86 |
+
steps+=1
|
| 87 |
+
|
| 88 |
+
def move(goal_fn,grip,timeout,tag,tol=.002,rot_tol=.035,card_check=None):
|
| 89 |
+
nonlocal active_phase
|
| 90 |
+
active_phase = tag
|
| 91 |
+
ref=hp(); good=0
|
| 92 |
+
for _ in range(max(1,math.ceil(timeout/dt))):
|
| 93 |
+
goal,quat=goal_fn()
|
| 94 |
+
delta=goal-ref; length=float(delta.norm())
|
| 95 |
+
ref=ref+delta*min(1,params['speed']*dt/max(length,1e-9))
|
| 96 |
+
tick(ref,quat,grip)
|
| 97 |
+
goal,quat=goal_fn()
|
| 98 |
+
ok=float((hp()-goal).norm())<tol and float(orientation_error(quat,hq()).norm())<rot_tol
|
| 99 |
+
if card_check is not None:ok=ok and card_check()
|
| 100 |
+
good=good+1 if ok else 0
|
| 101 |
+
if good>=8:log(tag,result='reached');return
|
| 102 |
+
log(tag,result='timeout',position_error=float((hp()-goal).norm()),rotation_error=float(orientation_error(quat,hq()).norm()))
|
| 103 |
+
raise RuntimeError('Stage did not reach its measured gate: '+tag)
|
| 104 |
+
|
| 105 |
+
def hold(goal_fn,finger,seconds):
|
| 106 |
+
nonlocal active_phase
|
| 107 |
+
active_phase = 'hold'
|
| 108 |
+
for _ in range(math.ceil(seconds/dt)):
|
| 109 |
+
goal,quat=goal_fn();tick(goal,quat,finger)
|
| 110 |
+
|
| 111 |
+
log('start')
|
| 112 |
+
if entry != 'preinsert':
|
| 113 |
+
# Stage 1: acquire the top band and verify a real grasp.
|
| 114 |
+
down=[mul(cq(),v([0,0,1,0])),mul(cq(),v([0,1,0,0]))]
|
| 115 |
+
pick_q=max(down,key=lambda q:abs(float(torch.dot(q,hq())))).clone()
|
| 116 |
+
def pick_goal(height=0):
|
| 117 |
+
return band()-rotate(pick_q,v([0,0,offset]))+v([0,0,height]),pick_q
|
| 118 |
+
move(lambda:pick_goal(.10),.04,18,'above_card',tol=.004,rot_tol=.05)
|
| 119 |
+
move(pick_goal,.04,16,'pinch_aligned',tol=.0025)
|
| 120 |
+
for k in range(math.ceil(2/dt)):
|
| 121 |
+
goal,quat=pick_goal()
|
| 122 |
+
tick(goal,quat,.04+(.0172-.04)*min(1,(k+1)*dt/1.5))
|
| 123 |
+
hold(pick_goal,.0172,1)
|
| 124 |
+
if not held():log('grasp_failed');raise RuntimeError('No grasp after controlled closure')
|
| 125 |
+
log('card_held')
|
| 126 |
+
elif not held():
|
| 127 |
+
raise RuntimeError('preinsert entry requires an actual grasp')
|
| 128 |
+
rel_p=rotate(inv(hq()),cp()-hp())
|
| 129 |
+
rel_q=mul(inv(hq()),cq())
|
| 130 |
+
def card_goal(position,quat):
|
| 131 |
+
# The grasp joint fixes this measured card-in-hand transform. A fixed
|
| 132 |
+
# world-frame hand goal avoids moving the goal in response to its own lag.
|
| 133 |
+
target_q=mul(quat,inv(rel_q))
|
| 134 |
+
return position-rotate(target_q,rel_p),target_q
|
| 135 |
+
def case_point(local):
|
| 136 |
+
return scene.case.data.root_pos_w[0]+rotate(scene.case.data.root_quat_w[0],v(local))
|
| 137 |
+
case_q=scene.case.data.root_quat_w[0].clone()
|
| 138 |
+
seat=list(scene.cfg.seat_pos)
|
| 139 |
+
forward=seat[0]+params['forward_clearance']
|
| 140 |
+
if entry != 'preinsert':
|
| 141 |
+
lift=cp();lift[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 142 |
+
move(lambda:card_goal(lift,case_q),.0172,25,'lift_clear',tol=.003)
|
| 143 |
+
if not held():raise RuntimeError('Grasp lost during lift')
|
| 144 |
+
|
| 145 |
+
# Stage 2: enter forward of the rear panel, then slide through its cutout.
|
| 146 |
+
high=[forward,seat[1],params['carry_height']-float(scene.cfg.case_lift)]
|
| 147 |
+
move(lambda:card_goal(case_point(high),case_q),.0172,40,'above_case',tol=.003)
|
| 148 |
+
if stop_after == 'above_case': return
|
| 149 |
+
above=[forward,seat[1],float(scene.cfg.slot_mouth_z)+params['slide_height']]
|
| 150 |
+
move(lambda:card_goal(case_point(above),case_q),.0172,20,'inside_case',tol=.002)
|
| 151 |
+
aligned=[seat[0],seat[1],above[2]]
|
| 152 |
+
def card_aligned():
|
| 153 |
+
return float((cp()-case_point(aligned)).norm())<.0007 and float(orientation_error(case_q,cq()).norm())<.004
|
| 154 |
+
move(lambda:card_goal(case_point(aligned),case_q),.0172,30,'slot_aligned',tol=.0004,rot_tol=.003,card_check=card_aligned)
|
| 155 |
+
|
| 156 |
+
# Stage 3: press, release, retract, then leave the installed card unsupported.
|
| 157 |
+
pressed=[seat[0],seat[1],seat[2]-.001]
|
| 158 |
+
active_phase='press'
|
| 159 |
+
press_z=aligned[2]
|
| 160 |
+
for _ in range(math.ceil(25/dt)):
|
| 161 |
+
press_z=max(pressed[2],press_z-params['press_speed']*dt)
|
| 162 |
+
target,quat=card_goal(case_point([seat[0],seat[1],press_z]),case_q)
|
| 163 |
+
tick(target,quat,.0172)
|
| 164 |
+
if bool(scene.seated()[0]):break
|
| 165 |
+
if not bool(scene.seated()[0]):log('press_failed');raise RuntimeError('Card did not seat')
|
| 166 |
+
log('seated_before_release')
|
| 167 |
+
keep=hp(); keep_q=hq()
|
| 168 |
+
hold(lambda:(keep,keep_q),.04,2)
|
| 169 |
+
up=keep+v([0,0,.14])
|
| 170 |
+
move(lambda:(up,keep_q),.04,16,'hand_clear',tol=.004,rot_tol=.06)
|
| 171 |
+
hold(lambda:(up,keep_q),.04,5)
|
| 172 |
+
log('finished',seated=bool(scene.seated()[0]))
|
| 173 |
+
if held() or not bool(scene.seated()[0]):raise RuntimeError('Card did not remain seated after release')
|
provenance/generation_code/h_s0_3/grader.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Grader for the pc_gpu scene: the graphics card seated in the PCIe x16 slot.
|
| 2 |
+
|
| 3 |
+
Rubric stages (weights and modes live in RUBRIC):
|
| 4 |
+
grasped the card has been taken in the weld-on-closure grip (`scene.grasp_held`) — the
|
| 5 |
+
scene's own grasp state; a milestone, latched. Also true once the card is
|
| 6 |
+
aligned in the slot (a card in the slot was necessarily carried there), so the
|
| 7 |
+
rung nests under `aligned`. Under an embodiment with no gripper (the weld
|
| 8 |
+
contract disabled, e.g. robot="null") the grasp state does not exist and the
|
| 9 |
+
rung reads from that implication alone
|
| 10 |
+
aligned the card lined up on the slot — origin within `align_xy` of the seated point,
|
| 11 |
+
up axis within `align_axis_deg` of the slot axis, length axis within
|
| 12 |
+
`align_yaw_deg` of the slot heading: the scene's own three non-depth seat gates
|
| 13 |
+
pressed tab depth below the slot mouth (`slot_mouth_z`, the scene's own `engaged()`)
|
| 14 |
+
as a fraction of `seat_depth`, counted only while aligned — so it is 1.0 iff
|
| 15 |
+
the scene calls the card seated
|
| 16 |
+
Every stage is per env. The rungs nest (seated => aligned => grasped), so progress reaches
|
| 17 |
+
1.0 exactly when the card is seated, and for a grader built after the pick as well as one
|
| 18 |
+
that watched it. The rear-panel pass-through is NOT a rung: the cutout's geometry is not in
|
| 19 |
+
the scene cfg, so it cannot be read from state without an invented tolerance. Success is
|
| 20 |
+
the scene's `seated()` per env — depth, xy, tilt AND heading gates — read when the
|
| 21 |
+
delivery finishes.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
|
| 28 |
+
from robobench.core import BaseGrader
|
| 29 |
+
# baked by data_engine init: grade against the LOCAL scene copy (../scene/scene.py),
|
| 30 |
+
# exec'd at most once per process under a fixed module key.
|
| 31 |
+
import importlib.util as _ilu
|
| 32 |
+
import sys as _sys
|
| 33 |
+
from pathlib import Path as _Path
|
| 34 |
+
|
| 35 |
+
if "datagen_local_scene" not in _sys.modules:
|
| 36 |
+
import robobench as _rb
|
| 37 |
+
_rb.discover()
|
| 38 |
+
_p = _Path(__file__).resolve().parent.parent / "scene" / "scene.py"
|
| 39 |
+
_spec = _ilu.spec_from_file_location("datagen_local_scene", _p)
|
| 40 |
+
_m = _ilu.module_from_spec(_spec)
|
| 41 |
+
_sys.modules["datagen_local_scene"] = _m
|
| 42 |
+
_spec.loader.exec_module(_m)
|
| 43 |
+
PcGpuAssemblyScene = _sys.modules["datagen_local_scene"].PcGpuAssemblyScene
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PcGpuAssemblyGrader(BaseGrader):
|
| 47 |
+
"""The card seated in its slot — pressed to depth, centred, upright, heading along the slot.
|
| 48 |
+
|
| 49 |
+
Ladder: grasped 0.33 · aligned 0.67 · pressed 1.00 — three equal rungs for the three
|
| 50 |
+
steps of the task (take the card, line it up on the slot, press it home); the last rung
|
| 51 |
+
is a linear ramp of tab depth from the slot mouth (`slot_mouth_z`) to `seat_depth`.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
SCENE = PcGpuAssemblyScene
|
| 55 |
+
RUBRIC = (("grasped", 1, "once"), ("aligned", 1), ("pressed", 1))
|
| 56 |
+
scene: PcGpuAssemblyScene
|
| 57 |
+
|
| 58 |
+
def setup(self) -> None:
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# `grasp_held` exists only while the weld contract is live (a gripper on the stage).
|
| 62 |
+
self._has_grasp = hasattr(self.scene, "grasp_held")
|
| 63 |
+
self._grasped = torch.zeros(self.num_envs, dtype=torch.bool,
|
| 64 |
+
device=self.scene.engaged().device) # latch: card ever held
|
| 65 |
+
|
| 66 |
+
def check_success(self):
|
| 67 |
+
return self.scene.seated() # (num_envs,)
|
| 68 |
+
|
| 69 |
+
def _aligned(self):
|
| 70 |
+
"""(num_envs,) bool: the scene's xy + tilt + heading seat gates, without depth."""
|
| 71 |
+
c = self.scene.cfg
|
| 72 |
+
rel = self.scene._card_offset_in_case() # (n, 3), zero at the seated pose — privileged
|
| 73 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 74 |
+
up_ok = self.scene._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 75 |
+
yaw_ok = self.scene._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 76 |
+
return xy_ok & up_ok & yaw_ok
|
| 77 |
+
|
| 78 |
+
# ---- rubric stages — each returns a (num_envs,) value in [0, 1] ---------------------
|
| 79 |
+
def grasped(self):
|
| 80 |
+
if self._has_grasp:
|
| 81 |
+
self._grasped |= self.scene.grasp_held.any(dim=1)
|
| 82 |
+
return (self._grasped | self._aligned()).float()
|
| 83 |
+
|
| 84 |
+
def aligned(self):
|
| 85 |
+
return self._aligned().float()
|
| 86 |
+
|
| 87 |
+
def pressed(self):
|
| 88 |
+
depth = self.scene.engaged() # (n,) tab depth below the slot mouth (m)
|
| 89 |
+
return self._aligned() * (depth / self.scene.cfg.seat_depth).clamp(0.0, 1.0)
|
provenance/generation_code/h_s0_3/scene.py
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PcGpuAssemblyScene — insert a graphics card into the PC's PCIe slot.
|
| 2 |
+
|
| 3 |
+
The same gaming-PC case as `pc_motherboard` lies on its side on the table, opening up, motherboard
|
| 4 |
+
facing the ceiling — but here the board's PCIe area is the work site. Beside the case lies a loose
|
| 5 |
+
RTX 2060 (extracted from the PC model as its own rigid body, backplate down). Goal (carried here,
|
| 6 |
+
no task layer): stand the card upright over the primary x16 slot, line its PCB edge up with the
|
| 7 |
+
slot, and press it straight down until it seats.
|
| 8 |
+
|
| 9 |
+
The case is one kinematic body that never moves — the PC model stays visual-only; its physics is
|
| 10 |
+
an invisible fixture inside the case body: a channel whose walls grip the card's 4 mm PCB tab at
|
| 11 |
+
0.15 mm/side (flaring to a 1.2 mm/side funnel mouth — idealizing the real slot's spring
|
| 12 |
+
contacts, and capping the unscrewed card's gravity roll at ~2 deg), a floor whose top is the
|
| 13 |
+
model's own seated tab height, end stops (~1.6 mm play), a flush board plate so a dropped card
|
| 14 |
+
rests on the board face, and a REAR I/O PANEL frame around the expansion-slot cutout — so the
|
| 15 |
+
card must be placed inside the case, slid rearward until its bracket/ports pass through the
|
| 16 |
+
opening, and only then pressed down (a straight vertical drop is physically blocked by the
|
| 17 |
+
panel above the cutout, exactly like a real build). The card's origin is its
|
| 18 |
+
PCB-tab bottom CENTRE with axes equal to the case's, so the seated pose is just `seat_pos` +
|
| 19 |
+
identity orientation in the case frame, and insertion depth is a z difference.
|
| 20 |
+
|
| 21 |
+
Heavy imports (isaaclab, pxr) are deferred so importing this module stays app-free.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
from robobench.core.assets import asset_path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, ClassVar
|
| 31 |
+
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
from robobench.core import GraspWeldContract, SCENES, BaseCfg, BaseScene, SimCfg
|
| 35 |
+
|
| 36 |
+
if TYPE_CHECKING:
|
| 37 |
+
from isaaclab.assets import RigidObject
|
| 38 |
+
|
| 39 |
+
from robobench.core import BaseEnv
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class PcGpuAssemblySceneCfg(BaseCfg):
|
| 44 |
+
"""Config for `PcGpuAssemblyScene`. Nothing is locked — a variant is just a copy with a few
|
| 45 |
+
fields changed."""
|
| 46 |
+
|
| 47 |
+
# --- the curriculum / difficulty dials -----------------------------------------------
|
| 48 |
+
# The card is "seated" when — in the case's frame — its tab is >= `seat_depth` below the slot
|
| 49 |
+
# mouth, its origin is within `align_xy` of the seated point, and its axes are within
|
| 50 |
+
# `align_axis_deg` (tilt) / `align_yaw_deg` (heading along the slot) of the case's. The full
|
| 51 |
+
# stroke from the slot mouth to the channel floor is 5 mm, so 4 mm separates "seated" from
|
| 52 |
+
# "merely resting in the mouth".
|
| 53 |
+
seat_depth: float = 0.004 # min tab depth below the slot mouth (m) to count as seated
|
| 54 |
+
align_xy: float = 0.003 # max distance (m) of the card origin from the seated point
|
| 55 |
+
align_axis_deg: float = 3.0 # max tilt of the card's up axis off the slot axis (deg)
|
| 56 |
+
align_yaw_deg: float = 3.0 # max heading error of the card's length axis (deg)
|
| 57 |
+
reset_pos_jitter: float = 0.01 # uniform +/- xy jitter for the loose card at reset (m)
|
| 58 |
+
# Part friction (static = dynamic), set on every shape at bind. The moving card runs moderately
|
| 59 |
+
# slick against a grippier fixed case, so it slides down the channel but holds seat.
|
| 60 |
+
card_friction: float = 0.3
|
| 61 |
+
case_friction: float = 0.75
|
| 62 |
+
# Weld-on-closure grasping (the benchmark's auto-weld contract, PhysX
|
| 63 |
+
# form — the grasp-weld machinery at the end of this scene class):
|
| 64 |
+
# close the fingers squarely across the card's body slab near its top edge and the card welds
|
| 65 |
+
# to the hand; open wide to release. Gripper envs only (no-op under robot="null").
|
| 66 |
+
grasp_weld: bool = True
|
| 67 |
+
grasp_weld_dist: float = 0.010 # pinch-point-to-grip-band engage radius (m)
|
| 68 |
+
|
| 69 |
+
pilot_jitter_x: float = 0.004
|
| 70 |
+
pilot_jitter_y: float = 0.0007
|
| 71 |
+
|
| 72 |
+
# --- structure, reset layout, masses, asset paths (fixed) -------------------------------
|
| 73 |
+
# Seated card origin (its PCB-tab bottom centre) in the case's local frame; orientation seated
|
| 74 |
+
# = the case's own axes (identity). Baked into the committed USDs (keep in sync if they change).
|
| 75 |
+
seat_pos: tuple[float, float, float] = (-0.01595, 0.0293, 0.0035)
|
| 76 |
+
slot_mouth_z: float = 0.0085 # slot top in the case frame: depth datum (5 mm at full seat)
|
| 77 |
+
board_top: float = 0.0 # board face height in the case frame (the asset's own origin)
|
| 78 |
+
case_lift: float = 0.0289 # board face above the side panel the case lies on
|
| 79 |
+
card_mass: float = 1.0 # dual-fan RTX 2060 (kg)
|
| 80 |
+
light_intensity: float = 2500.0
|
| 81 |
+
# Loose card start pose: lying backplate-down on the table beside the case (+x side; the case
|
| 82 |
+
# spans x < 0.13 and the lying card's tail reaches origin_x - 0.132).
|
| 83 |
+
card_init_xy: tuple[float, float] = (0.28, 0.0) # card start xy (table-rel.)
|
| 84 |
+
card_init_z: float = 0.0022 # origin height lying backplate-down (backplate plane -2 mm)
|
| 85 |
+
card_init_quat: tuple[float, float, float, float] = (0.70711, 0.70711, 0.0, 0.0) # flat
|
| 86 |
+
card_contact_offset: float = 0.0001 # well below the 0.15 mm/side channel grip
|
| 87 |
+
case_contact_offset: float = 0.0001 # ditto for the slot fixture's walls
|
| 88 |
+
# Optional foam holder (a floor pad + two rails flanking the card's 36 mm body slab) that
|
| 89 |
+
# presents the card UPRIGHT for a parallel-jaw grasp. The lying default is ungraspable by a
|
| 90 |
+
# Franka gripper: flat on its backplate the card's only sub-80 mm dimension (the 36 mm body
|
| 91 |
+
# thickness) points UP, so no top-down or side pinch can straddle it. Enable together with an
|
| 92 |
+
# upright `card_init_quat` (identity = the seated orientation) and `card_init_z` = the
|
| 93 |
+
# holder's floor top; the rails cap the free card's lean at ~3 deg and the pick pulls
|
| 94 |
+
# straight up out of them.
|
| 95 |
+
card_stand: bool = False
|
| 96 |
+
card_stand_gap: float = 0.0025 # rail clearance per side around the body slab (m)
|
| 97 |
+
# Selectable work surface (same presets as the sibling scenes).
|
| 98 |
+
table: str = "lab_table" # which work surface: "lab_table" | "packing"
|
| 99 |
+
surface_z: float | None = None # table-top height (m); None -> the preset's
|
| 100 |
+
workbench_pos: tuple[float, float] | None = None # xy the table sits at; None -> preset
|
| 101 |
+
workbench_usd: str = "" # empty -> the preset's vendored USD
|
| 102 |
+
TABLES: ClassVar[dict[str, dict[str, Any]]] = {
|
| 103 |
+
"lab_table": {"usd": ("lab_table", "table_instanceable.usd"), "scale": 1.0,
|
| 104 |
+
"orient": (0.70711, 0.0, 0.0, 0.70711), "surface_z": 0.0, "pos": (0.5, 0.0),
|
| 105 |
+
"top_offset": 0.0, "height": 1.05, "kinematic": False},
|
| 106 |
+
"packing": {"usd": ("packing_table", "SM_HeavyDutyPackingTable_C02_01_physics.usd"), "scale": 0.01,
|
| 107 |
+
"orient": (1.0, 0.0, 0.0, 0.0), "surface_z": 0.994, "pos": (0.0, 0.0),
|
| 108 |
+
"top_offset": 0.994, "height": 0.994, "kinematic": True},
|
| 109 |
+
}
|
| 110 |
+
# Asset USDs; empty -> the prebuilt assets committed under `assets/`.
|
| 111 |
+
asset_dir: str = ""
|
| 112 |
+
case_usd: str = ""
|
| 113 |
+
card_usd: str = ""
|
| 114 |
+
|
| 115 |
+
def __post_init__(self) -> None:
|
| 116 |
+
assets = asset_path(Path(__file__).resolve().parents[1] / "assets")
|
| 117 |
+
self.asset_dir = self.asset_dir or str(assets)
|
| 118 |
+
self.case_usd = self.case_usd or str(Path(self.asset_dir) / "pc" / "pc_case_gpu_assembly_mb.usd")
|
| 119 |
+
self.card_usd = self.card_usd or str(Path(self.asset_dir) / "pc" / "gpu_rtx2060.usd")
|
| 120 |
+
preset = self.TABLES[self.table]
|
| 121 |
+
if self.surface_z is None:
|
| 122 |
+
self.surface_z = preset["surface_z"]
|
| 123 |
+
if self.workbench_pos is None:
|
| 124 |
+
self.workbench_pos = preset["pos"]
|
| 125 |
+
self.workbench_usd = self.workbench_usd or str(assets / "props" / preset["usd"][0] / preset["usd"][1])
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@SCENES.register("pc_gpu_local")
|
| 129 |
+
class PcGpuAssemblyScene(BaseScene):
|
| 130 |
+
cfg: PcGpuAssemblySceneCfg
|
| 131 |
+
|
| 132 |
+
# Object physics remains nominal in this pilot; L4 uses the recorded noise channel.
|
| 133 |
+
PHYSICAL_PARAMS = {'card_mass': None, 'card_friction': None, 'case_friction': None}
|
| 134 |
+
VISUAL_PARAMS = {'light_intensity': {'dist': 'choice', 'options': [1600., 2500., 3400.]}}
|
| 135 |
+
CAMERAS = {'front': {'eye': (-.1, -1.06, 1.282), 'target': (.42, -.08, .06),
|
| 136 |
+
'focal': 16., 'bands': {
|
| 137 |
+
'eye_x': {'dist': 'uniform', 'lo': -.125, 'hi': -.075},
|
| 138 |
+
'eye_y': {'dist': 'uniform', 'lo': -1.085, 'hi': -1.035},
|
| 139 |
+
'target_x': {'dist': 'uniform', 'lo': .405, 'hi': .435}}}}
|
| 140 |
+
|
| 141 |
+
def apply_visual_params(self, env, values):
|
| 142 |
+
# Render-only light; never touches geometry, contact, or robot control.
|
| 143 |
+
from pxr import UsdLux
|
| 144 |
+
if 'light_intensity' in values:
|
| 145 |
+
prim = env.sim.stage.GetPrimAtPath('/World/light')
|
| 146 |
+
UsdLux.LightAPI(prim).GetIntensityAttr().Set(float(values['light_intensity']))
|
| 147 |
+
|
| 148 |
+
# Card-local y extent of the body collision slab (from gpu_rtx2060.usd `/gpu/collision/body`:
|
| 149 |
+
# backplate plane -2 mm, fan-shroud plane +32.8 mm around the PCB-tab-centre origin — the
|
| 150 |
+
# collider is trimmed to the VISUAL shell). The stand's rails flank THESE faces — the same
|
| 151 |
+
# pair a parallel-jaw grasp pinches.
|
| 152 |
+
CARD_BODY_Y: ClassVar[tuple[float, float]] = (-0.002, 0.0328)
|
| 153 |
+
|
| 154 |
+
def __init__(self, cfg: PcGpuAssemblySceneCfg | None = None) -> None:
|
| 155 |
+
super().__init__(cfg or PcGpuAssemblySceneCfg())
|
| 156 |
+
|
| 157 |
+
# ----- assets -------------------------------------------------------------------------------
|
| 158 |
+
def assets(self) -> dict[str, Any]:
|
| 159 |
+
"""Floor, dome light, table, the PC case lying on it (kinematic, with the invisible slot
|
| 160 |
+
fixture), and one loose graphics card. The card loads with the high solver-iteration count
|
| 161 |
+
the snug channel needs."""
|
| 162 |
+
import isaaclab.sim as sim_utils
|
| 163 |
+
from isaaclab.assets import AssetBaseCfg, RigidObjectCfg
|
| 164 |
+
|
| 165 |
+
c = self.cfg
|
| 166 |
+
for usd in (c.case_usd, c.card_usd):
|
| 167 |
+
if not Path(usd).is_file():
|
| 168 |
+
raise FileNotFoundError(
|
| 169 |
+
f"{usd} not found — the pc-gpu assets ship with the repo under "
|
| 170 |
+
f"`suites/assembly/assets/`"
|
| 171 |
+
)
|
| 172 |
+
preset = c.TABLES[c.table]
|
| 173 |
+
wx, wy = c.workbench_pos
|
| 174 |
+
table_z = c.surface_z - preset["top_offset"]
|
| 175 |
+
ground_z = c.surface_z - preset["height"]
|
| 176 |
+
table_spawn = sim_utils.UsdFileCfg(usd_path=c.workbench_usd, scale=(preset["scale"],) * 3)
|
| 177 |
+
if preset["kinematic"]:
|
| 178 |
+
table_spawn.rigid_props = sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True)
|
| 179 |
+
|
| 180 |
+
cx, cy = c.card_init_xy
|
| 181 |
+
assets: dict[str, Any] = {
|
| 182 |
+
"ground": AssetBaseCfg(
|
| 183 |
+
prim_path="/World/ground",
|
| 184 |
+
spawn=sim_utils.GroundPlaneCfg(usd_path=str(
|
| 185 |
+
asset_path(Path(__file__).resolve().parents[1] / "assets") / "props" / "ground" / "default_ground.usd")),
|
| 186 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, ground_z)),
|
| 187 |
+
),
|
| 188 |
+
"light": AssetBaseCfg(
|
| 189 |
+
prim_path="/World/light",
|
| 190 |
+
spawn=sim_utils.DomeLightCfg(intensity=c.light_intensity, color=(0.9, 0.9, 0.9)),
|
| 191 |
+
),
|
| 192 |
+
"workbench": AssetBaseCfg(
|
| 193 |
+
prim_path="{ENV_REGEX_NS}/Table",
|
| 194 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(wx, wy, table_z), rot=preset["orient"]),
|
| 195 |
+
spawn=table_spawn,
|
| 196 |
+
),
|
| 197 |
+
# The case: kinematic; the invisible fixture inside it (slot channel + rear-panel
|
| 198 |
+
# cutout frame) is what the card mates with. Fixture contact offsets are set here
|
| 199 |
+
# (not just authored in the asset) so the 0.15 mm/side channel grip never fights
|
| 200 |
+
# speculative contacts.
|
| 201 |
+
"case": RigidObjectCfg(
|
| 202 |
+
prim_path="{ENV_REGEX_NS}/Case",
|
| 203 |
+
spawn=sim_utils.UsdFileCfg(
|
| 204 |
+
usd_path=c.case_usd,
|
| 205 |
+
activate_contact_sensors=True,
|
| 206 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 207 |
+
contact_offset=c.case_contact_offset, rest_offset=0.0
|
| 208 |
+
),
|
| 209 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
|
| 210 |
+
),
|
| 211 |
+
init_state=RigidObjectCfg.InitialStateCfg(pos=(wx, wy, c.surface_z + c.case_lift)),
|
| 212 |
+
),
|
| 213 |
+
# Card contact offset must stay well below the channel grip (0.15 mm/side) or
|
| 214 |
+
# speculative contacts choke the fit.
|
| 215 |
+
"card": RigidObjectCfg(
|
| 216 |
+
prim_path="{ENV_REGEX_NS}/Card",
|
| 217 |
+
spawn=sim_utils.UsdFileCfg(
|
| 218 |
+
usd_path=c.card_usd,
|
| 219 |
+
activate_contact_sensors=True,
|
| 220 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 221 |
+
contact_offset=c.card_contact_offset, rest_offset=0.0
|
| 222 |
+
),
|
| 223 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(
|
| 224 |
+
solver_position_iteration_count=192,
|
| 225 |
+
solver_velocity_iteration_count=1,
|
| 226 |
+
max_depenetration_velocity=0.02,
|
| 227 |
+
linear_damping=2.0,
|
| 228 |
+
angular_damping=2.0,
|
| 229 |
+
),
|
| 230 |
+
mass_props=sim_utils.MassPropertiesCfg(mass=c.card_mass),
|
| 231 |
+
),
|
| 232 |
+
init_state=RigidObjectCfg.InitialStateCfg(
|
| 233 |
+
pos=(wx + cx, wy + cy, c.surface_z + c.card_init_z), rot=c.card_init_quat
|
| 234 |
+
),
|
| 235 |
+
),
|
| 236 |
+
}
|
| 237 |
+
if c.card_stand:
|
| 238 |
+
# Foam holder for a gripper env: three STATIC boxes (no rigid body). The floor pad's
|
| 239 |
+
# top is the card spawn height (`card_init_z` = the tab-bottom plane), the two rails
|
| 240 |
+
# flank the body slab's faces at `card_stand_gap` per side. Rail tops stay 35+ mm
|
| 241 |
+
# below the pick grip band, so descending open fingers never meet them.
|
| 242 |
+
y0, y1 = self.CARD_BODY_Y
|
| 243 |
+
mid_y = wy + cy + 0.5 * (y0 + y1) # body-slab mid-plane (the pinch/rail centre)
|
| 244 |
+
half_gap = 0.5 * (y1 - y0) + c.card_stand_gap # rail inner face off the mid-plane
|
| 245 |
+
rail_h, rail_t = 0.055, 0.008
|
| 246 |
+
foam = sim_utils.PreviewSurfaceCfg(diffuse_color=(0.17, 0.17, 0.2), roughness=0.9)
|
| 247 |
+
for name, size, pos in (
|
| 248 |
+
("card_stand_floor", (0.11, 0.09, c.card_init_z),
|
| 249 |
+
(wx + cx, mid_y, c.surface_z + 0.5 * c.card_init_z)),
|
| 250 |
+
("card_stand_rail_pcb", (0.11, rail_t, rail_h),
|
| 251 |
+
(wx + cx, mid_y - half_gap - 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 252 |
+
("card_stand_rail_fan", (0.11, rail_t, rail_h),
|
| 253 |
+
(wx + cx, mid_y + half_gap + 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 254 |
+
):
|
| 255 |
+
assets[name] = AssetBaseCfg(
|
| 256 |
+
prim_path="{ENV_REGEX_NS}/" + "".join(p.capitalize() for p in name.split("_")),
|
| 257 |
+
spawn=sim_utils.CuboidCfg(
|
| 258 |
+
size=size,
|
| 259 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 260 |
+
contact_offset=0.001, rest_offset=0.0
|
| 261 |
+
),
|
| 262 |
+
visual_material=foam,
|
| 263 |
+
),
|
| 264 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=pos),
|
| 265 |
+
)
|
| 266 |
+
# Immutable visual-only set dressing, clear of the arm/task swept volume.
|
| 267 |
+
assets['pilot_parts_box'] = AssetBaseCfg(
|
| 268 |
+
prim_path='{ENV_REGEX_NS}/PilotPartsBox',
|
| 269 |
+
spawn=sim_utils.CuboidCfg(size=(.075, .075, .045),
|
| 270 |
+
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(.08, .35, .65), roughness=.8)),
|
| 271 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(.90, .36, c.surface_z+.0225)))
|
| 272 |
+
return assets
|
| 273 |
+
|
| 274 |
+
def sim_cfg(self) -> SimCfg:
|
| 275 |
+
return SimCfg(
|
| 276 |
+
dt=1.0 / 120.0,
|
| 277 |
+
physx={
|
| 278 |
+
"solver_type": 1,
|
| 279 |
+
"bounce_threshold_velocity": 0.2,
|
| 280 |
+
"friction_offset_threshold": 0.01,
|
| 281 |
+
"friction_correlation_distance": 0.00625,
|
| 282 |
+
"gpu_max_rigid_contact_count": 2**23,
|
| 283 |
+
"gpu_max_rigid_patch_count": 2**23,
|
| 284 |
+
"gpu_collision_stack_size": 2**28,
|
| 285 |
+
"gpu_max_num_partitions": 1,
|
| 286 |
+
},
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# ----- lifecycle ----------------------------------------------------------------------------
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, name: str):
|
| 292 |
+
# Legacy surface: the grasp contract's state used to live directly on the scene
|
| 293 |
+
# (inline machinery era) and existing solutions read it there — forward to the
|
| 294 |
+
# composed contract. `__getattr__` only fires for attributes not found normally.
|
| 295 |
+
if name.startswith("_gw_") and "grasp_weld" in self.__dict__:
|
| 296 |
+
return getattr(self.grasp_weld, name)
|
| 297 |
+
raise AttributeError(name)
|
| 298 |
+
|
| 299 |
+
def bind(self, env: BaseEnv) -> None:
|
| 300 |
+
"""Grab the case + card handles, cache env origins, and set the part frictions."""
|
| 301 |
+
super().bind(env)
|
| 302 |
+
self.case: RigidObject = env.iscene["case"]
|
| 303 |
+
self.card: RigidObject = env.iscene["card"]
|
| 304 |
+
self.env_origins = env.iscene.env_origins
|
| 305 |
+
self._set_friction(self.case, self.cfg.case_friction)
|
| 306 |
+
self._set_friction(self.card, self.cfg.card_friction)
|
| 307 |
+
self.grasp_weld = GraspWeldContract(self) # composed, publishes self.grasp_held
|
| 308 |
+
self.grasp_weld.bind()
|
| 309 |
+
|
| 310 |
+
def grasp_sites(self) -> list:
|
| 311 |
+
"""One grip band: across the body slab (faces at CARD_BODY_Y, 34.8 mm wide), along the
|
| 312 |
+
card's upper length — band centre 15 mm below the shroud's top edge (z 0.1155)."""
|
| 313 |
+
y = 0.5 * (self.CARD_BODY_Y[0] + self.CARD_BODY_Y[1])
|
| 314 |
+
return [("card", self.card, (-0.045, y, 0.1005), (0.045, y, 0.1005), (0.030, 0.039))]
|
| 315 |
+
|
| 316 |
+
def post_step(self, env_ids: torch.Tensor | None = None) -> None:
|
| 317 |
+
"""Reconcile the weld-on-closure grasp contract every physics substep."""
|
| 318 |
+
self.grasp_weld.step()
|
| 319 |
+
|
| 320 |
+
def _set_friction(self, asset, value: float) -> None:
|
| 321 |
+
"""Overwrite the static + dynamic friction on every shape of `asset` (across all envs)."""
|
| 322 |
+
mats = asset.root_physx_view.get_material_properties()
|
| 323 |
+
mats[..., 0:2] = value # [static, dynamic, restitution]
|
| 324 |
+
asset.root_physx_view.set_material_properties(mats, torch.arange(self.env.num_envs, device="cpu"))
|
| 325 |
+
|
| 326 |
+
def reset(self, env_ids: torch.Tensor) -> None:
|
| 327 |
+
"""Fresh, unassembled start: the case pinned at spawn, the card lying backplate-down on
|
| 328 |
+
the table beside it, with xy jitter."""
|
| 329 |
+
c = self.cfg
|
| 330 |
+
dev = self.env.device
|
| 331 |
+
m = len(env_ids)
|
| 332 |
+
origin = self.env_origins[env_ids] # (m, 3)
|
| 333 |
+
wx, wy = c.workbench_pos
|
| 334 |
+
cx, cy = c.card_init_xy
|
| 335 |
+
|
| 336 |
+
st = torch.zeros(m, 13, device=dev)
|
| 337 |
+
st[:, 0:3] = origin + torch.tensor((wx + cx, wy + cy, c.surface_z + c.card_init_z), device=dev)
|
| 338 |
+
st[:, 0:2] += (torch.rand(m, 2, device=dev) * 2 - 1) * c.reset_pos_jitter
|
| 339 |
+
# Small in-holder variation: below rail clearance; no case/slot changes.
|
| 340 |
+
st[:, :2] += (torch.rand(m, 2, device=dev)*2-1) * torch.tensor(
|
| 341 |
+
[c.pilot_jitter_x, c.pilot_jitter_y], device=dev)
|
| 342 |
+
st[:, 3:7] = torch.tensor(c.card_init_quat, device=dev)
|
| 343 |
+
self.card.write_root_state_to_sim(st, env_ids)
|
| 344 |
+
self.grasp_weld.release_all(env_ids)
|
| 345 |
+
|
| 346 |
+
# ----- state (full, restorable) -------------------------------------------------------------
|
| 347 |
+
def get_state(self, env_ids: torch.Tensor) -> dict[str, Any]:
|
| 348 |
+
"""Restorable scene state: world root states (13) of the case and the card, plus the
|
| 349 |
+
grasp-weld holds."""
|
| 350 |
+
return {
|
| 351 |
+
"case": self.case.data.root_state_w[env_ids].clone(),
|
| 352 |
+
"card": self.card.data.root_state_w[env_ids].clone(),
|
| 353 |
+
**self.grasp_weld.state(env_ids),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
def set_state(self, state: dict[str, Any], env_ids: torch.Tensor) -> None:
|
| 357 |
+
"""Restore what `get_state` returned. The card's insertion depth is fully captured by its
|
| 358 |
+
root state, so the channel holds it on restore."""
|
| 359 |
+
self.case.write_root_pose_to_sim(state["case"][:, 0:7], env_ids)
|
| 360 |
+
self.card.write_root_state_to_sim(state["card"], env_ids)
|
| 361 |
+
self.grasp_weld.restore(state, env_ids)
|
| 362 |
+
|
| 363 |
+
# ----- description --------------------------------------------------------------------------
|
| 364 |
+
def describe(self) -> str:
|
| 365 |
+
if self.cfg.card_stand:
|
| 366 |
+
card = (
|
| 367 |
+
"Beside the case a loose graphics card stands upright in a foam holder, already "
|
| 368 |
+
"in its installation orientation.\nGoal: grip the card by its top edge, lift it "
|
| 369 |
+
"straight out of the holder, "
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
card = (
|
| 373 |
+
"Beside the case lies a loose graphics card, backplate down.\nGoal: lift the "
|
| 374 |
+
"card upright (fans toward the case front), "
|
| 375 |
+
)
|
| 376 |
+
return (
|
| 377 |
+
"A gaming-PC case lying on its side on a sturdy table, opening up, its motherboard "
|
| 378 |
+
"facing the ceiling. The board's primary PCIe x16 slot is empty, and the rear I/O "
|
| 379 |
+
f"panel has an open expansion-slot cutout. {card}"
|
| 380 |
+
"lower it into the case with its I/O bracket just forward of the rear panel, slide "
|
| 381 |
+
"it rearward until the bracket and ports pass through the cutout, line its PCB edge "
|
| 382 |
+
"connector up with the x16 slot, and press it straight down until it bottoms out. "
|
| 383 |
+
"A seated card stays put on its own. The task is complete once the card is fully "
|
| 384 |
+
"seated."
|
| 385 |
+
+ " A fixed blue parts box decorates the far corner, outside the task volume."
|
| 386 |
+
+ (
|
| 387 |
+
" The card holds in a firm pinch: close the fingers squarely across its body "
|
| 388 |
+
"slab near the top edge and the grip locks; open wide to release."
|
| 389 |
+
if self.cfg.grasp_weld
|
| 390 |
+
else ""
|
| 391 |
+
)
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# ----- progress (public: seated()/engaged(); reads how far the assembly has got) -------------
|
| 395 |
+
def engaged(self) -> torch.Tensor:
|
| 396 |
+
"""Tab depth below the slot mouth, shape (num_envs,), in metres (negative = still above
|
| 397 |
+
the slot). The card bottoms out on the channel floor at 0.005 depth."""
|
| 398 |
+
rel = self._card_offset_in_case() # (n, 3), zero at the seated pose
|
| 399 |
+
return (self.cfg.slot_mouth_z - self.cfg.seat_pos[2]) - rel[:, 2]
|
| 400 |
+
|
| 401 |
+
def seated(self) -> torch.Tensor:
|
| 402 |
+
"""Whether the card is seated in the slot, shape (num_envs,): pressed down to `seat_depth`
|
| 403 |
+
below the mouth, within `align_xy` of the seated point, and aligned in tilt AND heading."""
|
| 404 |
+
c = self.cfg
|
| 405 |
+
rel = self._card_offset_in_case() # (n, 3)
|
| 406 |
+
depth_ok = self.engaged() >= c.seat_depth
|
| 407 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 408 |
+
up_ok = self._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 409 |
+
yaw_ok = self._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 410 |
+
return depth_ok & xy_ok & up_ok & yaw_ok
|
| 411 |
+
|
| 412 |
+
def success(self) -> torch.Tensor:
|
| 413 |
+
"""(N,) bool: the card seated in its slot — this scene's assembled state
|
| 414 |
+
(scene-level success alias, matching the other suites' surface)."""
|
| 415 |
+
return self.seated()
|
| 416 |
+
|
| 417 |
+
def _card_offset_in_case(self) -> torch.Tensor:
|
| 418 |
+
"""The card origin's offset from the seated point, in the case's local frame, shape
|
| 419 |
+
(num_envs, 3). Zero means the card origin sits exactly at the seated pose."""
|
| 420 |
+
from isaaclab.utils.math import quat_apply_inverse
|
| 421 |
+
|
| 422 |
+
rel = quat_apply_inverse(
|
| 423 |
+
self.case.data.root_quat_w, self.card.data.root_pos_w - self.case.data.root_pos_w
|
| 424 |
+
)
|
| 425 |
+
return rel - torch.tensor(self.cfg.seat_pos, device=rel.device)
|
| 426 |
+
|
| 427 |
+
def _axis_cos(self, axis: int) -> torch.Tensor:
|
| 428 |
+
"""cos of the angle between the card's and the case's local `axis` (0=x: heading along the
|
| 429 |
+
slot, 2=z: insertion axis), shape (num_envs,). Seated orientation = the case's own axes."""
|
| 430 |
+
from isaaclab.utils.math import quat_apply
|
| 431 |
+
|
| 432 |
+
e = torch.zeros(3, device=self.env.device)
|
| 433 |
+
e[axis] = 1.0
|
| 434 |
+
e = e.expand(self.env.num_envs, 3)
|
| 435 |
+
case_ax = quat_apply(self.case.data.root_quat_w, e)
|
| 436 |
+
card_ax = quat_apply(self.card.data.root_quat_w, e)
|
| 437 |
+
return (card_ax * case_ax).sum(dim=-1)
|
| 438 |
+
|
| 439 |
+
# Grasp-weld contract: composed `GraspWeldContract` (robobench.core.grasp_weld),
|
| 440 |
+
# created in `bind()`; this scene supplies the part-side `grasp_sites()`.
|
| 441 |
+
# Grasp-weld contract constants — the scene's public knobs (solutions read these off the
|
| 442 |
+
# scene, e.g. `scene.GRASP_PINCH_OFFSET`); the composed GraspWeldContract consumes them.
|
| 443 |
+
GRASP_HAND_BODY: ClassVar[str] = "panda_hand"
|
| 444 |
+
GRASP_FINGER_JOINTS: ClassVar[str] = "panda_finger_joint.*"
|
| 445 |
+
GRASP_PINCH_OFFSET: ClassVar[float] = 0.1034 # hand origin -> finger-pad centre, along approach
|
| 446 |
+
GRASP_POOL: ClassVar[int] = 8 # engages per (env, site) per run; exhausted -> warn, no weld
|
| 447 |
+
GRASP_STALL: ClassVar[float] = 0.01 # max |finger vel| sum (m/s): fingers stopped ON the part
|
| 448 |
+
GRASP_DEBOUNCE: ClassVar[int] = 8 # consecutive qualifying substeps before the weld engages
|
| 449 |
+
GRASP_RELEASE_MARGIN: ClassVar[float] = 0.008 # release at window-top + this (m), hysteresis
|
| 450 |
+
|
provenance/generation_code/h_s0_3/strategy/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Base state-feedback program; Original central grasp and direct high transfer. DART offered only during high free-space transport. Initially UNTESTED; see pilot_report.json.
|
provenance/generation_code/h_s0_3/strategy/meta.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 2,
|
| 3 |
+
"successes": 2,
|
| 4 |
+
"success_rate": 1.0,
|
| 5 |
+
"batches": [
|
| 6 |
+
"h_s0_1",
|
| 7 |
+
"p01_scene"
|
| 8 |
+
],
|
| 9 |
+
"refreshed": "2026-10-12T11:34:11+00:00"
|
| 10 |
+
}
|
provenance/generation_code/h_s0_3/strategy/parameters.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compensate_action_filter": true,
|
| 3 |
+
"integral_position": 0.8,
|
| 4 |
+
"integral_rotation": 0.5,
|
| 5 |
+
"speed": 0.03,
|
| 6 |
+
"carry_height": 0.26,
|
| 7 |
+
"forward_clearance": -0.045,
|
| 8 |
+
"slide_height": 0.018,
|
| 9 |
+
"press_speed": 0.003
|
| 10 |
+
}
|
provenance/generation_code/h_s0_3/strategy/solve.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# plan: [stages 1-3] card held; card aligned above slot; card seated and released
|
| 2 |
+
# origin=fresh
|
| 3 |
+
"""A state-feedback program for the registered Franka/OSC GPU-install task.
|
| 4 |
+
|
| 5 |
+
Only env.step(action) changes the world. No dataset, checkpoint, reset, state
|
| 6 |
+
restoration, controller replacement, or scene-parameter writes are used.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
DART_SIGMA = 0.03
|
| 14 |
+
SOLVE_PARAMS = {'DART_SIGMA': None}
|
| 15 |
+
ENTRIES = {'start': 'unassembled card upright in holder, hand free',
|
| 16 |
+
'preinsert': 'card genuinely held, above front entry, clear of all contacts'}
|
| 17 |
+
|
| 18 |
+
def solve(env, entry=None, stop_after=None) -> None:
|
| 19 |
+
import torch
|
| 20 |
+
from isaaclab.utils.math import (
|
| 21 |
+
axis_angle_from_quat, quat_apply, quat_conjugate, quat_mul,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
params = json.loads(Path(__file__).with_name('parameters.json').read_text())
|
| 25 |
+
scene, robot = env.scene, env.robot
|
| 26 |
+
art = robot.articulation
|
| 27 |
+
dev, n = env.device, env.num_envs
|
| 28 |
+
assert n == 1, 'This initial phase-1 delivery handles one environment per process'
|
| 29 |
+
osc = robot.controller.controllers[0]
|
| 30 |
+
assert type(osc).__name__ == 'OperationalSpaceController'
|
| 31 |
+
assert robot.action_dim == 8
|
| 32 |
+
hand = art.body_names.index('panda_hand')
|
| 33 |
+
dt = env.dt * robot.control_period
|
| 34 |
+
offset = float(scene.GRASP_PINCH_OFFSET)
|
| 35 |
+
zero = torch.zeros(3, device=dev)
|
| 36 |
+
integral_p, integral_r = zero.clone(), zero.clone()
|
| 37 |
+
steps = 0
|
| 38 |
+
active_phase = 'start'
|
| 39 |
+
if entry not in (None, 'start', 'preinsert'): raise ValueError(entry)
|
| 40 |
+
|
| 41 |
+
def v(values): return torch.tensor(values, device=dev, dtype=torch.float32)
|
| 42 |
+
def mul(a,b): return quat_mul(a[None],b[None])[0]
|
| 43 |
+
def inv(q): return quat_conjugate(q[None])[0]
|
| 44 |
+
def rotate(q,x): return quat_apply(q[None],x[None])[0]
|
| 45 |
+
def orientation_error(goal,current):
|
| 46 |
+
if float(torch.dot(goal,current)) < 0: goal = -goal
|
| 47 |
+
return axis_angle_from_quat(mul(goal, inv(current))[None])[0]
|
| 48 |
+
def hp(): return art.data.body_pos_w[0,hand].clone()
|
| 49 |
+
def hq(): return art.data.body_quat_w[0,hand].clone()
|
| 50 |
+
def cp(): return scene.card.data.root_pos_w[0].clone()
|
| 51 |
+
def cq(): return scene.card.data.root_quat_w[0].clone()
|
| 52 |
+
def held(): return bool(scene.grasp_held[0].any())
|
| 53 |
+
def pinch(): return hp() + rotate(hq(),v([0,0,offset]))
|
| 54 |
+
def band(): return cp()+rotate(cq(),v([0,sum(scene.CARD_BODY_Y)/2,.1005]))
|
| 55 |
+
|
| 56 |
+
def log(phase,**extra):
|
| 57 |
+
print('PHASE1 '+json.dumps(dict(phase=phase,steps=steps,seconds=steps*dt,
|
| 58 |
+
held=held(),card=cp().tolist(),hand=hp().tolist(),
|
| 59 |
+
offset=scene._card_offset_in_case()[0].tolist(),
|
| 60 |
+
depth=float(scene.engaged()[0]),integral_position=integral_p.tolist(),
|
| 61 |
+
integral_rotation=integral_r.tolist(),**extra)),flush=True)
|
| 62 |
+
|
| 63 |
+
def tick(goal,quat,finger):
|
| 64 |
+
nonlocal integral_p, integral_r, steps
|
| 65 |
+
ep, er = goal-hp(), orientation_error(quat,hq())
|
| 66 |
+
integral_p=(integral_p+ep*dt).clamp(-.10,.10)
|
| 67 |
+
integral_r=(integral_r+er*dt).clamp(-4.0,4.0)
|
| 68 |
+
dp=ep+params['integral_position']*integral_p
|
| 69 |
+
dr=er+params['integral_rotation']*integral_r
|
| 70 |
+
dr=dr*min(1,2.5/max(float(dr.norm()),1e-9))
|
| 71 |
+
action=torch.zeros((1,8),device=dev)
|
| 72 |
+
action[0,:3]=(dp/osc.cfg.pos_scale).clamp(-6,6)
|
| 73 |
+
action[0,3:6]=(dr/osc.cfg.rot_scale).clamp(-20,20)
|
| 74 |
+
action[0,6:]=finger
|
| 75 |
+
# The preset smooths pose DELTAS, rather than absolute targets. Account
|
| 76 |
+
# for its documented filter in the command; never write controller state.
|
| 77 |
+
if params.get('compensate_action_filter',False) and osc._prev_action is not None:
|
| 78 |
+
alpha=float(osc.cfg.ema_factor)
|
| 79 |
+
action[0,:6]=(action[0,:6]-(1-alpha)*osc._prev_action[0])/alpha
|
| 80 |
+
assert torch.isfinite(action).all()
|
| 81 |
+
# Noise offered independently of noise_scale. Recorder keeps labels clean.
|
| 82 |
+
disturbance = torch.zeros_like(action)
|
| 83 |
+
if active_phase in ('lift_clear', 'transport_waypoint', 'above_case') and float(hp()[2]) > .38:
|
| 84 |
+
disturbance[0, :3] = DART_SIGMA * torch.randn(3, device=dev)
|
| 85 |
+
env.step(action, noise=disturbance)
|
| 86 |
+
steps+=1
|
| 87 |
+
|
| 88 |
+
def move(goal_fn,grip,timeout,tag,tol=.002,rot_tol=.035,card_check=None):
|
| 89 |
+
nonlocal active_phase
|
| 90 |
+
active_phase = tag
|
| 91 |
+
ref=hp(); good=0
|
| 92 |
+
for _ in range(max(1,math.ceil(timeout/dt))):
|
| 93 |
+
goal,quat=goal_fn()
|
| 94 |
+
delta=goal-ref; length=float(delta.norm())
|
| 95 |
+
ref=ref+delta*min(1,params['speed']*dt/max(length,1e-9))
|
| 96 |
+
tick(ref,quat,grip)
|
| 97 |
+
goal,quat=goal_fn()
|
| 98 |
+
ok=float((hp()-goal).norm())<tol and float(orientation_error(quat,hq()).norm())<rot_tol
|
| 99 |
+
if card_check is not None:ok=ok and card_check()
|
| 100 |
+
good=good+1 if ok else 0
|
| 101 |
+
if good>=8:log(tag,result='reached');return
|
| 102 |
+
log(tag,result='timeout',position_error=float((hp()-goal).norm()),rotation_error=float(orientation_error(quat,hq()).norm()))
|
| 103 |
+
raise RuntimeError('Stage did not reach its measured gate: '+tag)
|
| 104 |
+
|
| 105 |
+
def hold(goal_fn,finger,seconds):
|
| 106 |
+
nonlocal active_phase
|
| 107 |
+
active_phase = 'hold'
|
| 108 |
+
for _ in range(math.ceil(seconds/dt)):
|
| 109 |
+
goal,quat=goal_fn();tick(goal,quat,finger)
|
| 110 |
+
|
| 111 |
+
log('start')
|
| 112 |
+
if entry != 'preinsert':
|
| 113 |
+
# Stage 1: acquire the top band and verify a real grasp.
|
| 114 |
+
down=[mul(cq(),v([0,0,1,0])),mul(cq(),v([0,1,0,0]))]
|
| 115 |
+
pick_q=max(down,key=lambda q:abs(float(torch.dot(q,hq())))).clone()
|
| 116 |
+
def pick_goal(height=0):
|
| 117 |
+
return band()-rotate(pick_q,v([0,0,offset]))+v([0,0,height]),pick_q
|
| 118 |
+
move(lambda:pick_goal(.10),.04,18,'above_card',tol=.004,rot_tol=.05)
|
| 119 |
+
move(pick_goal,.04,16,'pinch_aligned',tol=.0025)
|
| 120 |
+
for k in range(math.ceil(2/dt)):
|
| 121 |
+
goal,quat=pick_goal()
|
| 122 |
+
tick(goal,quat,.04+(.0172-.04)*min(1,(k+1)*dt/1.5))
|
| 123 |
+
hold(pick_goal,.0172,1)
|
| 124 |
+
if not held():log('grasp_failed');raise RuntimeError('No grasp after controlled closure')
|
| 125 |
+
log('card_held')
|
| 126 |
+
elif not held():
|
| 127 |
+
raise RuntimeError('preinsert entry requires an actual grasp')
|
| 128 |
+
rel_p=rotate(inv(hq()),cp()-hp())
|
| 129 |
+
rel_q=mul(inv(hq()),cq())
|
| 130 |
+
def card_goal(position,quat):
|
| 131 |
+
# The grasp joint fixes this measured card-in-hand transform. A fixed
|
| 132 |
+
# world-frame hand goal avoids moving the goal in response to its own lag.
|
| 133 |
+
target_q=mul(quat,inv(rel_q))
|
| 134 |
+
return position-rotate(target_q,rel_p),target_q
|
| 135 |
+
def case_point(local):
|
| 136 |
+
return scene.case.data.root_pos_w[0]+rotate(scene.case.data.root_quat_w[0],v(local))
|
| 137 |
+
case_q=scene.case.data.root_quat_w[0].clone()
|
| 138 |
+
seat=list(scene.cfg.seat_pos)
|
| 139 |
+
forward=seat[0]+params['forward_clearance']
|
| 140 |
+
if entry != 'preinsert':
|
| 141 |
+
lift=cp();lift[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 142 |
+
move(lambda:card_goal(lift,case_q),.0172,25,'lift_clear',tol=.003)
|
| 143 |
+
if not held():raise RuntimeError('Grasp lost during lift')
|
| 144 |
+
|
| 145 |
+
# Stage 2: enter forward of the rear panel, then slide through its cutout.
|
| 146 |
+
high=[forward,seat[1],params['carry_height']-float(scene.cfg.case_lift)]
|
| 147 |
+
move(lambda:card_goal(case_point(high),case_q),.0172,40,'above_case',tol=.003)
|
| 148 |
+
if stop_after == 'above_case': return
|
| 149 |
+
above=[forward,seat[1],float(scene.cfg.slot_mouth_z)+params['slide_height']]
|
| 150 |
+
move(lambda:card_goal(case_point(above),case_q),.0172,20,'inside_case',tol=.002)
|
| 151 |
+
aligned=[seat[0],seat[1],above[2]]
|
| 152 |
+
def card_aligned():
|
| 153 |
+
return float((cp()-case_point(aligned)).norm())<.0007 and float(orientation_error(case_q,cq()).norm())<.004
|
| 154 |
+
move(lambda:card_goal(case_point(aligned),case_q),.0172,30,'slot_aligned',tol=.0004,rot_tol=.003,card_check=card_aligned)
|
| 155 |
+
|
| 156 |
+
# Stage 3: press, release, retract, then leave the installed card unsupported.
|
| 157 |
+
pressed=[seat[0],seat[1],seat[2]-.001]
|
| 158 |
+
active_phase='press'
|
| 159 |
+
press_z=aligned[2]
|
| 160 |
+
for _ in range(math.ceil(25/dt)):
|
| 161 |
+
press_z=max(pressed[2],press_z-params['press_speed']*dt)
|
| 162 |
+
target,quat=card_goal(case_point([seat[0],seat[1],press_z]),case_q)
|
| 163 |
+
tick(target,quat,.0172)
|
| 164 |
+
if bool(scene.seated()[0]):break
|
| 165 |
+
if not bool(scene.seated()[0]):log('press_failed');raise RuntimeError('Card did not seat')
|
| 166 |
+
log('seated_before_release')
|
| 167 |
+
keep=hp(); keep_q=hq()
|
| 168 |
+
hold(lambda:(keep,keep_q),.04,2)
|
| 169 |
+
up=keep+v([0,0,.14])
|
| 170 |
+
move(lambda:(up,keep_q),.04,16,'hand_clear',tol=.004,rot_tol=.06)
|
| 171 |
+
hold(lambda:(up,keep_q),.04,5)
|
| 172 |
+
log('finished',seated=bool(scene.seated()[0]))
|
| 173 |
+
if held() or not bool(scene.seated()[0]):raise RuntimeError('Card did not remain seated after release')
|
provenance/generation_code/p01_scene/grader.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Grader for the pc_gpu scene: the graphics card seated in the PCIe x16 slot.
|
| 2 |
+
|
| 3 |
+
Rubric stages (weights and modes live in RUBRIC):
|
| 4 |
+
grasped the card has been taken in the weld-on-closure grip (`scene.grasp_held`) — the
|
| 5 |
+
scene's own grasp state; a milestone, latched. Also true once the card is
|
| 6 |
+
aligned in the slot (a card in the slot was necessarily carried there), so the
|
| 7 |
+
rung nests under `aligned`. Under an embodiment with no gripper (the weld
|
| 8 |
+
contract disabled, e.g. robot="null") the grasp state does not exist and the
|
| 9 |
+
rung reads from that implication alone
|
| 10 |
+
aligned the card lined up on the slot — origin within `align_xy` of the seated point,
|
| 11 |
+
up axis within `align_axis_deg` of the slot axis, length axis within
|
| 12 |
+
`align_yaw_deg` of the slot heading: the scene's own three non-depth seat gates
|
| 13 |
+
pressed tab depth below the slot mouth (`slot_mouth_z`, the scene's own `engaged()`)
|
| 14 |
+
as a fraction of `seat_depth`, counted only while aligned — so it is 1.0 iff
|
| 15 |
+
the scene calls the card seated
|
| 16 |
+
Every stage is per env. The rungs nest (seated => aligned => grasped), so progress reaches
|
| 17 |
+
1.0 exactly when the card is seated, and for a grader built after the pick as well as one
|
| 18 |
+
that watched it. The rear-panel pass-through is NOT a rung: the cutout's geometry is not in
|
| 19 |
+
the scene cfg, so it cannot be read from state without an invented tolerance. Success is
|
| 20 |
+
the scene's `seated()` per env — depth, xy, tilt AND heading gates — read when the
|
| 21 |
+
delivery finishes.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
|
| 28 |
+
from robobench.core import BaseGrader
|
| 29 |
+
# baked by data_engine init: grade against the LOCAL scene copy (../scene/scene.py),
|
| 30 |
+
# exec'd at most once per process under a fixed module key.
|
| 31 |
+
import importlib.util as _ilu
|
| 32 |
+
import sys as _sys
|
| 33 |
+
from pathlib import Path as _Path
|
| 34 |
+
|
| 35 |
+
if "datagen_local_scene" not in _sys.modules:
|
| 36 |
+
import robobench as _rb
|
| 37 |
+
_rb.discover()
|
| 38 |
+
_p = _Path(__file__).resolve().parent.parent / "scene" / "scene.py"
|
| 39 |
+
_spec = _ilu.spec_from_file_location("datagen_local_scene", _p)
|
| 40 |
+
_m = _ilu.module_from_spec(_spec)
|
| 41 |
+
_sys.modules["datagen_local_scene"] = _m
|
| 42 |
+
_spec.loader.exec_module(_m)
|
| 43 |
+
PcGpuAssemblyScene = _sys.modules["datagen_local_scene"].PcGpuAssemblyScene
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PcGpuAssemblyGrader(BaseGrader):
|
| 47 |
+
"""The card seated in its slot — pressed to depth, centred, upright, heading along the slot.
|
| 48 |
+
|
| 49 |
+
Ladder: grasped 0.33 · aligned 0.67 · pressed 1.00 — three equal rungs for the three
|
| 50 |
+
steps of the task (take the card, line it up on the slot, press it home); the last rung
|
| 51 |
+
is a linear ramp of tab depth from the slot mouth (`slot_mouth_z`) to `seat_depth`.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
SCENE = PcGpuAssemblyScene
|
| 55 |
+
RUBRIC = (("grasped", 1, "once"), ("aligned", 1), ("pressed", 1))
|
| 56 |
+
scene: PcGpuAssemblyScene
|
| 57 |
+
|
| 58 |
+
def setup(self) -> None:
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# `grasp_held` exists only while the weld contract is live (a gripper on the stage).
|
| 62 |
+
self._has_grasp = hasattr(self.scene, "grasp_held")
|
| 63 |
+
self._grasped = torch.zeros(self.num_envs, dtype=torch.bool,
|
| 64 |
+
device=self.scene.engaged().device) # latch: card ever held
|
| 65 |
+
|
| 66 |
+
def check_success(self):
|
| 67 |
+
return self.scene.seated() # (num_envs,)
|
| 68 |
+
|
| 69 |
+
def _aligned(self):
|
| 70 |
+
"""(num_envs,) bool: the scene's xy + tilt + heading seat gates, without depth."""
|
| 71 |
+
c = self.scene.cfg
|
| 72 |
+
rel = self.scene._card_offset_in_case() # (n, 3), zero at the seated pose — privileged
|
| 73 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 74 |
+
up_ok = self.scene._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 75 |
+
yaw_ok = self.scene._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 76 |
+
return xy_ok & up_ok & yaw_ok
|
| 77 |
+
|
| 78 |
+
# ---- rubric stages — each returns a (num_envs,) value in [0, 1] ---------------------
|
| 79 |
+
def grasped(self):
|
| 80 |
+
if self._has_grasp:
|
| 81 |
+
self._grasped |= self.scene.grasp_held.any(dim=1)
|
| 82 |
+
return (self._grasped | self._aligned()).float()
|
| 83 |
+
|
| 84 |
+
def aligned(self):
|
| 85 |
+
return self._aligned().float()
|
| 86 |
+
|
| 87 |
+
def pressed(self):
|
| 88 |
+
depth = self.scene.engaged() # (n,) tab depth below the slot mouth (m)
|
| 89 |
+
return self._aligned() * (depth / self.scene.cfg.seat_depth).clamp(0.0, 1.0)
|
provenance/generation_code/p01_scene/scene.py
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PcGpuAssemblyScene — insert a graphics card into the PC's PCIe slot.
|
| 2 |
+
|
| 3 |
+
The same gaming-PC case as `pc_motherboard` lies on its side on the table, opening up, motherboard
|
| 4 |
+
facing the ceiling — but here the board's PCIe area is the work site. Beside the case lies a loose
|
| 5 |
+
RTX 2060 (extracted from the PC model as its own rigid body, backplate down). Goal (carried here,
|
| 6 |
+
no task layer): stand the card upright over the primary x16 slot, line its PCB edge up with the
|
| 7 |
+
slot, and press it straight down until it seats.
|
| 8 |
+
|
| 9 |
+
The case is one kinematic body that never moves — the PC model stays visual-only; its physics is
|
| 10 |
+
an invisible fixture inside the case body: a channel whose walls grip the card's 4 mm PCB tab at
|
| 11 |
+
0.15 mm/side (flaring to a 1.2 mm/side funnel mouth — idealizing the real slot's spring
|
| 12 |
+
contacts, and capping the unscrewed card's gravity roll at ~2 deg), a floor whose top is the
|
| 13 |
+
model's own seated tab height, end stops (~1.6 mm play), a flush board plate so a dropped card
|
| 14 |
+
rests on the board face, and a REAR I/O PANEL frame around the expansion-slot cutout — so the
|
| 15 |
+
card must be placed inside the case, slid rearward until its bracket/ports pass through the
|
| 16 |
+
opening, and only then pressed down (a straight vertical drop is physically blocked by the
|
| 17 |
+
panel above the cutout, exactly like a real build). The card's origin is its
|
| 18 |
+
PCB-tab bottom CENTRE with axes equal to the case's, so the seated pose is just `seat_pos` +
|
| 19 |
+
identity orientation in the case frame, and insertion depth is a z difference.
|
| 20 |
+
|
| 21 |
+
Heavy imports (isaaclab, pxr) are deferred so importing this module stays app-free.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
from robobench.core.assets import asset_path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, ClassVar
|
| 31 |
+
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
from robobench.core import GraspWeldContract, SCENES, BaseCfg, BaseScene, SimCfg
|
| 35 |
+
|
| 36 |
+
if TYPE_CHECKING:
|
| 37 |
+
from isaaclab.assets import RigidObject
|
| 38 |
+
|
| 39 |
+
from robobench.core import BaseEnv
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class PcGpuAssemblySceneCfg(BaseCfg):
|
| 44 |
+
"""Config for `PcGpuAssemblyScene`. Nothing is locked — a variant is just a copy with a few
|
| 45 |
+
fields changed."""
|
| 46 |
+
|
| 47 |
+
# --- the curriculum / difficulty dials -----------------------------------------------
|
| 48 |
+
# The card is "seated" when — in the case's frame — its tab is >= `seat_depth` below the slot
|
| 49 |
+
# mouth, its origin is within `align_xy` of the seated point, and its axes are within
|
| 50 |
+
# `align_axis_deg` (tilt) / `align_yaw_deg` (heading along the slot) of the case's. The full
|
| 51 |
+
# stroke from the slot mouth to the channel floor is 5 mm, so 4 mm separates "seated" from
|
| 52 |
+
# "merely resting in the mouth".
|
| 53 |
+
seat_depth: float = 0.004 # min tab depth below the slot mouth (m) to count as seated
|
| 54 |
+
align_xy: float = 0.003 # max distance (m) of the card origin from the seated point
|
| 55 |
+
align_axis_deg: float = 3.0 # max tilt of the card's up axis off the slot axis (deg)
|
| 56 |
+
align_yaw_deg: float = 3.0 # max heading error of the card's length axis (deg)
|
| 57 |
+
reset_pos_jitter: float = 0.01 # uniform +/- xy jitter for the loose card at reset (m)
|
| 58 |
+
# Part friction (static = dynamic), set on every shape at bind. The moving card runs moderately
|
| 59 |
+
# slick against a grippier fixed case, so it slides down the channel but holds seat.
|
| 60 |
+
card_friction: float = 0.3
|
| 61 |
+
case_friction: float = 0.75
|
| 62 |
+
# Weld-on-closure grasping (the benchmark's auto-weld contract, PhysX
|
| 63 |
+
# form — the grasp-weld machinery at the end of this scene class):
|
| 64 |
+
# close the fingers squarely across the card's body slab near its top edge and the card welds
|
| 65 |
+
# to the hand; open wide to release. Gripper envs only (no-op under robot="null").
|
| 66 |
+
grasp_weld: bool = True
|
| 67 |
+
grasp_weld_dist: float = 0.010 # pinch-point-to-grip-band engage radius (m)
|
| 68 |
+
|
| 69 |
+
pilot_jitter_x: float = 0.004
|
| 70 |
+
pilot_jitter_y: float = 0.0007
|
| 71 |
+
|
| 72 |
+
# --- structure, reset layout, masses, asset paths (fixed) -------------------------------
|
| 73 |
+
# Seated card origin (its PCB-tab bottom centre) in the case's local frame; orientation seated
|
| 74 |
+
# = the case's own axes (identity). Baked into the committed USDs (keep in sync if they change).
|
| 75 |
+
seat_pos: tuple[float, float, float] = (-0.01595, 0.0293, 0.0035)
|
| 76 |
+
slot_mouth_z: float = 0.0085 # slot top in the case frame: depth datum (5 mm at full seat)
|
| 77 |
+
board_top: float = 0.0 # board face height in the case frame (the asset's own origin)
|
| 78 |
+
case_lift: float = 0.0289 # board face above the side panel the case lies on
|
| 79 |
+
card_mass: float = 1.0 # dual-fan RTX 2060 (kg)
|
| 80 |
+
light_intensity: float = 2500.0
|
| 81 |
+
# Loose card start pose: lying backplate-down on the table beside the case (+x side; the case
|
| 82 |
+
# spans x < 0.13 and the lying card's tail reaches origin_x - 0.132).
|
| 83 |
+
card_init_xy: tuple[float, float] = (0.28, 0.0) # card start xy (table-rel.)
|
| 84 |
+
card_init_z: float = 0.0022 # origin height lying backplate-down (backplate plane -2 mm)
|
| 85 |
+
card_init_quat: tuple[float, float, float, float] = (0.70711, 0.70711, 0.0, 0.0) # flat
|
| 86 |
+
card_contact_offset: float = 0.0001 # well below the 0.15 mm/side channel grip
|
| 87 |
+
case_contact_offset: float = 0.0001 # ditto for the slot fixture's walls
|
| 88 |
+
# Optional foam holder (a floor pad + two rails flanking the card's 36 mm body slab) that
|
| 89 |
+
# presents the card UPRIGHT for a parallel-jaw grasp. The lying default is ungraspable by a
|
| 90 |
+
# Franka gripper: flat on its backplate the card's only sub-80 mm dimension (the 36 mm body
|
| 91 |
+
# thickness) points UP, so no top-down or side pinch can straddle it. Enable together with an
|
| 92 |
+
# upright `card_init_quat` (identity = the seated orientation) and `card_init_z` = the
|
| 93 |
+
# holder's floor top; the rails cap the free card's lean at ~3 deg and the pick pulls
|
| 94 |
+
# straight up out of them.
|
| 95 |
+
card_stand: bool = False
|
| 96 |
+
card_stand_gap: float = 0.0025 # rail clearance per side around the body slab (m)
|
| 97 |
+
# Selectable work surface (same presets as the sibling scenes).
|
| 98 |
+
table: str = "lab_table" # which work surface: "lab_table" | "packing"
|
| 99 |
+
surface_z: float | None = None # table-top height (m); None -> the preset's
|
| 100 |
+
workbench_pos: tuple[float, float] | None = None # xy the table sits at; None -> preset
|
| 101 |
+
workbench_usd: str = "" # empty -> the preset's vendored USD
|
| 102 |
+
TABLES: ClassVar[dict[str, dict[str, Any]]] = {
|
| 103 |
+
"lab_table": {"usd": ("lab_table", "table_instanceable.usd"), "scale": 1.0,
|
| 104 |
+
"orient": (0.70711, 0.0, 0.0, 0.70711), "surface_z": 0.0, "pos": (0.5, 0.0),
|
| 105 |
+
"top_offset": 0.0, "height": 1.05, "kinematic": False},
|
| 106 |
+
"packing": {"usd": ("packing_table", "SM_HeavyDutyPackingTable_C02_01_physics.usd"), "scale": 0.01,
|
| 107 |
+
"orient": (1.0, 0.0, 0.0, 0.0), "surface_z": 0.994, "pos": (0.0, 0.0),
|
| 108 |
+
"top_offset": 0.994, "height": 0.994, "kinematic": True},
|
| 109 |
+
}
|
| 110 |
+
# Asset USDs; empty -> the prebuilt assets committed under `assets/`.
|
| 111 |
+
asset_dir: str = ""
|
| 112 |
+
case_usd: str = ""
|
| 113 |
+
card_usd: str = ""
|
| 114 |
+
|
| 115 |
+
def __post_init__(self) -> None:
|
| 116 |
+
assets = asset_path(Path(__file__).resolve().parents[1] / "assets")
|
| 117 |
+
self.asset_dir = self.asset_dir or str(assets)
|
| 118 |
+
self.case_usd = self.case_usd or str(Path(self.asset_dir) / "pc" / "pc_case_gpu_assembly_mb.usd")
|
| 119 |
+
self.card_usd = self.card_usd or str(Path(self.asset_dir) / "pc" / "gpu_rtx2060.usd")
|
| 120 |
+
preset = self.TABLES[self.table]
|
| 121 |
+
if self.surface_z is None:
|
| 122 |
+
self.surface_z = preset["surface_z"]
|
| 123 |
+
if self.workbench_pos is None:
|
| 124 |
+
self.workbench_pos = preset["pos"]
|
| 125 |
+
self.workbench_usd = self.workbench_usd or str(assets / "props" / preset["usd"][0] / preset["usd"][1])
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@SCENES.register("pc_gpu_local")
|
| 129 |
+
class PcGpuAssemblyScene(BaseScene):
|
| 130 |
+
cfg: PcGpuAssemblySceneCfg
|
| 131 |
+
|
| 132 |
+
# Object physics remains nominal in this pilot; L4 uses the recorded noise channel.
|
| 133 |
+
PHYSICAL_PARAMS = {'card_mass': None, 'card_friction': None, 'case_friction': None}
|
| 134 |
+
VISUAL_PARAMS = {'light_intensity': {'dist': 'choice', 'options': [1600., 2500., 3400.]}}
|
| 135 |
+
CAMERAS = {'front': {'eye': (-.1, -1.06, 1.282), 'target': (.42, -.08, .06),
|
| 136 |
+
'focal': 16., 'bands': {
|
| 137 |
+
'eye_x': {'dist': 'uniform', 'lo': -.125, 'hi': -.075},
|
| 138 |
+
'eye_y': {'dist': 'uniform', 'lo': -1.085, 'hi': -1.035},
|
| 139 |
+
'target_x': {'dist': 'uniform', 'lo': .405, 'hi': .435}}}}
|
| 140 |
+
|
| 141 |
+
def apply_visual_params(self, env, values):
|
| 142 |
+
# Render-only light; never touches geometry, contact, or robot control.
|
| 143 |
+
from pxr import UsdLux
|
| 144 |
+
if 'light_intensity' in values:
|
| 145 |
+
prim = env.sim.stage.GetPrimAtPath('/World/light')
|
| 146 |
+
UsdLux.LightAPI(prim).GetIntensityAttr().Set(float(values['light_intensity']))
|
| 147 |
+
|
| 148 |
+
# Card-local y extent of the body collision slab (from gpu_rtx2060.usd `/gpu/collision/body`:
|
| 149 |
+
# backplate plane -2 mm, fan-shroud plane +32.8 mm around the PCB-tab-centre origin — the
|
| 150 |
+
# collider is trimmed to the VISUAL shell). The stand's rails flank THESE faces — the same
|
| 151 |
+
# pair a parallel-jaw grasp pinches.
|
| 152 |
+
CARD_BODY_Y: ClassVar[tuple[float, float]] = (-0.002, 0.0328)
|
| 153 |
+
|
| 154 |
+
def __init__(self, cfg: PcGpuAssemblySceneCfg | None = None) -> None:
|
| 155 |
+
super().__init__(cfg or PcGpuAssemblySceneCfg())
|
| 156 |
+
|
| 157 |
+
# ----- assets -------------------------------------------------------------------------------
|
| 158 |
+
def assets(self) -> dict[str, Any]:
|
| 159 |
+
"""Floor, dome light, table, the PC case lying on it (kinematic, with the invisible slot
|
| 160 |
+
fixture), and one loose graphics card. The card loads with the high solver-iteration count
|
| 161 |
+
the snug channel needs."""
|
| 162 |
+
import isaaclab.sim as sim_utils
|
| 163 |
+
from isaaclab.assets import AssetBaseCfg, RigidObjectCfg
|
| 164 |
+
|
| 165 |
+
c = self.cfg
|
| 166 |
+
for usd in (c.case_usd, c.card_usd):
|
| 167 |
+
if not Path(usd).is_file():
|
| 168 |
+
raise FileNotFoundError(
|
| 169 |
+
f"{usd} not found — the pc-gpu assets ship with the repo under "
|
| 170 |
+
f"`suites/assembly/assets/`"
|
| 171 |
+
)
|
| 172 |
+
preset = c.TABLES[c.table]
|
| 173 |
+
wx, wy = c.workbench_pos
|
| 174 |
+
table_z = c.surface_z - preset["top_offset"]
|
| 175 |
+
ground_z = c.surface_z - preset["height"]
|
| 176 |
+
table_spawn = sim_utils.UsdFileCfg(usd_path=c.workbench_usd, scale=(preset["scale"],) * 3)
|
| 177 |
+
if preset["kinematic"]:
|
| 178 |
+
table_spawn.rigid_props = sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True)
|
| 179 |
+
|
| 180 |
+
cx, cy = c.card_init_xy
|
| 181 |
+
assets: dict[str, Any] = {
|
| 182 |
+
"ground": AssetBaseCfg(
|
| 183 |
+
prim_path="/World/ground",
|
| 184 |
+
spawn=sim_utils.GroundPlaneCfg(usd_path=str(
|
| 185 |
+
asset_path(Path(__file__).resolve().parents[1] / "assets") / "props" / "ground" / "default_ground.usd")),
|
| 186 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, ground_z)),
|
| 187 |
+
),
|
| 188 |
+
"light": AssetBaseCfg(
|
| 189 |
+
prim_path="/World/light",
|
| 190 |
+
spawn=sim_utils.DomeLightCfg(intensity=c.light_intensity, color=(0.9, 0.9, 0.9)),
|
| 191 |
+
),
|
| 192 |
+
"workbench": AssetBaseCfg(
|
| 193 |
+
prim_path="{ENV_REGEX_NS}/Table",
|
| 194 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(wx, wy, table_z), rot=preset["orient"]),
|
| 195 |
+
spawn=table_spawn,
|
| 196 |
+
),
|
| 197 |
+
# The case: kinematic; the invisible fixture inside it (slot channel + rear-panel
|
| 198 |
+
# cutout frame) is what the card mates with. Fixture contact offsets are set here
|
| 199 |
+
# (not just authored in the asset) so the 0.15 mm/side channel grip never fights
|
| 200 |
+
# speculative contacts.
|
| 201 |
+
"case": RigidObjectCfg(
|
| 202 |
+
prim_path="{ENV_REGEX_NS}/Case",
|
| 203 |
+
spawn=sim_utils.UsdFileCfg(
|
| 204 |
+
usd_path=c.case_usd,
|
| 205 |
+
activate_contact_sensors=True,
|
| 206 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 207 |
+
contact_offset=c.case_contact_offset, rest_offset=0.0
|
| 208 |
+
),
|
| 209 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
|
| 210 |
+
),
|
| 211 |
+
init_state=RigidObjectCfg.InitialStateCfg(pos=(wx, wy, c.surface_z + c.case_lift)),
|
| 212 |
+
),
|
| 213 |
+
# Card contact offset must stay well below the channel grip (0.15 mm/side) or
|
| 214 |
+
# speculative contacts choke the fit.
|
| 215 |
+
"card": RigidObjectCfg(
|
| 216 |
+
prim_path="{ENV_REGEX_NS}/Card",
|
| 217 |
+
spawn=sim_utils.UsdFileCfg(
|
| 218 |
+
usd_path=c.card_usd,
|
| 219 |
+
activate_contact_sensors=True,
|
| 220 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 221 |
+
contact_offset=c.card_contact_offset, rest_offset=0.0
|
| 222 |
+
),
|
| 223 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(
|
| 224 |
+
solver_position_iteration_count=192,
|
| 225 |
+
solver_velocity_iteration_count=1,
|
| 226 |
+
max_depenetration_velocity=0.02,
|
| 227 |
+
linear_damping=2.0,
|
| 228 |
+
angular_damping=2.0,
|
| 229 |
+
),
|
| 230 |
+
mass_props=sim_utils.MassPropertiesCfg(mass=c.card_mass),
|
| 231 |
+
),
|
| 232 |
+
init_state=RigidObjectCfg.InitialStateCfg(
|
| 233 |
+
pos=(wx + cx, wy + cy, c.surface_z + c.card_init_z), rot=c.card_init_quat
|
| 234 |
+
),
|
| 235 |
+
),
|
| 236 |
+
}
|
| 237 |
+
if c.card_stand:
|
| 238 |
+
# Foam holder for a gripper env: three STATIC boxes (no rigid body). The floor pad's
|
| 239 |
+
# top is the card spawn height (`card_init_z` = the tab-bottom plane), the two rails
|
| 240 |
+
# flank the body slab's faces at `card_stand_gap` per side. Rail tops stay 35+ mm
|
| 241 |
+
# below the pick grip band, so descending open fingers never meet them.
|
| 242 |
+
y0, y1 = self.CARD_BODY_Y
|
| 243 |
+
mid_y = wy + cy + 0.5 * (y0 + y1) # body-slab mid-plane (the pinch/rail centre)
|
| 244 |
+
half_gap = 0.5 * (y1 - y0) + c.card_stand_gap # rail inner face off the mid-plane
|
| 245 |
+
rail_h, rail_t = 0.055, 0.008
|
| 246 |
+
foam = sim_utils.PreviewSurfaceCfg(diffuse_color=(0.17, 0.17, 0.2), roughness=0.9)
|
| 247 |
+
for name, size, pos in (
|
| 248 |
+
("card_stand_floor", (0.11, 0.09, c.card_init_z),
|
| 249 |
+
(wx + cx, mid_y, c.surface_z + 0.5 * c.card_init_z)),
|
| 250 |
+
("card_stand_rail_pcb", (0.11, rail_t, rail_h),
|
| 251 |
+
(wx + cx, mid_y - half_gap - 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 252 |
+
("card_stand_rail_fan", (0.11, rail_t, rail_h),
|
| 253 |
+
(wx + cx, mid_y + half_gap + 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 254 |
+
):
|
| 255 |
+
assets[name] = AssetBaseCfg(
|
| 256 |
+
prim_path="{ENV_REGEX_NS}/" + "".join(p.capitalize() for p in name.split("_")),
|
| 257 |
+
spawn=sim_utils.CuboidCfg(
|
| 258 |
+
size=size,
|
| 259 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 260 |
+
contact_offset=0.001, rest_offset=0.0
|
| 261 |
+
),
|
| 262 |
+
visual_material=foam,
|
| 263 |
+
),
|
| 264 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=pos),
|
| 265 |
+
)
|
| 266 |
+
# Immutable visual-only set dressing, clear of the arm/task swept volume.
|
| 267 |
+
assets['pilot_parts_box'] = AssetBaseCfg(
|
| 268 |
+
prim_path='{ENV_REGEX_NS}/PilotPartsBox',
|
| 269 |
+
spawn=sim_utils.CuboidCfg(size=(.075, .075, .045),
|
| 270 |
+
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(.08, .35, .65), roughness=.8)),
|
| 271 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(.90, .36, c.surface_z+.0225)))
|
| 272 |
+
return assets
|
| 273 |
+
|
| 274 |
+
def sim_cfg(self) -> SimCfg:
|
| 275 |
+
return SimCfg(
|
| 276 |
+
dt=1.0 / 120.0,
|
| 277 |
+
physx={
|
| 278 |
+
"solver_type": 1,
|
| 279 |
+
"bounce_threshold_velocity": 0.2,
|
| 280 |
+
"friction_offset_threshold": 0.01,
|
| 281 |
+
"friction_correlation_distance": 0.00625,
|
| 282 |
+
"gpu_max_rigid_contact_count": 2**23,
|
| 283 |
+
"gpu_max_rigid_patch_count": 2**23,
|
| 284 |
+
"gpu_collision_stack_size": 2**28,
|
| 285 |
+
"gpu_max_num_partitions": 1,
|
| 286 |
+
},
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# ----- lifecycle ----------------------------------------------------------------------------
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, name: str):
|
| 292 |
+
# Legacy surface: the grasp contract's state used to live directly on the scene
|
| 293 |
+
# (inline machinery era) and existing solutions read it there — forward to the
|
| 294 |
+
# composed contract. `__getattr__` only fires for attributes not found normally.
|
| 295 |
+
if name.startswith("_gw_") and "grasp_weld" in self.__dict__:
|
| 296 |
+
return getattr(self.grasp_weld, name)
|
| 297 |
+
raise AttributeError(name)
|
| 298 |
+
|
| 299 |
+
def bind(self, env: BaseEnv) -> None:
|
| 300 |
+
"""Grab the case + card handles, cache env origins, and set the part frictions."""
|
| 301 |
+
super().bind(env)
|
| 302 |
+
self.case: RigidObject = env.iscene["case"]
|
| 303 |
+
self.card: RigidObject = env.iscene["card"]
|
| 304 |
+
self.env_origins = env.iscene.env_origins
|
| 305 |
+
self._set_friction(self.case, self.cfg.case_friction)
|
| 306 |
+
self._set_friction(self.card, self.cfg.card_friction)
|
| 307 |
+
self.grasp_weld = GraspWeldContract(self) # composed, publishes self.grasp_held
|
| 308 |
+
self.grasp_weld.bind()
|
| 309 |
+
|
| 310 |
+
def grasp_sites(self) -> list:
|
| 311 |
+
"""One grip band: across the body slab (faces at CARD_BODY_Y, 34.8 mm wide), along the
|
| 312 |
+
card's upper length — band centre 15 mm below the shroud's top edge (z 0.1155)."""
|
| 313 |
+
y = 0.5 * (self.CARD_BODY_Y[0] + self.CARD_BODY_Y[1])
|
| 314 |
+
return [("card", self.card, (-0.045, y, 0.1005), (0.045, y, 0.1005), (0.030, 0.039))]
|
| 315 |
+
|
| 316 |
+
def post_step(self, env_ids: torch.Tensor | None = None) -> None:
|
| 317 |
+
"""Reconcile the weld-on-closure grasp contract every physics substep."""
|
| 318 |
+
self.grasp_weld.step()
|
| 319 |
+
|
| 320 |
+
def _set_friction(self, asset, value: float) -> None:
|
| 321 |
+
"""Overwrite the static + dynamic friction on every shape of `asset` (across all envs)."""
|
| 322 |
+
mats = asset.root_physx_view.get_material_properties()
|
| 323 |
+
mats[..., 0:2] = value # [static, dynamic, restitution]
|
| 324 |
+
asset.root_physx_view.set_material_properties(mats, torch.arange(self.env.num_envs, device="cpu"))
|
| 325 |
+
|
| 326 |
+
def reset(self, env_ids: torch.Tensor) -> None:
|
| 327 |
+
"""Fresh, unassembled start: the case pinned at spawn, the card lying backplate-down on
|
| 328 |
+
the table beside it, with xy jitter."""
|
| 329 |
+
c = self.cfg
|
| 330 |
+
dev = self.env.device
|
| 331 |
+
m = len(env_ids)
|
| 332 |
+
origin = self.env_origins[env_ids] # (m, 3)
|
| 333 |
+
wx, wy = c.workbench_pos
|
| 334 |
+
cx, cy = c.card_init_xy
|
| 335 |
+
|
| 336 |
+
st = torch.zeros(m, 13, device=dev)
|
| 337 |
+
st[:, 0:3] = origin + torch.tensor((wx + cx, wy + cy, c.surface_z + c.card_init_z), device=dev)
|
| 338 |
+
st[:, 0:2] += (torch.rand(m, 2, device=dev) * 2 - 1) * c.reset_pos_jitter
|
| 339 |
+
# Small in-holder variation: below rail clearance; no case/slot changes.
|
| 340 |
+
st[:, :2] += (torch.rand(m, 2, device=dev)*2-1) * torch.tensor(
|
| 341 |
+
[c.pilot_jitter_x, c.pilot_jitter_y], device=dev)
|
| 342 |
+
st[:, 3:7] = torch.tensor(c.card_init_quat, device=dev)
|
| 343 |
+
self.card.write_root_state_to_sim(st, env_ids)
|
| 344 |
+
self.grasp_weld.release_all(env_ids)
|
| 345 |
+
|
| 346 |
+
# ----- state (full, restorable) -------------------------------------------------------------
|
| 347 |
+
def get_state(self, env_ids: torch.Tensor) -> dict[str, Any]:
|
| 348 |
+
"""Restorable scene state: world root states (13) of the case and the card, plus the
|
| 349 |
+
grasp-weld holds."""
|
| 350 |
+
return {
|
| 351 |
+
"case": self.case.data.root_state_w[env_ids].clone(),
|
| 352 |
+
"card": self.card.data.root_state_w[env_ids].clone(),
|
| 353 |
+
**self.grasp_weld.state(env_ids),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
def set_state(self, state: dict[str, Any], env_ids: torch.Tensor) -> None:
|
| 357 |
+
"""Restore what `get_state` returned. The card's insertion depth is fully captured by its
|
| 358 |
+
root state, so the channel holds it on restore."""
|
| 359 |
+
self.case.write_root_pose_to_sim(state["case"][:, 0:7], env_ids)
|
| 360 |
+
self.card.write_root_state_to_sim(state["card"], env_ids)
|
| 361 |
+
self.grasp_weld.restore(state, env_ids)
|
| 362 |
+
|
| 363 |
+
# ----- description --------------------------------------------------------------------------
|
| 364 |
+
def describe(self) -> str:
|
| 365 |
+
if self.cfg.card_stand:
|
| 366 |
+
card = (
|
| 367 |
+
"Beside the case a loose graphics card stands upright in a foam holder, already "
|
| 368 |
+
"in its installation orientation.\nGoal: grip the card by its top edge, lift it "
|
| 369 |
+
"straight out of the holder, "
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
card = (
|
| 373 |
+
"Beside the case lies a loose graphics card, backplate down.\nGoal: lift the "
|
| 374 |
+
"card upright (fans toward the case front), "
|
| 375 |
+
)
|
| 376 |
+
return (
|
| 377 |
+
"A gaming-PC case lying on its side on a sturdy table, opening up, its motherboard "
|
| 378 |
+
"facing the ceiling. The board's primary PCIe x16 slot is empty, and the rear I/O "
|
| 379 |
+
f"panel has an open expansion-slot cutout. {card}"
|
| 380 |
+
"lower it into the case with its I/O bracket just forward of the rear panel, slide "
|
| 381 |
+
"it rearward until the bracket and ports pass through the cutout, line its PCB edge "
|
| 382 |
+
"connector up with the x16 slot, and press it straight down until it bottoms out. "
|
| 383 |
+
"A seated card stays put on its own. The task is complete once the card is fully "
|
| 384 |
+
"seated."
|
| 385 |
+
+ " A fixed blue parts box decorates the far corner, outside the task volume."
|
| 386 |
+
+ (
|
| 387 |
+
" The card holds in a firm pinch: close the fingers squarely across its body "
|
| 388 |
+
"slab near the top edge and the grip locks; open wide to release."
|
| 389 |
+
if self.cfg.grasp_weld
|
| 390 |
+
else ""
|
| 391 |
+
)
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# ----- progress (public: seated()/engaged(); reads how far the assembly has got) -------------
|
| 395 |
+
def engaged(self) -> torch.Tensor:
|
| 396 |
+
"""Tab depth below the slot mouth, shape (num_envs,), in metres (negative = still above
|
| 397 |
+
the slot). The card bottoms out on the channel floor at 0.005 depth."""
|
| 398 |
+
rel = self._card_offset_in_case() # (n, 3), zero at the seated pose
|
| 399 |
+
return (self.cfg.slot_mouth_z - self.cfg.seat_pos[2]) - rel[:, 2]
|
| 400 |
+
|
| 401 |
+
def seated(self) -> torch.Tensor:
|
| 402 |
+
"""Whether the card is seated in the slot, shape (num_envs,): pressed down to `seat_depth`
|
| 403 |
+
below the mouth, within `align_xy` of the seated point, and aligned in tilt AND heading."""
|
| 404 |
+
c = self.cfg
|
| 405 |
+
rel = self._card_offset_in_case() # (n, 3)
|
| 406 |
+
depth_ok = self.engaged() >= c.seat_depth
|
| 407 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 408 |
+
up_ok = self._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 409 |
+
yaw_ok = self._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 410 |
+
return depth_ok & xy_ok & up_ok & yaw_ok
|
| 411 |
+
|
| 412 |
+
def success(self) -> torch.Tensor:
|
| 413 |
+
"""(N,) bool: the card seated in its slot — this scene's assembled state
|
| 414 |
+
(scene-level success alias, matching the other suites' surface)."""
|
| 415 |
+
return self.seated()
|
| 416 |
+
|
| 417 |
+
def _card_offset_in_case(self) -> torch.Tensor:
|
| 418 |
+
"""The card origin's offset from the seated point, in the case's local frame, shape
|
| 419 |
+
(num_envs, 3). Zero means the card origin sits exactly at the seated pose."""
|
| 420 |
+
from isaaclab.utils.math import quat_apply_inverse
|
| 421 |
+
|
| 422 |
+
rel = quat_apply_inverse(
|
| 423 |
+
self.case.data.root_quat_w, self.card.data.root_pos_w - self.case.data.root_pos_w
|
| 424 |
+
)
|
| 425 |
+
return rel - torch.tensor(self.cfg.seat_pos, device=rel.device)
|
| 426 |
+
|
| 427 |
+
def _axis_cos(self, axis: int) -> torch.Tensor:
|
| 428 |
+
"""cos of the angle between the card's and the case's local `axis` (0=x: heading along the
|
| 429 |
+
slot, 2=z: insertion axis), shape (num_envs,). Seated orientation = the case's own axes."""
|
| 430 |
+
from isaaclab.utils.math import quat_apply
|
| 431 |
+
|
| 432 |
+
e = torch.zeros(3, device=self.env.device)
|
| 433 |
+
e[axis] = 1.0
|
| 434 |
+
e = e.expand(self.env.num_envs, 3)
|
| 435 |
+
case_ax = quat_apply(self.case.data.root_quat_w, e)
|
| 436 |
+
card_ax = quat_apply(self.card.data.root_quat_w, e)
|
| 437 |
+
return (card_ax * case_ax).sum(dim=-1)
|
| 438 |
+
|
| 439 |
+
# Grasp-weld contract: composed `GraspWeldContract` (robobench.core.grasp_weld),
|
| 440 |
+
# created in `bind()`; this scene supplies the part-side `grasp_sites()`.
|
| 441 |
+
# Grasp-weld contract constants — the scene's public knobs (solutions read these off the
|
| 442 |
+
# scene, e.g. `scene.GRASP_PINCH_OFFSET`); the composed GraspWeldContract consumes them.
|
| 443 |
+
GRASP_HAND_BODY: ClassVar[str] = "panda_hand"
|
| 444 |
+
GRASP_FINGER_JOINTS: ClassVar[str] = "panda_finger_joint.*"
|
| 445 |
+
GRASP_PINCH_OFFSET: ClassVar[float] = 0.1034 # hand origin -> finger-pad centre, along approach
|
| 446 |
+
GRASP_POOL: ClassVar[int] = 8 # engages per (env, site) per run; exhausted -> warn, no weld
|
| 447 |
+
GRASP_STALL: ClassVar[float] = 0.01 # max |finger vel| sum (m/s): fingers stopped ON the part
|
| 448 |
+
GRASP_DEBOUNCE: ClassVar[int] = 8 # consecutive qualifying substeps before the weld engages
|
| 449 |
+
GRASP_RELEASE_MARGIN: ClassVar[float] = 0.008 # release at window-top + this (m), hysteresis
|
| 450 |
+
|
provenance/generation_code/p01_scene/strategy/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Base state-feedback program; Original central grasp and direct high transfer. DART offered only during high free-space transport. Initially UNTESTED; see pilot_report.json.
|
provenance/generation_code/p01_scene/strategy/meta.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 0,
|
| 3 |
+
"successes": 0,
|
| 4 |
+
"success_rate": null,
|
| 5 |
+
"batches": [],
|
| 6 |
+
"refreshed": null
|
| 7 |
+
}
|
provenance/generation_code/p01_scene/strategy/parameters.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compensate_action_filter": true,
|
| 3 |
+
"integral_position": 0.8,
|
| 4 |
+
"integral_rotation": 0.5,
|
| 5 |
+
"speed": 0.03,
|
| 6 |
+
"carry_height": 0.26,
|
| 7 |
+
"forward_clearance": -0.045,
|
| 8 |
+
"slide_height": 0.018,
|
| 9 |
+
"press_speed": 0.003
|
| 10 |
+
}
|
provenance/generation_code/p01_scene/strategy/solve.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|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
|
|
|
|
|
|
| 1 |
+
# plan: [stages 1-3] card held; card aligned above slot; card seated and released
|
| 2 |
+
# origin=fresh
|
| 3 |
+
"""A state-feedback program for the registered Franka/OSC GPU-install task.
|
| 4 |
+
|
| 5 |
+
Only env.step(action) changes the world. No dataset, checkpoint, reset, state
|
| 6 |
+
restoration, controller replacement, or scene-parameter writes are used.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
DART_SIGMA = 0.03
|
| 14 |
+
SOLVE_PARAMS = {'DART_SIGMA': None}
|
| 15 |
+
ENTRIES = {'start': 'unassembled card upright in holder, hand free',
|
| 16 |
+
'preinsert': 'card genuinely held, above front entry, clear of all contacts'}
|
| 17 |
+
|
| 18 |
+
def solve(env, entry=None, stop_after=None) -> None:
|
| 19 |
+
import torch
|
| 20 |
+
from isaaclab.utils.math import (
|
| 21 |
+
axis_angle_from_quat, quat_apply, quat_conjugate, quat_mul,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
params = json.loads(Path(__file__).with_name('parameters.json').read_text())
|
| 25 |
+
scene, robot = env.scene, env.robot
|
| 26 |
+
art = robot.articulation
|
| 27 |
+
dev, n = env.device, env.num_envs
|
| 28 |
+
assert n == 1, 'This initial phase-1 delivery handles one environment per process'
|
| 29 |
+
osc = robot.controller.controllers[0]
|
| 30 |
+
assert type(osc).__name__ == 'OperationalSpaceController'
|
| 31 |
+
assert robot.action_dim == 8
|
| 32 |
+
hand = art.body_names.index('panda_hand')
|
| 33 |
+
dt = env.dt * robot.control_period
|
| 34 |
+
offset = float(scene.GRASP_PINCH_OFFSET)
|
| 35 |
+
zero = torch.zeros(3, device=dev)
|
| 36 |
+
integral_p, integral_r = zero.clone(), zero.clone()
|
| 37 |
+
steps = 0
|
| 38 |
+
active_phase = 'start'
|
| 39 |
+
if entry not in (None, 'start', 'preinsert'): raise ValueError(entry)
|
| 40 |
+
|
| 41 |
+
def v(values): return torch.tensor(values, device=dev, dtype=torch.float32)
|
| 42 |
+
def mul(a,b): return quat_mul(a[None],b[None])[0]
|
| 43 |
+
def inv(q): return quat_conjugate(q[None])[0]
|
| 44 |
+
def rotate(q,x): return quat_apply(q[None],x[None])[0]
|
| 45 |
+
def orientation_error(goal,current):
|
| 46 |
+
if float(torch.dot(goal,current)) < 0: goal = -goal
|
| 47 |
+
return axis_angle_from_quat(mul(goal, inv(current))[None])[0]
|
| 48 |
+
def hp(): return art.data.body_pos_w[0,hand].clone()
|
| 49 |
+
def hq(): return art.data.body_quat_w[0,hand].clone()
|
| 50 |
+
def cp(): return scene.card.data.root_pos_w[0].clone()
|
| 51 |
+
def cq(): return scene.card.data.root_quat_w[0].clone()
|
| 52 |
+
def held(): return bool(scene.grasp_held[0].any())
|
| 53 |
+
def pinch(): return hp() + rotate(hq(),v([0,0,offset]))
|
| 54 |
+
def band(): return cp()+rotate(cq(),v([0,sum(scene.CARD_BODY_Y)/2,.1005]))
|
| 55 |
+
|
| 56 |
+
def log(phase,**extra):
|
| 57 |
+
print('PHASE1 '+json.dumps(dict(phase=phase,steps=steps,seconds=steps*dt,
|
| 58 |
+
held=held(),card=cp().tolist(),hand=hp().tolist(),
|
| 59 |
+
offset=scene._card_offset_in_case()[0].tolist(),
|
| 60 |
+
depth=float(scene.engaged()[0]),integral_position=integral_p.tolist(),
|
| 61 |
+
integral_rotation=integral_r.tolist(),**extra)),flush=True)
|
| 62 |
+
|
| 63 |
+
def tick(goal,quat,finger):
|
| 64 |
+
nonlocal integral_p, integral_r, steps
|
| 65 |
+
ep, er = goal-hp(), orientation_error(quat,hq())
|
| 66 |
+
integral_p=(integral_p+ep*dt).clamp(-.10,.10)
|
| 67 |
+
integral_r=(integral_r+er*dt).clamp(-4.0,4.0)
|
| 68 |
+
dp=ep+params['integral_position']*integral_p
|
| 69 |
+
dr=er+params['integral_rotation']*integral_r
|
| 70 |
+
dr=dr*min(1,2.5/max(float(dr.norm()),1e-9))
|
| 71 |
+
action=torch.zeros((1,8),device=dev)
|
| 72 |
+
action[0,:3]=(dp/osc.cfg.pos_scale).clamp(-6,6)
|
| 73 |
+
action[0,3:6]=(dr/osc.cfg.rot_scale).clamp(-20,20)
|
| 74 |
+
action[0,6:]=finger
|
| 75 |
+
# The preset smooths pose DELTAS, rather than absolute targets. Account
|
| 76 |
+
# for its documented filter in the command; never write controller state.
|
| 77 |
+
if params.get('compensate_action_filter',False) and osc._prev_action is not None:
|
| 78 |
+
alpha=float(osc.cfg.ema_factor)
|
| 79 |
+
action[0,:6]=(action[0,:6]-(1-alpha)*osc._prev_action[0])/alpha
|
| 80 |
+
assert torch.isfinite(action).all()
|
| 81 |
+
# Noise offered independently of noise_scale. Recorder keeps labels clean.
|
| 82 |
+
disturbance = torch.zeros_like(action)
|
| 83 |
+
if active_phase in ('lift_clear', 'transport_waypoint', 'above_case') and float(hp()[2]) > .38:
|
| 84 |
+
disturbance[0, :3] = DART_SIGMA * torch.randn(3, device=dev)
|
| 85 |
+
env.step(action, noise=disturbance)
|
| 86 |
+
steps+=1
|
| 87 |
+
|
| 88 |
+
def move(goal_fn,grip,timeout,tag,tol=.002,rot_tol=.035,card_check=None):
|
| 89 |
+
nonlocal active_phase
|
| 90 |
+
active_phase = tag
|
| 91 |
+
ref=hp(); good=0
|
| 92 |
+
for _ in range(max(1,math.ceil(timeout/dt))):
|
| 93 |
+
goal,quat=goal_fn()
|
| 94 |
+
delta=goal-ref; length=float(delta.norm())
|
| 95 |
+
ref=ref+delta*min(1,params['speed']*dt/max(length,1e-9))
|
| 96 |
+
tick(ref,quat,grip)
|
| 97 |
+
goal,quat=goal_fn()
|
| 98 |
+
ok=float((hp()-goal).norm())<tol and float(orientation_error(quat,hq()).norm())<rot_tol
|
| 99 |
+
if card_check is not None:ok=ok and card_check()
|
| 100 |
+
good=good+1 if ok else 0
|
| 101 |
+
if good>=8:log(tag,result='reached');return
|
| 102 |
+
log(tag,result='timeout',position_error=float((hp()-goal).norm()),rotation_error=float(orientation_error(quat,hq()).norm()))
|
| 103 |
+
raise RuntimeError('Stage did not reach its measured gate: '+tag)
|
| 104 |
+
|
| 105 |
+
def hold(goal_fn,finger,seconds):
|
| 106 |
+
nonlocal active_phase
|
| 107 |
+
active_phase = 'hold'
|
| 108 |
+
for _ in range(math.ceil(seconds/dt)):
|
| 109 |
+
goal,quat=goal_fn();tick(goal,quat,finger)
|
| 110 |
+
|
| 111 |
+
log('start')
|
| 112 |
+
if entry != 'preinsert':
|
| 113 |
+
# Stage 1: acquire the top band and verify a real grasp.
|
| 114 |
+
down=[mul(cq(),v([0,0,1,0])),mul(cq(),v([0,1,0,0]))]
|
| 115 |
+
pick_q=max(down,key=lambda q:abs(float(torch.dot(q,hq())))).clone()
|
| 116 |
+
def pick_goal(height=0):
|
| 117 |
+
return band()-rotate(pick_q,v([0,0,offset]))+v([0,0,height]),pick_q
|
| 118 |
+
move(lambda:pick_goal(.10),.04,18,'above_card',tol=.004,rot_tol=.05)
|
| 119 |
+
move(pick_goal,.04,16,'pinch_aligned',tol=.0025)
|
| 120 |
+
for k in range(math.ceil(2/dt)):
|
| 121 |
+
goal,quat=pick_goal()
|
| 122 |
+
tick(goal,quat,.04+(.0172-.04)*min(1,(k+1)*dt/1.5))
|
| 123 |
+
hold(pick_goal,.0172,1)
|
| 124 |
+
if not held():log('grasp_failed');raise RuntimeError('No grasp after controlled closure')
|
| 125 |
+
log('card_held')
|
| 126 |
+
elif not held():
|
| 127 |
+
raise RuntimeError('preinsert entry requires an actual grasp')
|
| 128 |
+
rel_p=rotate(inv(hq()),cp()-hp())
|
| 129 |
+
rel_q=mul(inv(hq()),cq())
|
| 130 |
+
def card_goal(position,quat):
|
| 131 |
+
# The grasp joint fixes this measured card-in-hand transform. A fixed
|
| 132 |
+
# world-frame hand goal avoids moving the goal in response to its own lag.
|
| 133 |
+
target_q=mul(quat,inv(rel_q))
|
| 134 |
+
return position-rotate(target_q,rel_p),target_q
|
| 135 |
+
def case_point(local):
|
| 136 |
+
return scene.case.data.root_pos_w[0]+rotate(scene.case.data.root_quat_w[0],v(local))
|
| 137 |
+
case_q=scene.case.data.root_quat_w[0].clone()
|
| 138 |
+
seat=list(scene.cfg.seat_pos)
|
| 139 |
+
forward=seat[0]+params['forward_clearance']
|
| 140 |
+
if entry != 'preinsert':
|
| 141 |
+
lift=cp();lift[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 142 |
+
move(lambda:card_goal(lift,case_q),.0172,25,'lift_clear',tol=.003)
|
| 143 |
+
if not held():raise RuntimeError('Grasp lost during lift')
|
| 144 |
+
|
| 145 |
+
# Stage 2: enter forward of the rear panel, then slide through its cutout.
|
| 146 |
+
high=[forward,seat[1],params['carry_height']-float(scene.cfg.case_lift)]
|
| 147 |
+
move(lambda:card_goal(case_point(high),case_q),.0172,40,'above_case',tol=.003)
|
| 148 |
+
if stop_after == 'above_case': return
|
| 149 |
+
above=[forward,seat[1],float(scene.cfg.slot_mouth_z)+params['slide_height']]
|
| 150 |
+
move(lambda:card_goal(case_point(above),case_q),.0172,20,'inside_case',tol=.002)
|
| 151 |
+
aligned=[seat[0],seat[1],above[2]]
|
| 152 |
+
def card_aligned():
|
| 153 |
+
return float((cp()-case_point(aligned)).norm())<.0007 and float(orientation_error(case_q,cq()).norm())<.004
|
| 154 |
+
move(lambda:card_goal(case_point(aligned),case_q),.0172,30,'slot_aligned',tol=.0004,rot_tol=.003,card_check=card_aligned)
|
| 155 |
+
|
| 156 |
+
# Stage 3: press, release, retract, then leave the installed card unsupported.
|
| 157 |
+
pressed=[seat[0],seat[1],seat[2]-.001]
|
| 158 |
+
active_phase='press'
|
| 159 |
+
press_z=aligned[2]
|
| 160 |
+
for _ in range(math.ceil(25/dt)):
|
| 161 |
+
press_z=max(pressed[2],press_z-params['press_speed']*dt)
|
| 162 |
+
target,quat=card_goal(case_point([seat[0],seat[1],press_z]),case_q)
|
| 163 |
+
tick(target,quat,.0172)
|
| 164 |
+
if bool(scene.seated()[0]):break
|
| 165 |
+
if not bool(scene.seated()[0]):log('press_failed');raise RuntimeError('Card did not seat')
|
| 166 |
+
log('seated_before_release')
|
| 167 |
+
keep=hp(); keep_q=hq()
|
| 168 |
+
hold(lambda:(keep,keep_q),.04,2)
|
| 169 |
+
up=keep+v([0,0,.14])
|
| 170 |
+
move(lambda:(up,keep_q),.04,16,'hand_clear',tol=.004,rot_tol=.06)
|
| 171 |
+
hold(lambda:(up,keep_q),.04,5)
|
| 172 |
+
log('finished',seated=bool(scene.seated()[0]))
|
| 173 |
+
if held() or not bool(scene.seated()[0]):raise RuntimeError('Card did not remain seated after release')
|
provenance/generation_code/p02_strategy/grader.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Grader for the pc_gpu scene: the graphics card seated in the PCIe x16 slot.
|
| 2 |
+
|
| 3 |
+
Rubric stages (weights and modes live in RUBRIC):
|
| 4 |
+
grasped the card has been taken in the weld-on-closure grip (`scene.grasp_held`) — the
|
| 5 |
+
scene's own grasp state; a milestone, latched. Also true once the card is
|
| 6 |
+
aligned in the slot (a card in the slot was necessarily carried there), so the
|
| 7 |
+
rung nests under `aligned`. Under an embodiment with no gripper (the weld
|
| 8 |
+
contract disabled, e.g. robot="null") the grasp state does not exist and the
|
| 9 |
+
rung reads from that implication alone
|
| 10 |
+
aligned the card lined up on the slot — origin within `align_xy` of the seated point,
|
| 11 |
+
up axis within `align_axis_deg` of the slot axis, length axis within
|
| 12 |
+
`align_yaw_deg` of the slot heading: the scene's own three non-depth seat gates
|
| 13 |
+
pressed tab depth below the slot mouth (`slot_mouth_z`, the scene's own `engaged()`)
|
| 14 |
+
as a fraction of `seat_depth`, counted only while aligned — so it is 1.0 iff
|
| 15 |
+
the scene calls the card seated
|
| 16 |
+
Every stage is per env. The rungs nest (seated => aligned => grasped), so progress reaches
|
| 17 |
+
1.0 exactly when the card is seated, and for a grader built after the pick as well as one
|
| 18 |
+
that watched it. The rear-panel pass-through is NOT a rung: the cutout's geometry is not in
|
| 19 |
+
the scene cfg, so it cannot be read from state without an invented tolerance. Success is
|
| 20 |
+
the scene's `seated()` per env — depth, xy, tilt AND heading gates — read when the
|
| 21 |
+
delivery finishes.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
|
| 28 |
+
from robobench.core import BaseGrader
|
| 29 |
+
# baked by data_engine init: grade against the LOCAL scene copy (../scene/scene.py),
|
| 30 |
+
# exec'd at most once per process under a fixed module key.
|
| 31 |
+
import importlib.util as _ilu
|
| 32 |
+
import sys as _sys
|
| 33 |
+
from pathlib import Path as _Path
|
| 34 |
+
|
| 35 |
+
if "datagen_local_scene" not in _sys.modules:
|
| 36 |
+
import robobench as _rb
|
| 37 |
+
_rb.discover()
|
| 38 |
+
_p = _Path(__file__).resolve().parent.parent / "scene" / "scene.py"
|
| 39 |
+
_spec = _ilu.spec_from_file_location("datagen_local_scene", _p)
|
| 40 |
+
_m = _ilu.module_from_spec(_spec)
|
| 41 |
+
_sys.modules["datagen_local_scene"] = _m
|
| 42 |
+
_spec.loader.exec_module(_m)
|
| 43 |
+
PcGpuAssemblyScene = _sys.modules["datagen_local_scene"].PcGpuAssemblyScene
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PcGpuAssemblyGrader(BaseGrader):
|
| 47 |
+
"""The card seated in its slot — pressed to depth, centred, upright, heading along the slot.
|
| 48 |
+
|
| 49 |
+
Ladder: grasped 0.33 · aligned 0.67 · pressed 1.00 — three equal rungs for the three
|
| 50 |
+
steps of the task (take the card, line it up on the slot, press it home); the last rung
|
| 51 |
+
is a linear ramp of tab depth from the slot mouth (`slot_mouth_z`) to `seat_depth`.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
SCENE = PcGpuAssemblyScene
|
| 55 |
+
RUBRIC = (("grasped", 1, "once"), ("aligned", 1), ("pressed", 1))
|
| 56 |
+
scene: PcGpuAssemblyScene
|
| 57 |
+
|
| 58 |
+
def setup(self) -> None:
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# `grasp_held` exists only while the weld contract is live (a gripper on the stage).
|
| 62 |
+
self._has_grasp = hasattr(self.scene, "grasp_held")
|
| 63 |
+
self._grasped = torch.zeros(self.num_envs, dtype=torch.bool,
|
| 64 |
+
device=self.scene.engaged().device) # latch: card ever held
|
| 65 |
+
|
| 66 |
+
def check_success(self):
|
| 67 |
+
return self.scene.seated() # (num_envs,)
|
| 68 |
+
|
| 69 |
+
def _aligned(self):
|
| 70 |
+
"""(num_envs,) bool: the scene's xy + tilt + heading seat gates, without depth."""
|
| 71 |
+
c = self.scene.cfg
|
| 72 |
+
rel = self.scene._card_offset_in_case() # (n, 3), zero at the seated pose — privileged
|
| 73 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 74 |
+
up_ok = self.scene._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 75 |
+
yaw_ok = self.scene._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 76 |
+
return xy_ok & up_ok & yaw_ok
|
| 77 |
+
|
| 78 |
+
# ---- rubric stages — each returns a (num_envs,) value in [0, 1] ---------------------
|
| 79 |
+
def grasped(self):
|
| 80 |
+
if self._has_grasp:
|
| 81 |
+
self._grasped |= self.scene.grasp_held.any(dim=1)
|
| 82 |
+
return (self._grasped | self._aligned()).float()
|
| 83 |
+
|
| 84 |
+
def aligned(self):
|
| 85 |
+
return self._aligned().float()
|
| 86 |
+
|
| 87 |
+
def pressed(self):
|
| 88 |
+
depth = self.scene.engaged() # (n,) tab depth below the slot mouth (m)
|
| 89 |
+
return self._aligned() * (depth / self.scene.cfg.seat_depth).clamp(0.0, 1.0)
|
provenance/generation_code/p02_strategy/scene.py
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PcGpuAssemblyScene — insert a graphics card into the PC's PCIe slot.
|
| 2 |
+
|
| 3 |
+
The same gaming-PC case as `pc_motherboard` lies on its side on the table, opening up, motherboard
|
| 4 |
+
facing the ceiling — but here the board's PCIe area is the work site. Beside the case lies a loose
|
| 5 |
+
RTX 2060 (extracted from the PC model as its own rigid body, backplate down). Goal (carried here,
|
| 6 |
+
no task layer): stand the card upright over the primary x16 slot, line its PCB edge up with the
|
| 7 |
+
slot, and press it straight down until it seats.
|
| 8 |
+
|
| 9 |
+
The case is one kinematic body that never moves — the PC model stays visual-only; its physics is
|
| 10 |
+
an invisible fixture inside the case body: a channel whose walls grip the card's 4 mm PCB tab at
|
| 11 |
+
0.15 mm/side (flaring to a 1.2 mm/side funnel mouth — idealizing the real slot's spring
|
| 12 |
+
contacts, and capping the unscrewed card's gravity roll at ~2 deg), a floor whose top is the
|
| 13 |
+
model's own seated tab height, end stops (~1.6 mm play), a flush board plate so a dropped card
|
| 14 |
+
rests on the board face, and a REAR I/O PANEL frame around the expansion-slot cutout — so the
|
| 15 |
+
card must be placed inside the case, slid rearward until its bracket/ports pass through the
|
| 16 |
+
opening, and only then pressed down (a straight vertical drop is physically blocked by the
|
| 17 |
+
panel above the cutout, exactly like a real build). The card's origin is its
|
| 18 |
+
PCB-tab bottom CENTRE with axes equal to the case's, so the seated pose is just `seat_pos` +
|
| 19 |
+
identity orientation in the case frame, and insertion depth is a z difference.
|
| 20 |
+
|
| 21 |
+
Heavy imports (isaaclab, pxr) are deferred so importing this module stays app-free.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
from robobench.core.assets import asset_path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, ClassVar
|
| 31 |
+
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
from robobench.core import GraspWeldContract, SCENES, BaseCfg, BaseScene, SimCfg
|
| 35 |
+
|
| 36 |
+
if TYPE_CHECKING:
|
| 37 |
+
from isaaclab.assets import RigidObject
|
| 38 |
+
|
| 39 |
+
from robobench.core import BaseEnv
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class PcGpuAssemblySceneCfg(BaseCfg):
|
| 44 |
+
"""Config for `PcGpuAssemblyScene`. Nothing is locked — a variant is just a copy with a few
|
| 45 |
+
fields changed."""
|
| 46 |
+
|
| 47 |
+
# --- the curriculum / difficulty dials -----------------------------------------------
|
| 48 |
+
# The card is "seated" when — in the case's frame — its tab is >= `seat_depth` below the slot
|
| 49 |
+
# mouth, its origin is within `align_xy` of the seated point, and its axes are within
|
| 50 |
+
# `align_axis_deg` (tilt) / `align_yaw_deg` (heading along the slot) of the case's. The full
|
| 51 |
+
# stroke from the slot mouth to the channel floor is 5 mm, so 4 mm separates "seated" from
|
| 52 |
+
# "merely resting in the mouth".
|
| 53 |
+
seat_depth: float = 0.004 # min tab depth below the slot mouth (m) to count as seated
|
| 54 |
+
align_xy: float = 0.003 # max distance (m) of the card origin from the seated point
|
| 55 |
+
align_axis_deg: float = 3.0 # max tilt of the card's up axis off the slot axis (deg)
|
| 56 |
+
align_yaw_deg: float = 3.0 # max heading error of the card's length axis (deg)
|
| 57 |
+
reset_pos_jitter: float = 0.01 # uniform +/- xy jitter for the loose card at reset (m)
|
| 58 |
+
# Part friction (static = dynamic), set on every shape at bind. The moving card runs moderately
|
| 59 |
+
# slick against a grippier fixed case, so it slides down the channel but holds seat.
|
| 60 |
+
card_friction: float = 0.3
|
| 61 |
+
case_friction: float = 0.75
|
| 62 |
+
# Weld-on-closure grasping (the benchmark's auto-weld contract, PhysX
|
| 63 |
+
# form — the grasp-weld machinery at the end of this scene class):
|
| 64 |
+
# close the fingers squarely across the card's body slab near its top edge and the card welds
|
| 65 |
+
# to the hand; open wide to release. Gripper envs only (no-op under robot="null").
|
| 66 |
+
grasp_weld: bool = True
|
| 67 |
+
grasp_weld_dist: float = 0.010 # pinch-point-to-grip-band engage radius (m)
|
| 68 |
+
|
| 69 |
+
pilot_jitter_x: float = 0.004
|
| 70 |
+
pilot_jitter_y: float = 0.0007
|
| 71 |
+
|
| 72 |
+
# --- structure, reset layout, masses, asset paths (fixed) -------------------------------
|
| 73 |
+
# Seated card origin (its PCB-tab bottom centre) in the case's local frame; orientation seated
|
| 74 |
+
# = the case's own axes (identity). Baked into the committed USDs (keep in sync if they change).
|
| 75 |
+
seat_pos: tuple[float, float, float] = (-0.01595, 0.0293, 0.0035)
|
| 76 |
+
slot_mouth_z: float = 0.0085 # slot top in the case frame: depth datum (5 mm at full seat)
|
| 77 |
+
board_top: float = 0.0 # board face height in the case frame (the asset's own origin)
|
| 78 |
+
case_lift: float = 0.0289 # board face above the side panel the case lies on
|
| 79 |
+
card_mass: float = 1.0 # dual-fan RTX 2060 (kg)
|
| 80 |
+
light_intensity: float = 2500.0
|
| 81 |
+
# Loose card start pose: lying backplate-down on the table beside the case (+x side; the case
|
| 82 |
+
# spans x < 0.13 and the lying card's tail reaches origin_x - 0.132).
|
| 83 |
+
card_init_xy: tuple[float, float] = (0.28, 0.0) # card start xy (table-rel.)
|
| 84 |
+
card_init_z: float = 0.0022 # origin height lying backplate-down (backplate plane -2 mm)
|
| 85 |
+
card_init_quat: tuple[float, float, float, float] = (0.70711, 0.70711, 0.0, 0.0) # flat
|
| 86 |
+
card_contact_offset: float = 0.0001 # well below the 0.15 mm/side channel grip
|
| 87 |
+
case_contact_offset: float = 0.0001 # ditto for the slot fixture's walls
|
| 88 |
+
# Optional foam holder (a floor pad + two rails flanking the card's 36 mm body slab) that
|
| 89 |
+
# presents the card UPRIGHT for a parallel-jaw grasp. The lying default is ungraspable by a
|
| 90 |
+
# Franka gripper: flat on its backplate the card's only sub-80 mm dimension (the 36 mm body
|
| 91 |
+
# thickness) points UP, so no top-down or side pinch can straddle it. Enable together with an
|
| 92 |
+
# upright `card_init_quat` (identity = the seated orientation) and `card_init_z` = the
|
| 93 |
+
# holder's floor top; the rails cap the free card's lean at ~3 deg and the pick pulls
|
| 94 |
+
# straight up out of them.
|
| 95 |
+
card_stand: bool = False
|
| 96 |
+
card_stand_gap: float = 0.0025 # rail clearance per side around the body slab (m)
|
| 97 |
+
# Selectable work surface (same presets as the sibling scenes).
|
| 98 |
+
table: str = "lab_table" # which work surface: "lab_table" | "packing"
|
| 99 |
+
surface_z: float | None = None # table-top height (m); None -> the preset's
|
| 100 |
+
workbench_pos: tuple[float, float] | None = None # xy the table sits at; None -> preset
|
| 101 |
+
workbench_usd: str = "" # empty -> the preset's vendored USD
|
| 102 |
+
TABLES: ClassVar[dict[str, dict[str, Any]]] = {
|
| 103 |
+
"lab_table": {"usd": ("lab_table", "table_instanceable.usd"), "scale": 1.0,
|
| 104 |
+
"orient": (0.70711, 0.0, 0.0, 0.70711), "surface_z": 0.0, "pos": (0.5, 0.0),
|
| 105 |
+
"top_offset": 0.0, "height": 1.05, "kinematic": False},
|
| 106 |
+
"packing": {"usd": ("packing_table", "SM_HeavyDutyPackingTable_C02_01_physics.usd"), "scale": 0.01,
|
| 107 |
+
"orient": (1.0, 0.0, 0.0, 0.0), "surface_z": 0.994, "pos": (0.0, 0.0),
|
| 108 |
+
"top_offset": 0.994, "height": 0.994, "kinematic": True},
|
| 109 |
+
}
|
| 110 |
+
# Asset USDs; empty -> the prebuilt assets committed under `assets/`.
|
| 111 |
+
asset_dir: str = ""
|
| 112 |
+
case_usd: str = ""
|
| 113 |
+
card_usd: str = ""
|
| 114 |
+
|
| 115 |
+
def __post_init__(self) -> None:
|
| 116 |
+
assets = asset_path(Path(__file__).resolve().parents[1] / "assets")
|
| 117 |
+
self.asset_dir = self.asset_dir or str(assets)
|
| 118 |
+
self.case_usd = self.case_usd or str(Path(self.asset_dir) / "pc" / "pc_case_gpu_assembly_mb.usd")
|
| 119 |
+
self.card_usd = self.card_usd or str(Path(self.asset_dir) / "pc" / "gpu_rtx2060.usd")
|
| 120 |
+
preset = self.TABLES[self.table]
|
| 121 |
+
if self.surface_z is None:
|
| 122 |
+
self.surface_z = preset["surface_z"]
|
| 123 |
+
if self.workbench_pos is None:
|
| 124 |
+
self.workbench_pos = preset["pos"]
|
| 125 |
+
self.workbench_usd = self.workbench_usd or str(assets / "props" / preset["usd"][0] / preset["usd"][1])
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@SCENES.register("pc_gpu_local")
|
| 129 |
+
class PcGpuAssemblyScene(BaseScene):
|
| 130 |
+
cfg: PcGpuAssemblySceneCfg
|
| 131 |
+
|
| 132 |
+
# Object physics remains nominal in this pilot; L4 uses the recorded noise channel.
|
| 133 |
+
PHYSICAL_PARAMS = {'card_mass': None, 'card_friction': None, 'case_friction': None}
|
| 134 |
+
VISUAL_PARAMS = {'light_intensity': {'dist': 'choice', 'options': [1600., 2500., 3400.]}}
|
| 135 |
+
CAMERAS = {'front': {'eye': (-.1, -1.06, 1.282), 'target': (.42, -.08, .06),
|
| 136 |
+
'focal': 16., 'bands': {
|
| 137 |
+
'eye_x': {'dist': 'uniform', 'lo': -.125, 'hi': -.075},
|
| 138 |
+
'eye_y': {'dist': 'uniform', 'lo': -1.085, 'hi': -1.035},
|
| 139 |
+
'target_x': {'dist': 'uniform', 'lo': .405, 'hi': .435}}}}
|
| 140 |
+
|
| 141 |
+
def apply_visual_params(self, env, values):
|
| 142 |
+
# Render-only light; never touches geometry, contact, or robot control.
|
| 143 |
+
from pxr import UsdLux
|
| 144 |
+
if 'light_intensity' in values:
|
| 145 |
+
prim = env.sim.stage.GetPrimAtPath('/World/light')
|
| 146 |
+
UsdLux.LightAPI(prim).GetIntensityAttr().Set(float(values['light_intensity']))
|
| 147 |
+
|
| 148 |
+
# Card-local y extent of the body collision slab (from gpu_rtx2060.usd `/gpu/collision/body`:
|
| 149 |
+
# backplate plane -2 mm, fan-shroud plane +32.8 mm around the PCB-tab-centre origin — the
|
| 150 |
+
# collider is trimmed to the VISUAL shell). The stand's rails flank THESE faces — the same
|
| 151 |
+
# pair a parallel-jaw grasp pinches.
|
| 152 |
+
CARD_BODY_Y: ClassVar[tuple[float, float]] = (-0.002, 0.0328)
|
| 153 |
+
|
| 154 |
+
def __init__(self, cfg: PcGpuAssemblySceneCfg | None = None) -> None:
|
| 155 |
+
super().__init__(cfg or PcGpuAssemblySceneCfg())
|
| 156 |
+
|
| 157 |
+
# ----- assets -------------------------------------------------------------------------------
|
| 158 |
+
def assets(self) -> dict[str, Any]:
|
| 159 |
+
"""Floor, dome light, table, the PC case lying on it (kinematic, with the invisible slot
|
| 160 |
+
fixture), and one loose graphics card. The card loads with the high solver-iteration count
|
| 161 |
+
the snug channel needs."""
|
| 162 |
+
import isaaclab.sim as sim_utils
|
| 163 |
+
from isaaclab.assets import AssetBaseCfg, RigidObjectCfg
|
| 164 |
+
|
| 165 |
+
c = self.cfg
|
| 166 |
+
for usd in (c.case_usd, c.card_usd):
|
| 167 |
+
if not Path(usd).is_file():
|
| 168 |
+
raise FileNotFoundError(
|
| 169 |
+
f"{usd} not found — the pc-gpu assets ship with the repo under "
|
| 170 |
+
f"`suites/assembly/assets/`"
|
| 171 |
+
)
|
| 172 |
+
preset = c.TABLES[c.table]
|
| 173 |
+
wx, wy = c.workbench_pos
|
| 174 |
+
table_z = c.surface_z - preset["top_offset"]
|
| 175 |
+
ground_z = c.surface_z - preset["height"]
|
| 176 |
+
table_spawn = sim_utils.UsdFileCfg(usd_path=c.workbench_usd, scale=(preset["scale"],) * 3)
|
| 177 |
+
if preset["kinematic"]:
|
| 178 |
+
table_spawn.rigid_props = sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True)
|
| 179 |
+
|
| 180 |
+
cx, cy = c.card_init_xy
|
| 181 |
+
assets: dict[str, Any] = {
|
| 182 |
+
"ground": AssetBaseCfg(
|
| 183 |
+
prim_path="/World/ground",
|
| 184 |
+
spawn=sim_utils.GroundPlaneCfg(usd_path=str(
|
| 185 |
+
asset_path(Path(__file__).resolve().parents[1] / "assets") / "props" / "ground" / "default_ground.usd")),
|
| 186 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, ground_z)),
|
| 187 |
+
),
|
| 188 |
+
"light": AssetBaseCfg(
|
| 189 |
+
prim_path="/World/light",
|
| 190 |
+
spawn=sim_utils.DomeLightCfg(intensity=c.light_intensity, color=(0.9, 0.9, 0.9)),
|
| 191 |
+
),
|
| 192 |
+
"workbench": AssetBaseCfg(
|
| 193 |
+
prim_path="{ENV_REGEX_NS}/Table",
|
| 194 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(wx, wy, table_z), rot=preset["orient"]),
|
| 195 |
+
spawn=table_spawn,
|
| 196 |
+
),
|
| 197 |
+
# The case: kinematic; the invisible fixture inside it (slot channel + rear-panel
|
| 198 |
+
# cutout frame) is what the card mates with. Fixture contact offsets are set here
|
| 199 |
+
# (not just authored in the asset) so the 0.15 mm/side channel grip never fights
|
| 200 |
+
# speculative contacts.
|
| 201 |
+
"case": RigidObjectCfg(
|
| 202 |
+
prim_path="{ENV_REGEX_NS}/Case",
|
| 203 |
+
spawn=sim_utils.UsdFileCfg(
|
| 204 |
+
usd_path=c.case_usd,
|
| 205 |
+
activate_contact_sensors=True,
|
| 206 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 207 |
+
contact_offset=c.case_contact_offset, rest_offset=0.0
|
| 208 |
+
),
|
| 209 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
|
| 210 |
+
),
|
| 211 |
+
init_state=RigidObjectCfg.InitialStateCfg(pos=(wx, wy, c.surface_z + c.case_lift)),
|
| 212 |
+
),
|
| 213 |
+
# Card contact offset must stay well below the channel grip (0.15 mm/side) or
|
| 214 |
+
# speculative contacts choke the fit.
|
| 215 |
+
"card": RigidObjectCfg(
|
| 216 |
+
prim_path="{ENV_REGEX_NS}/Card",
|
| 217 |
+
spawn=sim_utils.UsdFileCfg(
|
| 218 |
+
usd_path=c.card_usd,
|
| 219 |
+
activate_contact_sensors=True,
|
| 220 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 221 |
+
contact_offset=c.card_contact_offset, rest_offset=0.0
|
| 222 |
+
),
|
| 223 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(
|
| 224 |
+
solver_position_iteration_count=192,
|
| 225 |
+
solver_velocity_iteration_count=1,
|
| 226 |
+
max_depenetration_velocity=0.02,
|
| 227 |
+
linear_damping=2.0,
|
| 228 |
+
angular_damping=2.0,
|
| 229 |
+
),
|
| 230 |
+
mass_props=sim_utils.MassPropertiesCfg(mass=c.card_mass),
|
| 231 |
+
),
|
| 232 |
+
init_state=RigidObjectCfg.InitialStateCfg(
|
| 233 |
+
pos=(wx + cx, wy + cy, c.surface_z + c.card_init_z), rot=c.card_init_quat
|
| 234 |
+
),
|
| 235 |
+
),
|
| 236 |
+
}
|
| 237 |
+
if c.card_stand:
|
| 238 |
+
# Foam holder for a gripper env: three STATIC boxes (no rigid body). The floor pad's
|
| 239 |
+
# top is the card spawn height (`card_init_z` = the tab-bottom plane), the two rails
|
| 240 |
+
# flank the body slab's faces at `card_stand_gap` per side. Rail tops stay 35+ mm
|
| 241 |
+
# below the pick grip band, so descending open fingers never meet them.
|
| 242 |
+
y0, y1 = self.CARD_BODY_Y
|
| 243 |
+
mid_y = wy + cy + 0.5 * (y0 + y1) # body-slab mid-plane (the pinch/rail centre)
|
| 244 |
+
half_gap = 0.5 * (y1 - y0) + c.card_stand_gap # rail inner face off the mid-plane
|
| 245 |
+
rail_h, rail_t = 0.055, 0.008
|
| 246 |
+
foam = sim_utils.PreviewSurfaceCfg(diffuse_color=(0.17, 0.17, 0.2), roughness=0.9)
|
| 247 |
+
for name, size, pos in (
|
| 248 |
+
("card_stand_floor", (0.11, 0.09, c.card_init_z),
|
| 249 |
+
(wx + cx, mid_y, c.surface_z + 0.5 * c.card_init_z)),
|
| 250 |
+
("card_stand_rail_pcb", (0.11, rail_t, rail_h),
|
| 251 |
+
(wx + cx, mid_y - half_gap - 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 252 |
+
("card_stand_rail_fan", (0.11, rail_t, rail_h),
|
| 253 |
+
(wx + cx, mid_y + half_gap + 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 254 |
+
):
|
| 255 |
+
assets[name] = AssetBaseCfg(
|
| 256 |
+
prim_path="{ENV_REGEX_NS}/" + "".join(p.capitalize() for p in name.split("_")),
|
| 257 |
+
spawn=sim_utils.CuboidCfg(
|
| 258 |
+
size=size,
|
| 259 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 260 |
+
contact_offset=0.001, rest_offset=0.0
|
| 261 |
+
),
|
| 262 |
+
visual_material=foam,
|
| 263 |
+
),
|
| 264 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=pos),
|
| 265 |
+
)
|
| 266 |
+
# Immutable visual-only set dressing, clear of the arm/task swept volume.
|
| 267 |
+
assets['pilot_parts_box'] = AssetBaseCfg(
|
| 268 |
+
prim_path='{ENV_REGEX_NS}/PilotPartsBox',
|
| 269 |
+
spawn=sim_utils.CuboidCfg(size=(.075, .075, .045),
|
| 270 |
+
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(.08, .35, .65), roughness=.8)),
|
| 271 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(.90, .36, c.surface_z+.0225)))
|
| 272 |
+
return assets
|
| 273 |
+
|
| 274 |
+
def sim_cfg(self) -> SimCfg:
|
| 275 |
+
return SimCfg(
|
| 276 |
+
dt=1.0 / 120.0,
|
| 277 |
+
physx={
|
| 278 |
+
"solver_type": 1,
|
| 279 |
+
"bounce_threshold_velocity": 0.2,
|
| 280 |
+
"friction_offset_threshold": 0.01,
|
| 281 |
+
"friction_correlation_distance": 0.00625,
|
| 282 |
+
"gpu_max_rigid_contact_count": 2**23,
|
| 283 |
+
"gpu_max_rigid_patch_count": 2**23,
|
| 284 |
+
"gpu_collision_stack_size": 2**28,
|
| 285 |
+
"gpu_max_num_partitions": 1,
|
| 286 |
+
},
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# ----- lifecycle ----------------------------------------------------------------------------
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, name: str):
|
| 292 |
+
# Legacy surface: the grasp contract's state used to live directly on the scene
|
| 293 |
+
# (inline machinery era) and existing solutions read it there — forward to the
|
| 294 |
+
# composed contract. `__getattr__` only fires for attributes not found normally.
|
| 295 |
+
if name.startswith("_gw_") and "grasp_weld" in self.__dict__:
|
| 296 |
+
return getattr(self.grasp_weld, name)
|
| 297 |
+
raise AttributeError(name)
|
| 298 |
+
|
| 299 |
+
def bind(self, env: BaseEnv) -> None:
|
| 300 |
+
"""Grab the case + card handles, cache env origins, and set the part frictions."""
|
| 301 |
+
super().bind(env)
|
| 302 |
+
self.case: RigidObject = env.iscene["case"]
|
| 303 |
+
self.card: RigidObject = env.iscene["card"]
|
| 304 |
+
self.env_origins = env.iscene.env_origins
|
| 305 |
+
self._set_friction(self.case, self.cfg.case_friction)
|
| 306 |
+
self._set_friction(self.card, self.cfg.card_friction)
|
| 307 |
+
self.grasp_weld = GraspWeldContract(self) # composed, publishes self.grasp_held
|
| 308 |
+
self.grasp_weld.bind()
|
| 309 |
+
|
| 310 |
+
def grasp_sites(self) -> list:
|
| 311 |
+
"""One grip band: across the body slab (faces at CARD_BODY_Y, 34.8 mm wide), along the
|
| 312 |
+
card's upper length — band centre 15 mm below the shroud's top edge (z 0.1155)."""
|
| 313 |
+
y = 0.5 * (self.CARD_BODY_Y[0] + self.CARD_BODY_Y[1])
|
| 314 |
+
return [("card", self.card, (-0.045, y, 0.1005), (0.045, y, 0.1005), (0.030, 0.039))]
|
| 315 |
+
|
| 316 |
+
def post_step(self, env_ids: torch.Tensor | None = None) -> None:
|
| 317 |
+
"""Reconcile the weld-on-closure grasp contract every physics substep."""
|
| 318 |
+
self.grasp_weld.step()
|
| 319 |
+
|
| 320 |
+
def _set_friction(self, asset, value: float) -> None:
|
| 321 |
+
"""Overwrite the static + dynamic friction on every shape of `asset` (across all envs)."""
|
| 322 |
+
mats = asset.root_physx_view.get_material_properties()
|
| 323 |
+
mats[..., 0:2] = value # [static, dynamic, restitution]
|
| 324 |
+
asset.root_physx_view.set_material_properties(mats, torch.arange(self.env.num_envs, device="cpu"))
|
| 325 |
+
|
| 326 |
+
def reset(self, env_ids: torch.Tensor) -> None:
|
| 327 |
+
"""Fresh, unassembled start: the case pinned at spawn, the card lying backplate-down on
|
| 328 |
+
the table beside it, with xy jitter."""
|
| 329 |
+
c = self.cfg
|
| 330 |
+
dev = self.env.device
|
| 331 |
+
m = len(env_ids)
|
| 332 |
+
origin = self.env_origins[env_ids] # (m, 3)
|
| 333 |
+
wx, wy = c.workbench_pos
|
| 334 |
+
cx, cy = c.card_init_xy
|
| 335 |
+
|
| 336 |
+
st = torch.zeros(m, 13, device=dev)
|
| 337 |
+
st[:, 0:3] = origin + torch.tensor((wx + cx, wy + cy, c.surface_z + c.card_init_z), device=dev)
|
| 338 |
+
st[:, 0:2] += (torch.rand(m, 2, device=dev) * 2 - 1) * c.reset_pos_jitter
|
| 339 |
+
# Small in-holder variation: below rail clearance; no case/slot changes.
|
| 340 |
+
st[:, :2] += (torch.rand(m, 2, device=dev)*2-1) * torch.tensor(
|
| 341 |
+
[c.pilot_jitter_x, c.pilot_jitter_y], device=dev)
|
| 342 |
+
st[:, 3:7] = torch.tensor(c.card_init_quat, device=dev)
|
| 343 |
+
self.card.write_root_state_to_sim(st, env_ids)
|
| 344 |
+
self.grasp_weld.release_all(env_ids)
|
| 345 |
+
|
| 346 |
+
# ----- state (full, restorable) -------------------------------------------------------------
|
| 347 |
+
def get_state(self, env_ids: torch.Tensor) -> dict[str, Any]:
|
| 348 |
+
"""Restorable scene state: world root states (13) of the case and the card, plus the
|
| 349 |
+
grasp-weld holds."""
|
| 350 |
+
return {
|
| 351 |
+
"case": self.case.data.root_state_w[env_ids].clone(),
|
| 352 |
+
"card": self.card.data.root_state_w[env_ids].clone(),
|
| 353 |
+
**self.grasp_weld.state(env_ids),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
def set_state(self, state: dict[str, Any], env_ids: torch.Tensor) -> None:
|
| 357 |
+
"""Restore what `get_state` returned. The card's insertion depth is fully captured by its
|
| 358 |
+
root state, so the channel holds it on restore."""
|
| 359 |
+
self.case.write_root_pose_to_sim(state["case"][:, 0:7], env_ids)
|
| 360 |
+
self.card.write_root_state_to_sim(state["card"], env_ids)
|
| 361 |
+
self.grasp_weld.restore(state, env_ids)
|
| 362 |
+
|
| 363 |
+
# ----- description --------------------------------------------------------------------------
|
| 364 |
+
def describe(self) -> str:
|
| 365 |
+
if self.cfg.card_stand:
|
| 366 |
+
card = (
|
| 367 |
+
"Beside the case a loose graphics card stands upright in a foam holder, already "
|
| 368 |
+
"in its installation orientation.\nGoal: grip the card by its top edge, lift it "
|
| 369 |
+
"straight out of the holder, "
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
card = (
|
| 373 |
+
"Beside the case lies a loose graphics card, backplate down.\nGoal: lift the "
|
| 374 |
+
"card upright (fans toward the case front), "
|
| 375 |
+
)
|
| 376 |
+
return (
|
| 377 |
+
"A gaming-PC case lying on its side on a sturdy table, opening up, its motherboard "
|
| 378 |
+
"facing the ceiling. The board's primary PCIe x16 slot is empty, and the rear I/O "
|
| 379 |
+
f"panel has an open expansion-slot cutout. {card}"
|
| 380 |
+
"lower it into the case with its I/O bracket just forward of the rear panel, slide "
|
| 381 |
+
"it rearward until the bracket and ports pass through the cutout, line its PCB edge "
|
| 382 |
+
"connector up with the x16 slot, and press it straight down until it bottoms out. "
|
| 383 |
+
"A seated card stays put on its own. The task is complete once the card is fully "
|
| 384 |
+
"seated."
|
| 385 |
+
+ " A fixed blue parts box decorates the far corner, outside the task volume."
|
| 386 |
+
+ (
|
| 387 |
+
" The card holds in a firm pinch: close the fingers squarely across its body "
|
| 388 |
+
"slab near the top edge and the grip locks; open wide to release."
|
| 389 |
+
if self.cfg.grasp_weld
|
| 390 |
+
else ""
|
| 391 |
+
)
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# ----- progress (public: seated()/engaged(); reads how far the assembly has got) -------------
|
| 395 |
+
def engaged(self) -> torch.Tensor:
|
| 396 |
+
"""Tab depth below the slot mouth, shape (num_envs,), in metres (negative = still above
|
| 397 |
+
the slot). The card bottoms out on the channel floor at 0.005 depth."""
|
| 398 |
+
rel = self._card_offset_in_case() # (n, 3), zero at the seated pose
|
| 399 |
+
return (self.cfg.slot_mouth_z - self.cfg.seat_pos[2]) - rel[:, 2]
|
| 400 |
+
|
| 401 |
+
def seated(self) -> torch.Tensor:
|
| 402 |
+
"""Whether the card is seated in the slot, shape (num_envs,): pressed down to `seat_depth`
|
| 403 |
+
below the mouth, within `align_xy` of the seated point, and aligned in tilt AND heading."""
|
| 404 |
+
c = self.cfg
|
| 405 |
+
rel = self._card_offset_in_case() # (n, 3)
|
| 406 |
+
depth_ok = self.engaged() >= c.seat_depth
|
| 407 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 408 |
+
up_ok = self._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 409 |
+
yaw_ok = self._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 410 |
+
return depth_ok & xy_ok & up_ok & yaw_ok
|
| 411 |
+
|
| 412 |
+
def success(self) -> torch.Tensor:
|
| 413 |
+
"""(N,) bool: the card seated in its slot — this scene's assembled state
|
| 414 |
+
(scene-level success alias, matching the other suites' surface)."""
|
| 415 |
+
return self.seated()
|
| 416 |
+
|
| 417 |
+
def _card_offset_in_case(self) -> torch.Tensor:
|
| 418 |
+
"""The card origin's offset from the seated point, in the case's local frame, shape
|
| 419 |
+
(num_envs, 3). Zero means the card origin sits exactly at the seated pose."""
|
| 420 |
+
from isaaclab.utils.math import quat_apply_inverse
|
| 421 |
+
|
| 422 |
+
rel = quat_apply_inverse(
|
| 423 |
+
self.case.data.root_quat_w, self.card.data.root_pos_w - self.case.data.root_pos_w
|
| 424 |
+
)
|
| 425 |
+
return rel - torch.tensor(self.cfg.seat_pos, device=rel.device)
|
| 426 |
+
|
| 427 |
+
def _axis_cos(self, axis: int) -> torch.Tensor:
|
| 428 |
+
"""cos of the angle between the card's and the case's local `axis` (0=x: heading along the
|
| 429 |
+
slot, 2=z: insertion axis), shape (num_envs,). Seated orientation = the case's own axes."""
|
| 430 |
+
from isaaclab.utils.math import quat_apply
|
| 431 |
+
|
| 432 |
+
e = torch.zeros(3, device=self.env.device)
|
| 433 |
+
e[axis] = 1.0
|
| 434 |
+
e = e.expand(self.env.num_envs, 3)
|
| 435 |
+
case_ax = quat_apply(self.case.data.root_quat_w, e)
|
| 436 |
+
card_ax = quat_apply(self.card.data.root_quat_w, e)
|
| 437 |
+
return (card_ax * case_ax).sum(dim=-1)
|
| 438 |
+
|
| 439 |
+
# Grasp-weld contract: composed `GraspWeldContract` (robobench.core.grasp_weld),
|
| 440 |
+
# created in `bind()`; this scene supplies the part-side `grasp_sites()`.
|
| 441 |
+
# Grasp-weld contract constants — the scene's public knobs (solutions read these off the
|
| 442 |
+
# scene, e.g. `scene.GRASP_PINCH_OFFSET`); the composed GraspWeldContract consumes them.
|
| 443 |
+
GRASP_HAND_BODY: ClassVar[str] = "panda_hand"
|
| 444 |
+
GRASP_FINGER_JOINTS: ClassVar[str] = "panda_finger_joint.*"
|
| 445 |
+
GRASP_PINCH_OFFSET: ClassVar[float] = 0.1034 # hand origin -> finger-pad centre, along approach
|
| 446 |
+
GRASP_POOL: ClassVar[int] = 8 # engages per (env, site) per run; exhausted -> warn, no weld
|
| 447 |
+
GRASP_STALL: ClassVar[float] = 0.01 # max |finger vel| sum (m/s): fingers stopped ON the part
|
| 448 |
+
GRASP_DEBOUNCE: ClassVar[int] = 8 # consecutive qualifying substeps before the weld engages
|
| 449 |
+
GRASP_RELEASE_MARGIN: ClassVar[float] = 0.008 # release at window-top + this (m), hysteresis
|
| 450 |
+
|
provenance/generation_code/p02_strategy/strategy/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Base state-feedback program; 20 mm off-centre grasp plus side staging waypoint at (0.34,-0.14), then normal insertion. DART offered only during high free-space transport. Initially UNTESTED; see pilot_report.json.
|
provenance/generation_code/p02_strategy/strategy/meta.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 0,
|
| 3 |
+
"successes": 0,
|
| 4 |
+
"success_rate": null,
|
| 5 |
+
"batches": [],
|
| 6 |
+
"refreshed": "2026-10-12T10:47:21+00:00"
|
| 7 |
+
}
|
provenance/generation_code/p02_strategy/strategy/parameters.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compensate_action_filter": true,
|
| 3 |
+
"integral_position": 0.8,
|
| 4 |
+
"integral_rotation": 0.5,
|
| 5 |
+
"speed": 0.03,
|
| 6 |
+
"carry_height": 0.26,
|
| 7 |
+
"forward_clearance": -0.045,
|
| 8 |
+
"slide_height": 0.018,
|
| 9 |
+
"press_speed": 0.003
|
| 10 |
+
}
|
provenance/generation_code/p02_strategy/strategy/phases/phase_0/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
start: normal scene reset. preinsert: own physical prefix to above-case stop before recording. Suffix observes grasp transform afresh; PI integrators restart at zero. No dataset/teleport. UNTESTED.
|
provenance/generation_code/p02_strategy/strategy/phases/phase_0/meta.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 0,
|
| 3 |
+
"successes": 0,
|
| 4 |
+
"success_rate": null,
|
| 5 |
+
"batches": [],
|
| 6 |
+
"refreshed": "2026-10-12T10:47:21+00:00"
|
| 7 |
+
}
|
provenance/generation_code/p02_strategy/strategy/phases/phase_0/parameters.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compensate_action_filter": true,
|
| 3 |
+
"integral_position": 0.8,
|
| 4 |
+
"integral_rotation": 0.5,
|
| 5 |
+
"speed": 0.03,
|
| 6 |
+
"carry_height": 0.26,
|
| 7 |
+
"forward_clearance": -0.045,
|
| 8 |
+
"slide_height": 0.018,
|
| 9 |
+
"press_speed": 0.003
|
| 10 |
+
}
|
provenance/generation_code/p02_strategy/strategy/phases/phase_0/reset/preinsert.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Physical entry: run own strategy prefix before recording, never teleport."""
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
import importlib.util
|
| 4 |
+
|
| 5 |
+
def reset_0(env):
|
| 6 |
+
p=Path(__file__).resolve().parents[1]/'solve_by_phase.py'
|
| 7 |
+
spec=importlib.util.spec_from_file_location('pilot_entry_prefix',p)
|
| 8 |
+
m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
|
| 9 |
+
class CleanPrefix:
|
| 10 |
+
def __getattr__(self,n): return getattr(env,n)
|
| 11 |
+
def step(self,action,noise=None): return env.step(action)
|
| 12 |
+
m.solve(CleanPrefix(),entry='start',stop_after='above_case')
|
| 13 |
+
assert bool(env.scene.grasp_held[0].any())
|
| 14 |
+
assert not bool(env.scene.seated()[0])
|
| 15 |
+
assert float(env.scene.card.data.root_pos_w[0,2]) > float(env.scene.cfg.surface_z)+.24
|
provenance/generation_code/p02_strategy/strategy/phases/phase_0/reset/start.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Natural-start entry builder.
|
| 2 |
+
|
| 3 |
+
Rename/add files so each filename matches one solve_by_phase.ENTRIES key.
|
| 4 |
+
Each batch sweeps every reset file.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from __future__ import annotations
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def reset_0(env) -> None:
|
| 11 |
+
"""The scene reset already satisfies the natural-start precondition."""
|
| 12 |
+
return
|
provenance/generation_code/p02_strategy/strategy/phases/phase_0/solve_by_phase.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# plan: [stages 1-3] card held; card aligned above slot; card seated and released
|
| 2 |
+
# origin=fresh
|
| 3 |
+
"""A state-feedback program for the registered Franka/OSC GPU-install task.
|
| 4 |
+
|
| 5 |
+
Only env.step(action) changes the world. No dataset, checkpoint, reset, state
|
| 6 |
+
restoration, controller replacement, or scene-parameter writes are used.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
DART_SIGMA = 0.03
|
| 14 |
+
SOLVE_PARAMS = {'DART_SIGMA': None}
|
| 15 |
+
ENTRIES = {'start': 'unassembled card upright in holder, hand free',
|
| 16 |
+
'preinsert': 'card genuinely held, above front entry, clear of all contacts'}
|
| 17 |
+
|
| 18 |
+
def solve(env, entry=None, stop_after=None) -> None:
|
| 19 |
+
import torch
|
| 20 |
+
from isaaclab.utils.math import (
|
| 21 |
+
axis_angle_from_quat, quat_apply, quat_conjugate, quat_mul,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
params = json.loads(Path(__file__).with_name('parameters.json').read_text())
|
| 25 |
+
scene, robot = env.scene, env.robot
|
| 26 |
+
art = robot.articulation
|
| 27 |
+
dev, n = env.device, env.num_envs
|
| 28 |
+
assert n == 1, 'This initial phase-1 delivery handles one environment per process'
|
| 29 |
+
osc = robot.controller.controllers[0]
|
| 30 |
+
assert type(osc).__name__ == 'OperationalSpaceController'
|
| 31 |
+
assert robot.action_dim == 8
|
| 32 |
+
hand = art.body_names.index('panda_hand')
|
| 33 |
+
dt = env.dt * robot.control_period
|
| 34 |
+
offset = float(scene.GRASP_PINCH_OFFSET)
|
| 35 |
+
zero = torch.zeros(3, device=dev)
|
| 36 |
+
integral_p, integral_r = zero.clone(), zero.clone()
|
| 37 |
+
steps = 0
|
| 38 |
+
active_phase = 'start'
|
| 39 |
+
if entry not in (None, 'start', 'preinsert'): raise ValueError(entry)
|
| 40 |
+
|
| 41 |
+
def v(values): return torch.tensor(values, device=dev, dtype=torch.float32)
|
| 42 |
+
def mul(a,b): return quat_mul(a[None],b[None])[0]
|
| 43 |
+
def inv(q): return quat_conjugate(q[None])[0]
|
| 44 |
+
def rotate(q,x): return quat_apply(q[None],x[None])[0]
|
| 45 |
+
def orientation_error(goal,current):
|
| 46 |
+
if float(torch.dot(goal,current)) < 0: goal = -goal
|
| 47 |
+
return axis_angle_from_quat(mul(goal, inv(current))[None])[0]
|
| 48 |
+
def hp(): return art.data.body_pos_w[0,hand].clone()
|
| 49 |
+
def hq(): return art.data.body_quat_w[0,hand].clone()
|
| 50 |
+
def cp(): return scene.card.data.root_pos_w[0].clone()
|
| 51 |
+
def cq(): return scene.card.data.root_quat_w[0].clone()
|
| 52 |
+
def held(): return bool(scene.grasp_held[0].any())
|
| 53 |
+
def pinch(): return hp() + rotate(hq(),v([0,0,offset]))
|
| 54 |
+
def band(): return cp()+rotate(cq(),v([-.020,sum(scene.CARD_BODY_Y)/2,.1005]))
|
| 55 |
+
|
| 56 |
+
def log(phase,**extra):
|
| 57 |
+
print('PHASE1 '+json.dumps(dict(phase=phase,steps=steps,seconds=steps*dt,
|
| 58 |
+
held=held(),card=cp().tolist(),hand=hp().tolist(),
|
| 59 |
+
offset=scene._card_offset_in_case()[0].tolist(),
|
| 60 |
+
depth=float(scene.engaged()[0]),integral_position=integral_p.tolist(),
|
| 61 |
+
integral_rotation=integral_r.tolist(),**extra)),flush=True)
|
| 62 |
+
|
| 63 |
+
def tick(goal,quat,finger):
|
| 64 |
+
nonlocal integral_p, integral_r, steps
|
| 65 |
+
ep, er = goal-hp(), orientation_error(quat,hq())
|
| 66 |
+
integral_p=(integral_p+ep*dt).clamp(-.10,.10)
|
| 67 |
+
integral_r=(integral_r+er*dt).clamp(-4.0,4.0)
|
| 68 |
+
dp=ep+params['integral_position']*integral_p
|
| 69 |
+
dr=er+params['integral_rotation']*integral_r
|
| 70 |
+
dr=dr*min(1,2.5/max(float(dr.norm()),1e-9))
|
| 71 |
+
action=torch.zeros((1,8),device=dev)
|
| 72 |
+
action[0,:3]=(dp/osc.cfg.pos_scale).clamp(-6,6)
|
| 73 |
+
action[0,3:6]=(dr/osc.cfg.rot_scale).clamp(-20,20)
|
| 74 |
+
action[0,6:]=finger
|
| 75 |
+
# The preset smooths pose DELTAS, rather than absolute targets. Account
|
| 76 |
+
# for its documented filter in the command; never write controller state.
|
| 77 |
+
if params.get('compensate_action_filter',False) and osc._prev_action is not None:
|
| 78 |
+
alpha=float(osc.cfg.ema_factor)
|
| 79 |
+
action[0,:6]=(action[0,:6]-(1-alpha)*osc._prev_action[0])/alpha
|
| 80 |
+
assert torch.isfinite(action).all()
|
| 81 |
+
# Noise offered independently of noise_scale. Recorder keeps labels clean.
|
| 82 |
+
disturbance = torch.zeros_like(action)
|
| 83 |
+
if active_phase in ('lift_clear', 'transport_waypoint', 'above_case') and float(hp()[2]) > .38:
|
| 84 |
+
disturbance[0, :3] = DART_SIGMA * torch.randn(3, device=dev)
|
| 85 |
+
env.step(action, noise=disturbance)
|
| 86 |
+
steps+=1
|
| 87 |
+
|
| 88 |
+
def move(goal_fn,grip,timeout,tag,tol=.002,rot_tol=.035,card_check=None):
|
| 89 |
+
nonlocal active_phase
|
| 90 |
+
active_phase = tag
|
| 91 |
+
ref=hp(); good=0
|
| 92 |
+
for _ in range(max(1,math.ceil(timeout/dt))):
|
| 93 |
+
goal,quat=goal_fn()
|
| 94 |
+
delta=goal-ref; length=float(delta.norm())
|
| 95 |
+
ref=ref+delta*min(1,params['speed']*dt/max(length,1e-9))
|
| 96 |
+
tick(ref,quat,grip)
|
| 97 |
+
goal,quat=goal_fn()
|
| 98 |
+
ok=float((hp()-goal).norm())<tol and float(orientation_error(quat,hq()).norm())<rot_tol
|
| 99 |
+
if card_check is not None:ok=ok and card_check()
|
| 100 |
+
good=good+1 if ok else 0
|
| 101 |
+
if good>=8:log(tag,result='reached');return
|
| 102 |
+
log(tag,result='timeout',position_error=float((hp()-goal).norm()),rotation_error=float(orientation_error(quat,hq()).norm()))
|
| 103 |
+
raise RuntimeError('Stage did not reach its measured gate: '+tag)
|
| 104 |
+
|
| 105 |
+
def hold(goal_fn,finger,seconds):
|
| 106 |
+
nonlocal active_phase
|
| 107 |
+
active_phase = 'hold'
|
| 108 |
+
for _ in range(math.ceil(seconds/dt)):
|
| 109 |
+
goal,quat=goal_fn();tick(goal,quat,finger)
|
| 110 |
+
|
| 111 |
+
log('start')
|
| 112 |
+
if entry != 'preinsert':
|
| 113 |
+
# Stage 1: acquire the top band and verify a real grasp.
|
| 114 |
+
down=[mul(cq(),v([0,0,1,0])),mul(cq(),v([0,1,0,0]))]
|
| 115 |
+
pick_q=max(down,key=lambda q:abs(float(torch.dot(q,hq())))).clone()
|
| 116 |
+
def pick_goal(height=0):
|
| 117 |
+
return band()-rotate(pick_q,v([0,0,offset]))+v([0,0,height]),pick_q
|
| 118 |
+
move(lambda:pick_goal(.10),.04,18,'above_card',tol=.004,rot_tol=.05)
|
| 119 |
+
move(pick_goal,.04,16,'pinch_aligned',tol=.0025)
|
| 120 |
+
for k in range(math.ceil(2/dt)):
|
| 121 |
+
goal,quat=pick_goal()
|
| 122 |
+
tick(goal,quat,.04+(.0172-.04)*min(1,(k+1)*dt/1.5))
|
| 123 |
+
hold(pick_goal,.0172,1)
|
| 124 |
+
if not held():log('grasp_failed');raise RuntimeError('No grasp after controlled closure')
|
| 125 |
+
log('card_held')
|
| 126 |
+
elif not held():
|
| 127 |
+
raise RuntimeError('preinsert entry requires an actual grasp')
|
| 128 |
+
rel_p=rotate(inv(hq()),cp()-hp())
|
| 129 |
+
rel_q=mul(inv(hq()),cq())
|
| 130 |
+
def card_goal(position,quat):
|
| 131 |
+
# The grasp joint fixes this measured card-in-hand transform. A fixed
|
| 132 |
+
# world-frame hand goal avoids moving the goal in response to its own lag.
|
| 133 |
+
target_q=mul(quat,inv(rel_q))
|
| 134 |
+
return position-rotate(target_q,rel_p),target_q
|
| 135 |
+
def case_point(local):
|
| 136 |
+
return scene.case.data.root_pos_w[0]+rotate(scene.case.data.root_quat_w[0],v(local))
|
| 137 |
+
case_q=scene.case.data.root_quat_w[0].clone()
|
| 138 |
+
seat=list(scene.cfg.seat_pos)
|
| 139 |
+
forward=seat[0]+params['forward_clearance']
|
| 140 |
+
if entry != 'preinsert':
|
| 141 |
+
lift=cp();lift[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 142 |
+
move(lambda:card_goal(lift,case_q),.0172,25,'lift_clear',tol=.003)
|
| 143 |
+
if not held():raise RuntimeError('Grasp lost during lift')
|
| 144 |
+
|
| 145 |
+
# Different plan: side staging stop, then transfer to the case entry.
|
| 146 |
+
waypoint=cp(); waypoint[0]=.34; waypoint[1]=-.14
|
| 147 |
+
waypoint[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 148 |
+
move(lambda:card_goal(waypoint,case_q),.0172,30,'transport_waypoint',tol=.003)
|
| 149 |
+
|
| 150 |
+
# Stage 2: enter forward of the rear panel, then slide through its cutout.
|
| 151 |
+
high=[forward,seat[1],params['carry_height']-float(scene.cfg.case_lift)]
|
| 152 |
+
move(lambda:card_goal(case_point(high),case_q),.0172,40,'above_case',tol=.003)
|
| 153 |
+
if stop_after == 'above_case': return
|
| 154 |
+
above=[forward,seat[1],float(scene.cfg.slot_mouth_z)+params['slide_height']]
|
| 155 |
+
move(lambda:card_goal(case_point(above),case_q),.0172,20,'inside_case',tol=.002)
|
| 156 |
+
aligned=[seat[0],seat[1],above[2]]
|
| 157 |
+
def card_aligned():
|
| 158 |
+
return float((cp()-case_point(aligned)).norm())<.0007 and float(orientation_error(case_q,cq()).norm())<.004
|
| 159 |
+
move(lambda:card_goal(case_point(aligned),case_q),.0172,30,'slot_aligned',tol=.0004,rot_tol=.003,card_check=card_aligned)
|
| 160 |
+
|
| 161 |
+
# Stage 3: press, release, retract, then leave the installed card unsupported.
|
| 162 |
+
pressed=[seat[0],seat[1],seat[2]-.001]
|
| 163 |
+
active_phase='press'
|
| 164 |
+
press_z=aligned[2]
|
| 165 |
+
for _ in range(math.ceil(25/dt)):
|
| 166 |
+
press_z=max(pressed[2],press_z-params['press_speed']*dt)
|
| 167 |
+
target,quat=card_goal(case_point([seat[0],seat[1],press_z]),case_q)
|
| 168 |
+
tick(target,quat,.0172)
|
| 169 |
+
if bool(scene.seated()[0]):break
|
| 170 |
+
if not bool(scene.seated()[0]):log('press_failed');raise RuntimeError('Card did not seat')
|
| 171 |
+
log('seated_before_release')
|
| 172 |
+
keep=hp(); keep_q=hq()
|
| 173 |
+
hold(lambda:(keep,keep_q),.04,2)
|
| 174 |
+
up=keep+v([0,0,.14])
|
| 175 |
+
move(lambda:(up,keep_q),.04,16,'hand_clear',tol=.004,rot_tol=.06)
|
| 176 |
+
hold(lambda:(up,keep_q),.04,5)
|
| 177 |
+
log('finished',seated=bool(scene.seated()[0]))
|
| 178 |
+
if held() or not bool(scene.seated()[0]):raise RuntimeError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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# plan: [stages 1-3] card held; card aligned above slot; card seated and released
|
| 2 |
+
# origin=fresh
|
| 3 |
+
"""A state-feedback program for the registered Franka/OSC GPU-install task.
|
| 4 |
+
|
| 5 |
+
Only env.step(action) changes the world. No dataset, checkpoint, reset, state
|
| 6 |
+
restoration, controller replacement, or scene-parameter writes are used.
|
| 7 |
+
"""
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
DART_SIGMA = 0.03
|
| 14 |
+
SOLVE_PARAMS = {'DART_SIGMA': None}
|
| 15 |
+
ENTRIES = {'start': 'unassembled card upright in holder, hand free',
|
| 16 |
+
'preinsert': 'card genuinely held, above front entry, clear of all contacts'}
|
| 17 |
+
|
| 18 |
+
def solve(env, entry=None, stop_after=None) -> None:
|
| 19 |
+
import torch
|
| 20 |
+
from isaaclab.utils.math import (
|
| 21 |
+
axis_angle_from_quat, quat_apply, quat_conjugate, quat_mul,
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
params = json.loads(Path(__file__).with_name('parameters.json').read_text())
|
| 25 |
+
scene, robot = env.scene, env.robot
|
| 26 |
+
art = robot.articulation
|
| 27 |
+
dev, n = env.device, env.num_envs
|
| 28 |
+
assert n == 1, 'This initial phase-1 delivery handles one environment per process'
|
| 29 |
+
osc = robot.controller.controllers[0]
|
| 30 |
+
assert type(osc).__name__ == 'OperationalSpaceController'
|
| 31 |
+
assert robot.action_dim == 8
|
| 32 |
+
hand = art.body_names.index('panda_hand')
|
| 33 |
+
dt = env.dt * robot.control_period
|
| 34 |
+
offset = float(scene.GRASP_PINCH_OFFSET)
|
| 35 |
+
zero = torch.zeros(3, device=dev)
|
| 36 |
+
integral_p, integral_r = zero.clone(), zero.clone()
|
| 37 |
+
steps = 0
|
| 38 |
+
active_phase = 'start'
|
| 39 |
+
if entry not in (None, 'start', 'preinsert'): raise ValueError(entry)
|
| 40 |
+
|
| 41 |
+
def v(values): return torch.tensor(values, device=dev, dtype=torch.float32)
|
| 42 |
+
def mul(a,b): return quat_mul(a[None],b[None])[0]
|
| 43 |
+
def inv(q): return quat_conjugate(q[None])[0]
|
| 44 |
+
def rotate(q,x): return quat_apply(q[None],x[None])[0]
|
| 45 |
+
def orientation_error(goal,current):
|
| 46 |
+
if float(torch.dot(goal,current)) < 0: goal = -goal
|
| 47 |
+
return axis_angle_from_quat(mul(goal, inv(current))[None])[0]
|
| 48 |
+
def hp(): return art.data.body_pos_w[0,hand].clone()
|
| 49 |
+
def hq(): return art.data.body_quat_w[0,hand].clone()
|
| 50 |
+
def cp(): return scene.card.data.root_pos_w[0].clone()
|
| 51 |
+
def cq(): return scene.card.data.root_quat_w[0].clone()
|
| 52 |
+
def held(): return bool(scene.grasp_held[0].any())
|
| 53 |
+
def pinch(): return hp() + rotate(hq(),v([0,0,offset]))
|
| 54 |
+
def band(): return cp()+rotate(cq(),v([-.020,sum(scene.CARD_BODY_Y)/2,.1005]))
|
| 55 |
+
|
| 56 |
+
def log(phase,**extra):
|
| 57 |
+
print('PHASE1 '+json.dumps(dict(phase=phase,steps=steps,seconds=steps*dt,
|
| 58 |
+
held=held(),card=cp().tolist(),hand=hp().tolist(),
|
| 59 |
+
offset=scene._card_offset_in_case()[0].tolist(),
|
| 60 |
+
depth=float(scene.engaged()[0]),integral_position=integral_p.tolist(),
|
| 61 |
+
integral_rotation=integral_r.tolist(),**extra)),flush=True)
|
| 62 |
+
|
| 63 |
+
def tick(goal,quat,finger):
|
| 64 |
+
nonlocal integral_p, integral_r, steps
|
| 65 |
+
ep, er = goal-hp(), orientation_error(quat,hq())
|
| 66 |
+
integral_p=(integral_p+ep*dt).clamp(-.10,.10)
|
| 67 |
+
integral_r=(integral_r+er*dt).clamp(-4.0,4.0)
|
| 68 |
+
dp=ep+params['integral_position']*integral_p
|
| 69 |
+
dr=er+params['integral_rotation']*integral_r
|
| 70 |
+
dr=dr*min(1,2.5/max(float(dr.norm()),1e-9))
|
| 71 |
+
action=torch.zeros((1,8),device=dev)
|
| 72 |
+
action[0,:3]=(dp/osc.cfg.pos_scale).clamp(-6,6)
|
| 73 |
+
action[0,3:6]=(dr/osc.cfg.rot_scale).clamp(-20,20)
|
| 74 |
+
action[0,6:]=finger
|
| 75 |
+
# The preset smooths pose DELTAS, rather than absolute targets. Account
|
| 76 |
+
# for its documented filter in the command; never write controller state.
|
| 77 |
+
if params.get('compensate_action_filter',False) and osc._prev_action is not None:
|
| 78 |
+
alpha=float(osc.cfg.ema_factor)
|
| 79 |
+
action[0,:6]=(action[0,:6]-(1-alpha)*osc._prev_action[0])/alpha
|
| 80 |
+
assert torch.isfinite(action).all()
|
| 81 |
+
# Noise offered independently of noise_scale. Recorder keeps labels clean.
|
| 82 |
+
disturbance = torch.zeros_like(action)
|
| 83 |
+
if active_phase in ('lift_clear', 'transport_waypoint', 'above_case') and float(hp()[2]) > .38:
|
| 84 |
+
disturbance[0, :3] = DART_SIGMA * torch.randn(3, device=dev)
|
| 85 |
+
env.step(action, noise=disturbance)
|
| 86 |
+
steps+=1
|
| 87 |
+
|
| 88 |
+
def move(goal_fn,grip,timeout,tag,tol=.002,rot_tol=.035,card_check=None):
|
| 89 |
+
nonlocal active_phase
|
| 90 |
+
active_phase = tag
|
| 91 |
+
ref=hp(); good=0
|
| 92 |
+
for _ in range(max(1,math.ceil(timeout/dt))):
|
| 93 |
+
goal,quat=goal_fn()
|
| 94 |
+
delta=goal-ref; length=float(delta.norm())
|
| 95 |
+
ref=ref+delta*min(1,params['speed']*dt/max(length,1e-9))
|
| 96 |
+
tick(ref,quat,grip)
|
| 97 |
+
goal,quat=goal_fn()
|
| 98 |
+
ok=float((hp()-goal).norm())<tol and float(orientation_error(quat,hq()).norm())<rot_tol
|
| 99 |
+
if card_check is not None:ok=ok and card_check()
|
| 100 |
+
good=good+1 if ok else 0
|
| 101 |
+
if good>=8:log(tag,result='reached');return
|
| 102 |
+
log(tag,result='timeout',position_error=float((hp()-goal).norm()),rotation_error=float(orientation_error(quat,hq()).norm()))
|
| 103 |
+
raise RuntimeError('Stage did not reach its measured gate: '+tag)
|
| 104 |
+
|
| 105 |
+
def hold(goal_fn,finger,seconds):
|
| 106 |
+
nonlocal active_phase
|
| 107 |
+
active_phase = 'hold'
|
| 108 |
+
for _ in range(math.ceil(seconds/dt)):
|
| 109 |
+
goal,quat=goal_fn();tick(goal,quat,finger)
|
| 110 |
+
|
| 111 |
+
log('start')
|
| 112 |
+
if entry != 'preinsert':
|
| 113 |
+
# Stage 1: acquire the top band and verify a real grasp.
|
| 114 |
+
down=[mul(cq(),v([0,0,1,0])),mul(cq(),v([0,1,0,0]))]
|
| 115 |
+
pick_q=max(down,key=lambda q:abs(float(torch.dot(q,hq())))).clone()
|
| 116 |
+
def pick_goal(height=0):
|
| 117 |
+
return band()-rotate(pick_q,v([0,0,offset]))+v([0,0,height]),pick_q
|
| 118 |
+
move(lambda:pick_goal(.10),.04,18,'above_card',tol=.004,rot_tol=.05)
|
| 119 |
+
move(pick_goal,.04,16,'pinch_aligned',tol=.0025)
|
| 120 |
+
for k in range(math.ceil(2/dt)):
|
| 121 |
+
goal,quat=pick_goal()
|
| 122 |
+
tick(goal,quat,.04+(.0172-.04)*min(1,(k+1)*dt/1.5))
|
| 123 |
+
hold(pick_goal,.0172,1)
|
| 124 |
+
if not held():log('grasp_failed');raise RuntimeError('No grasp after controlled closure')
|
| 125 |
+
log('card_held')
|
| 126 |
+
elif not held():
|
| 127 |
+
raise RuntimeError('preinsert entry requires an actual grasp')
|
| 128 |
+
rel_p=rotate(inv(hq()),cp()-hp())
|
| 129 |
+
rel_q=mul(inv(hq()),cq())
|
| 130 |
+
def card_goal(position,quat):
|
| 131 |
+
# The grasp joint fixes this measured card-in-hand transform. A fixed
|
| 132 |
+
# world-frame hand goal avoids moving the goal in response to its own lag.
|
| 133 |
+
target_q=mul(quat,inv(rel_q))
|
| 134 |
+
return position-rotate(target_q,rel_p),target_q
|
| 135 |
+
def case_point(local):
|
| 136 |
+
return scene.case.data.root_pos_w[0]+rotate(scene.case.data.root_quat_w[0],v(local))
|
| 137 |
+
case_q=scene.case.data.root_quat_w[0].clone()
|
| 138 |
+
seat=list(scene.cfg.seat_pos)
|
| 139 |
+
forward=seat[0]+params['forward_clearance']
|
| 140 |
+
if entry != 'preinsert':
|
| 141 |
+
lift=cp();lift[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 142 |
+
move(lambda:card_goal(lift,case_q),.0172,25,'lift_clear',tol=.003)
|
| 143 |
+
if not held():raise RuntimeError('Grasp lost during lift')
|
| 144 |
+
|
| 145 |
+
# Different plan: side staging stop, then transfer to the case entry.
|
| 146 |
+
waypoint=cp(); waypoint[0]=.34; waypoint[1]=-.14
|
| 147 |
+
waypoint[2]=float(scene.cfg.surface_z)+params['carry_height']
|
| 148 |
+
move(lambda:card_goal(waypoint,case_q),.0172,30,'transport_waypoint',tol=.003)
|
| 149 |
+
|
| 150 |
+
# Stage 2: enter forward of the rear panel, then slide through its cutout.
|
| 151 |
+
high=[forward,seat[1],params['carry_height']-float(scene.cfg.case_lift)]
|
| 152 |
+
move(lambda:card_goal(case_point(high),case_q),.0172,40,'above_case',tol=.003)
|
| 153 |
+
if stop_after == 'above_case': return
|
| 154 |
+
above=[forward,seat[1],float(scene.cfg.slot_mouth_z)+params['slide_height']]
|
| 155 |
+
move(lambda:card_goal(case_point(above),case_q),.0172,20,'inside_case',tol=.002)
|
| 156 |
+
aligned=[seat[0],seat[1],above[2]]
|
| 157 |
+
def card_aligned():
|
| 158 |
+
return float((cp()-case_point(aligned)).norm())<.0007 and float(orientation_error(case_q,cq()).norm())<.004
|
| 159 |
+
move(lambda:card_goal(case_point(aligned),case_q),.0172,30,'slot_aligned',tol=.0004,rot_tol=.003,card_check=card_aligned)
|
| 160 |
+
|
| 161 |
+
# Stage 3: press, release, retract, then leave the installed card unsupported.
|
| 162 |
+
pressed=[seat[0],seat[1],seat[2]-.001]
|
| 163 |
+
active_phase='press'
|
| 164 |
+
press_z=aligned[2]
|
| 165 |
+
for _ in range(math.ceil(25/dt)):
|
| 166 |
+
press_z=max(pressed[2],press_z-params['press_speed']*dt)
|
| 167 |
+
target,quat=card_goal(case_point([seat[0],seat[1],press_z]),case_q)
|
| 168 |
+
tick(target,quat,.0172)
|
| 169 |
+
if bool(scene.seated()[0]):break
|
| 170 |
+
if not bool(scene.seated()[0]):log('press_failed');raise RuntimeError('Card did not seat')
|
| 171 |
+
log('seated_before_release')
|
| 172 |
+
keep=hp(); keep_q=hq()
|
| 173 |
+
hold(lambda:(keep,keep_q),.04,2)
|
| 174 |
+
up=keep+v([0,0,.14])
|
| 175 |
+
move(lambda:(up,keep_q),.04,16,'hand_clear',tol=.004,rot_tol=.06)
|
| 176 |
+
hold(lambda:(up,keep_q),.04,5)
|
| 177 |
+
log('finished',seated=bool(scene.seated()[0]))
|
| 178 |
+
if held() or not bool(scene.seated()[0]):raise RuntimeError('Card did not remain seated after release')
|
provenance/generation_code/p03_dynamics/grader.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Grader for the pc_gpu scene: the graphics card seated in the PCIe x16 slot.
|
| 2 |
+
|
| 3 |
+
Rubric stages (weights and modes live in RUBRIC):
|
| 4 |
+
grasped the card has been taken in the weld-on-closure grip (`scene.grasp_held`) — the
|
| 5 |
+
scene's own grasp state; a milestone, latched. Also true once the card is
|
| 6 |
+
aligned in the slot (a card in the slot was necessarily carried there), so the
|
| 7 |
+
rung nests under `aligned`. Under an embodiment with no gripper (the weld
|
| 8 |
+
contract disabled, e.g. robot="null") the grasp state does not exist and the
|
| 9 |
+
rung reads from that implication alone
|
| 10 |
+
aligned the card lined up on the slot — origin within `align_xy` of the seated point,
|
| 11 |
+
up axis within `align_axis_deg` of the slot axis, length axis within
|
| 12 |
+
`align_yaw_deg` of the slot heading: the scene's own three non-depth seat gates
|
| 13 |
+
pressed tab depth below the slot mouth (`slot_mouth_z`, the scene's own `engaged()`)
|
| 14 |
+
as a fraction of `seat_depth`, counted only while aligned — so it is 1.0 iff
|
| 15 |
+
the scene calls the card seated
|
| 16 |
+
Every stage is per env. The rungs nest (seated => aligned => grasped), so progress reaches
|
| 17 |
+
1.0 exactly when the card is seated, and for a grader built after the pick as well as one
|
| 18 |
+
that watched it. The rear-panel pass-through is NOT a rung: the cutout's geometry is not in
|
| 19 |
+
the scene cfg, so it cannot be read from state without an invented tolerance. Success is
|
| 20 |
+
the scene's `seated()` per env — depth, xy, tilt AND heading gates — read when the
|
| 21 |
+
delivery finishes.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
|
| 28 |
+
from robobench.core import BaseGrader
|
| 29 |
+
# baked by data_engine init: grade against the LOCAL scene copy (../scene/scene.py),
|
| 30 |
+
# exec'd at most once per process under a fixed module key.
|
| 31 |
+
import importlib.util as _ilu
|
| 32 |
+
import sys as _sys
|
| 33 |
+
from pathlib import Path as _Path
|
| 34 |
+
|
| 35 |
+
if "datagen_local_scene" not in _sys.modules:
|
| 36 |
+
import robobench as _rb
|
| 37 |
+
_rb.discover()
|
| 38 |
+
_p = _Path(__file__).resolve().parent.parent / "scene" / "scene.py"
|
| 39 |
+
_spec = _ilu.spec_from_file_location("datagen_local_scene", _p)
|
| 40 |
+
_m = _ilu.module_from_spec(_spec)
|
| 41 |
+
_sys.modules["datagen_local_scene"] = _m
|
| 42 |
+
_spec.loader.exec_module(_m)
|
| 43 |
+
PcGpuAssemblyScene = _sys.modules["datagen_local_scene"].PcGpuAssemblyScene
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class PcGpuAssemblyGrader(BaseGrader):
|
| 47 |
+
"""The card seated in its slot — pressed to depth, centred, upright, heading along the slot.
|
| 48 |
+
|
| 49 |
+
Ladder: grasped 0.33 · aligned 0.67 · pressed 1.00 — three equal rungs for the three
|
| 50 |
+
steps of the task (take the card, line it up on the slot, press it home); the last rung
|
| 51 |
+
is a linear ramp of tab depth from the slot mouth (`slot_mouth_z`) to `seat_depth`.
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
SCENE = PcGpuAssemblyScene
|
| 55 |
+
RUBRIC = (("grasped", 1, "once"), ("aligned", 1), ("pressed", 1))
|
| 56 |
+
scene: PcGpuAssemblyScene
|
| 57 |
+
|
| 58 |
+
def setup(self) -> None:
|
| 59 |
+
import torch
|
| 60 |
+
|
| 61 |
+
# `grasp_held` exists only while the weld contract is live (a gripper on the stage).
|
| 62 |
+
self._has_grasp = hasattr(self.scene, "grasp_held")
|
| 63 |
+
self._grasped = torch.zeros(self.num_envs, dtype=torch.bool,
|
| 64 |
+
device=self.scene.engaged().device) # latch: card ever held
|
| 65 |
+
|
| 66 |
+
def check_success(self):
|
| 67 |
+
return self.scene.seated() # (num_envs,)
|
| 68 |
+
|
| 69 |
+
def _aligned(self):
|
| 70 |
+
"""(num_envs,) bool: the scene's xy + tilt + heading seat gates, without depth."""
|
| 71 |
+
c = self.scene.cfg
|
| 72 |
+
rel = self.scene._card_offset_in_case() # (n, 3), zero at the seated pose — privileged
|
| 73 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 74 |
+
up_ok = self.scene._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 75 |
+
yaw_ok = self.scene._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 76 |
+
return xy_ok & up_ok & yaw_ok
|
| 77 |
+
|
| 78 |
+
# ---- rubric stages — each returns a (num_envs,) value in [0, 1] ---------------------
|
| 79 |
+
def grasped(self):
|
| 80 |
+
if self._has_grasp:
|
| 81 |
+
self._grasped |= self.scene.grasp_held.any(dim=1)
|
| 82 |
+
return (self._grasped | self._aligned()).float()
|
| 83 |
+
|
| 84 |
+
def aligned(self):
|
| 85 |
+
return self._aligned().float()
|
| 86 |
+
|
| 87 |
+
def pressed(self):
|
| 88 |
+
depth = self.scene.engaged() # (n,) tab depth below the slot mouth (m)
|
| 89 |
+
return self._aligned() * (depth / self.scene.cfg.seat_depth).clamp(0.0, 1.0)
|
provenance/generation_code/p03_dynamics/scene.py
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""PcGpuAssemblyScene — insert a graphics card into the PC's PCIe slot.
|
| 2 |
+
|
| 3 |
+
The same gaming-PC case as `pc_motherboard` lies on its side on the table, opening up, motherboard
|
| 4 |
+
facing the ceiling — but here the board's PCIe area is the work site. Beside the case lies a loose
|
| 5 |
+
RTX 2060 (extracted from the PC model as its own rigid body, backplate down). Goal (carried here,
|
| 6 |
+
no task layer): stand the card upright over the primary x16 slot, line its PCB edge up with the
|
| 7 |
+
slot, and press it straight down until it seats.
|
| 8 |
+
|
| 9 |
+
The case is one kinematic body that never moves — the PC model stays visual-only; its physics is
|
| 10 |
+
an invisible fixture inside the case body: a channel whose walls grip the card's 4 mm PCB tab at
|
| 11 |
+
0.15 mm/side (flaring to a 1.2 mm/side funnel mouth — idealizing the real slot's spring
|
| 12 |
+
contacts, and capping the unscrewed card's gravity roll at ~2 deg), a floor whose top is the
|
| 13 |
+
model's own seated tab height, end stops (~1.6 mm play), a flush board plate so a dropped card
|
| 14 |
+
rests on the board face, and a REAR I/O PANEL frame around the expansion-slot cutout — so the
|
| 15 |
+
card must be placed inside the case, slid rearward until its bracket/ports pass through the
|
| 16 |
+
opening, and only then pressed down (a straight vertical drop is physically blocked by the
|
| 17 |
+
panel above the cutout, exactly like a real build). The card's origin is its
|
| 18 |
+
PCB-tab bottom CENTRE with axes equal to the case's, so the seated pose is just `seat_pos` +
|
| 19 |
+
identity orientation in the case frame, and insertion depth is a z difference.
|
| 20 |
+
|
| 21 |
+
Heavy imports (isaaclab, pxr) are deferred so importing this module stays app-free.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import math
|
| 27 |
+
from dataclasses import dataclass
|
| 28 |
+
from pathlib import Path
|
| 29 |
+
from robobench.core.assets import asset_path
|
| 30 |
+
from typing import TYPE_CHECKING, Any, ClassVar
|
| 31 |
+
|
| 32 |
+
import torch
|
| 33 |
+
|
| 34 |
+
from robobench.core import GraspWeldContract, SCENES, BaseCfg, BaseScene, SimCfg
|
| 35 |
+
|
| 36 |
+
if TYPE_CHECKING:
|
| 37 |
+
from isaaclab.assets import RigidObject
|
| 38 |
+
|
| 39 |
+
from robobench.core import BaseEnv
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
@dataclass
|
| 43 |
+
class PcGpuAssemblySceneCfg(BaseCfg):
|
| 44 |
+
"""Config for `PcGpuAssemblyScene`. Nothing is locked — a variant is just a copy with a few
|
| 45 |
+
fields changed."""
|
| 46 |
+
|
| 47 |
+
# --- the curriculum / difficulty dials -----------------------------------------------
|
| 48 |
+
# The card is "seated" when — in the case's frame — its tab is >= `seat_depth` below the slot
|
| 49 |
+
# mouth, its origin is within `align_xy` of the seated point, and its axes are within
|
| 50 |
+
# `align_axis_deg` (tilt) / `align_yaw_deg` (heading along the slot) of the case's. The full
|
| 51 |
+
# stroke from the slot mouth to the channel floor is 5 mm, so 4 mm separates "seated" from
|
| 52 |
+
# "merely resting in the mouth".
|
| 53 |
+
seat_depth: float = 0.004 # min tab depth below the slot mouth (m) to count as seated
|
| 54 |
+
align_xy: float = 0.003 # max distance (m) of the card origin from the seated point
|
| 55 |
+
align_axis_deg: float = 3.0 # max tilt of the card's up axis off the slot axis (deg)
|
| 56 |
+
align_yaw_deg: float = 3.0 # max heading error of the card's length axis (deg)
|
| 57 |
+
reset_pos_jitter: float = 0.01 # uniform +/- xy jitter for the loose card at reset (m)
|
| 58 |
+
# Part friction (static = dynamic), set on every shape at bind. The moving card runs moderately
|
| 59 |
+
# slick against a grippier fixed case, so it slides down the channel but holds seat.
|
| 60 |
+
card_friction: float = 0.3
|
| 61 |
+
case_friction: float = 0.75
|
| 62 |
+
# Weld-on-closure grasping (the benchmark's auto-weld contract, PhysX
|
| 63 |
+
# form — the grasp-weld machinery at the end of this scene class):
|
| 64 |
+
# close the fingers squarely across the card's body slab near its top edge and the card welds
|
| 65 |
+
# to the hand; open wide to release. Gripper envs only (no-op under robot="null").
|
| 66 |
+
grasp_weld: bool = True
|
| 67 |
+
grasp_weld_dist: float = 0.010 # pinch-point-to-grip-band engage radius (m)
|
| 68 |
+
|
| 69 |
+
pilot_jitter_x: float = 0.004
|
| 70 |
+
pilot_jitter_y: float = 0.0007
|
| 71 |
+
|
| 72 |
+
# --- structure, reset layout, masses, asset paths (fixed) -------------------------------
|
| 73 |
+
# Seated card origin (its PCB-tab bottom centre) in the case's local frame; orientation seated
|
| 74 |
+
# = the case's own axes (identity). Baked into the committed USDs (keep in sync if they change).
|
| 75 |
+
seat_pos: tuple[float, float, float] = (-0.01595, 0.0293, 0.0035)
|
| 76 |
+
slot_mouth_z: float = 0.0085 # slot top in the case frame: depth datum (5 mm at full seat)
|
| 77 |
+
board_top: float = 0.0 # board face height in the case frame (the asset's own origin)
|
| 78 |
+
case_lift: float = 0.0289 # board face above the side panel the case lies on
|
| 79 |
+
card_mass: float = 1.0 # dual-fan RTX 2060 (kg)
|
| 80 |
+
light_intensity: float = 2500.0
|
| 81 |
+
# Loose card start pose: lying backplate-down on the table beside the case (+x side; the case
|
| 82 |
+
# spans x < 0.13 and the lying card's tail reaches origin_x - 0.132).
|
| 83 |
+
card_init_xy: tuple[float, float] = (0.28, 0.0) # card start xy (table-rel.)
|
| 84 |
+
card_init_z: float = 0.0022 # origin height lying backplate-down (backplate plane -2 mm)
|
| 85 |
+
card_init_quat: tuple[float, float, float, float] = (0.70711, 0.70711, 0.0, 0.0) # flat
|
| 86 |
+
card_contact_offset: float = 0.0001 # well below the 0.15 mm/side channel grip
|
| 87 |
+
case_contact_offset: float = 0.0001 # ditto for the slot fixture's walls
|
| 88 |
+
# Optional foam holder (a floor pad + two rails flanking the card's 36 mm body slab) that
|
| 89 |
+
# presents the card UPRIGHT for a parallel-jaw grasp. The lying default is ungraspable by a
|
| 90 |
+
# Franka gripper: flat on its backplate the card's only sub-80 mm dimension (the 36 mm body
|
| 91 |
+
# thickness) points UP, so no top-down or side pinch can straddle it. Enable together with an
|
| 92 |
+
# upright `card_init_quat` (identity = the seated orientation) and `card_init_z` = the
|
| 93 |
+
# holder's floor top; the rails cap the free card's lean at ~3 deg and the pick pulls
|
| 94 |
+
# straight up out of them.
|
| 95 |
+
card_stand: bool = False
|
| 96 |
+
card_stand_gap: float = 0.0025 # rail clearance per side around the body slab (m)
|
| 97 |
+
# Selectable work surface (same presets as the sibling scenes).
|
| 98 |
+
table: str = "lab_table" # which work surface: "lab_table" | "packing"
|
| 99 |
+
surface_z: float | None = None # table-top height (m); None -> the preset's
|
| 100 |
+
workbench_pos: tuple[float, float] | None = None # xy the table sits at; None -> preset
|
| 101 |
+
workbench_usd: str = "" # empty -> the preset's vendored USD
|
| 102 |
+
TABLES: ClassVar[dict[str, dict[str, Any]]] = {
|
| 103 |
+
"lab_table": {"usd": ("lab_table", "table_instanceable.usd"), "scale": 1.0,
|
| 104 |
+
"orient": (0.70711, 0.0, 0.0, 0.70711), "surface_z": 0.0, "pos": (0.5, 0.0),
|
| 105 |
+
"top_offset": 0.0, "height": 1.05, "kinematic": False},
|
| 106 |
+
"packing": {"usd": ("packing_table", "SM_HeavyDutyPackingTable_C02_01_physics.usd"), "scale": 0.01,
|
| 107 |
+
"orient": (1.0, 0.0, 0.0, 0.0), "surface_z": 0.994, "pos": (0.0, 0.0),
|
| 108 |
+
"top_offset": 0.994, "height": 0.994, "kinematic": True},
|
| 109 |
+
}
|
| 110 |
+
# Asset USDs; empty -> the prebuilt assets committed under `assets/`.
|
| 111 |
+
asset_dir: str = ""
|
| 112 |
+
case_usd: str = ""
|
| 113 |
+
card_usd: str = ""
|
| 114 |
+
|
| 115 |
+
def __post_init__(self) -> None:
|
| 116 |
+
assets = asset_path(Path(__file__).resolve().parents[1] / "assets")
|
| 117 |
+
self.asset_dir = self.asset_dir or str(assets)
|
| 118 |
+
self.case_usd = self.case_usd or str(Path(self.asset_dir) / "pc" / "pc_case_gpu_assembly_mb.usd")
|
| 119 |
+
self.card_usd = self.card_usd or str(Path(self.asset_dir) / "pc" / "gpu_rtx2060.usd")
|
| 120 |
+
preset = self.TABLES[self.table]
|
| 121 |
+
if self.surface_z is None:
|
| 122 |
+
self.surface_z = preset["surface_z"]
|
| 123 |
+
if self.workbench_pos is None:
|
| 124 |
+
self.workbench_pos = preset["pos"]
|
| 125 |
+
self.workbench_usd = self.workbench_usd or str(assets / "props" / preset["usd"][0] / preset["usd"][1])
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
@SCENES.register("pc_gpu_local")
|
| 129 |
+
class PcGpuAssemblyScene(BaseScene):
|
| 130 |
+
cfg: PcGpuAssemblySceneCfg
|
| 131 |
+
|
| 132 |
+
# Object physics remains nominal in this pilot; L4 uses the recorded noise channel.
|
| 133 |
+
PHYSICAL_PARAMS = {'card_mass': None, 'card_friction': None, 'case_friction': None}
|
| 134 |
+
VISUAL_PARAMS = {'light_intensity': {'dist': 'choice', 'options': [1600., 2500., 3400.]}}
|
| 135 |
+
CAMERAS = {'front': {'eye': (-.1, -1.06, 1.282), 'target': (.42, -.08, .06),
|
| 136 |
+
'focal': 16., 'bands': {
|
| 137 |
+
'eye_x': {'dist': 'uniform', 'lo': -.125, 'hi': -.075},
|
| 138 |
+
'eye_y': {'dist': 'uniform', 'lo': -1.085, 'hi': -1.035},
|
| 139 |
+
'target_x': {'dist': 'uniform', 'lo': .405, 'hi': .435}}}}
|
| 140 |
+
|
| 141 |
+
def apply_visual_params(self, env, values):
|
| 142 |
+
# Render-only light; never touches geometry, contact, or robot control.
|
| 143 |
+
from pxr import UsdLux
|
| 144 |
+
if 'light_intensity' in values:
|
| 145 |
+
prim = env.sim.stage.GetPrimAtPath('/World/light')
|
| 146 |
+
UsdLux.LightAPI(prim).GetIntensityAttr().Set(float(values['light_intensity']))
|
| 147 |
+
|
| 148 |
+
# Card-local y extent of the body collision slab (from gpu_rtx2060.usd `/gpu/collision/body`:
|
| 149 |
+
# backplate plane -2 mm, fan-shroud plane +32.8 mm around the PCB-tab-centre origin — the
|
| 150 |
+
# collider is trimmed to the VISUAL shell). The stand's rails flank THESE faces — the same
|
| 151 |
+
# pair a parallel-jaw grasp pinches.
|
| 152 |
+
CARD_BODY_Y: ClassVar[tuple[float, float]] = (-0.002, 0.0328)
|
| 153 |
+
|
| 154 |
+
def __init__(self, cfg: PcGpuAssemblySceneCfg | None = None) -> None:
|
| 155 |
+
super().__init__(cfg or PcGpuAssemblySceneCfg())
|
| 156 |
+
|
| 157 |
+
# ----- assets -------------------------------------------------------------------------------
|
| 158 |
+
def assets(self) -> dict[str, Any]:
|
| 159 |
+
"""Floor, dome light, table, the PC case lying on it (kinematic, with the invisible slot
|
| 160 |
+
fixture), and one loose graphics card. The card loads with the high solver-iteration count
|
| 161 |
+
the snug channel needs."""
|
| 162 |
+
import isaaclab.sim as sim_utils
|
| 163 |
+
from isaaclab.assets import AssetBaseCfg, RigidObjectCfg
|
| 164 |
+
|
| 165 |
+
c = self.cfg
|
| 166 |
+
for usd in (c.case_usd, c.card_usd):
|
| 167 |
+
if not Path(usd).is_file():
|
| 168 |
+
raise FileNotFoundError(
|
| 169 |
+
f"{usd} not found — the pc-gpu assets ship with the repo under "
|
| 170 |
+
f"`suites/assembly/assets/`"
|
| 171 |
+
)
|
| 172 |
+
preset = c.TABLES[c.table]
|
| 173 |
+
wx, wy = c.workbench_pos
|
| 174 |
+
table_z = c.surface_z - preset["top_offset"]
|
| 175 |
+
ground_z = c.surface_z - preset["height"]
|
| 176 |
+
table_spawn = sim_utils.UsdFileCfg(usd_path=c.workbench_usd, scale=(preset["scale"],) * 3)
|
| 177 |
+
if preset["kinematic"]:
|
| 178 |
+
table_spawn.rigid_props = sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True)
|
| 179 |
+
|
| 180 |
+
cx, cy = c.card_init_xy
|
| 181 |
+
assets: dict[str, Any] = {
|
| 182 |
+
"ground": AssetBaseCfg(
|
| 183 |
+
prim_path="/World/ground",
|
| 184 |
+
spawn=sim_utils.GroundPlaneCfg(usd_path=str(
|
| 185 |
+
asset_path(Path(__file__).resolve().parents[1] / "assets") / "props" / "ground" / "default_ground.usd")),
|
| 186 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, ground_z)),
|
| 187 |
+
),
|
| 188 |
+
"light": AssetBaseCfg(
|
| 189 |
+
prim_path="/World/light",
|
| 190 |
+
spawn=sim_utils.DomeLightCfg(intensity=c.light_intensity, color=(0.9, 0.9, 0.9)),
|
| 191 |
+
),
|
| 192 |
+
"workbench": AssetBaseCfg(
|
| 193 |
+
prim_path="{ENV_REGEX_NS}/Table",
|
| 194 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(wx, wy, table_z), rot=preset["orient"]),
|
| 195 |
+
spawn=table_spawn,
|
| 196 |
+
),
|
| 197 |
+
# The case: kinematic; the invisible fixture inside it (slot channel + rear-panel
|
| 198 |
+
# cutout frame) is what the card mates with. Fixture contact offsets are set here
|
| 199 |
+
# (not just authored in the asset) so the 0.15 mm/side channel grip never fights
|
| 200 |
+
# speculative contacts.
|
| 201 |
+
"case": RigidObjectCfg(
|
| 202 |
+
prim_path="{ENV_REGEX_NS}/Case",
|
| 203 |
+
spawn=sim_utils.UsdFileCfg(
|
| 204 |
+
usd_path=c.case_usd,
|
| 205 |
+
activate_contact_sensors=True,
|
| 206 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 207 |
+
contact_offset=c.case_contact_offset, rest_offset=0.0
|
| 208 |
+
),
|
| 209 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(kinematic_enabled=True),
|
| 210 |
+
),
|
| 211 |
+
init_state=RigidObjectCfg.InitialStateCfg(pos=(wx, wy, c.surface_z + c.case_lift)),
|
| 212 |
+
),
|
| 213 |
+
# Card contact offset must stay well below the channel grip (0.15 mm/side) or
|
| 214 |
+
# speculative contacts choke the fit.
|
| 215 |
+
"card": RigidObjectCfg(
|
| 216 |
+
prim_path="{ENV_REGEX_NS}/Card",
|
| 217 |
+
spawn=sim_utils.UsdFileCfg(
|
| 218 |
+
usd_path=c.card_usd,
|
| 219 |
+
activate_contact_sensors=True,
|
| 220 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 221 |
+
contact_offset=c.card_contact_offset, rest_offset=0.0
|
| 222 |
+
),
|
| 223 |
+
rigid_props=sim_utils.RigidBodyPropertiesCfg(
|
| 224 |
+
solver_position_iteration_count=192,
|
| 225 |
+
solver_velocity_iteration_count=1,
|
| 226 |
+
max_depenetration_velocity=0.02,
|
| 227 |
+
linear_damping=2.0,
|
| 228 |
+
angular_damping=2.0,
|
| 229 |
+
),
|
| 230 |
+
mass_props=sim_utils.MassPropertiesCfg(mass=c.card_mass),
|
| 231 |
+
),
|
| 232 |
+
init_state=RigidObjectCfg.InitialStateCfg(
|
| 233 |
+
pos=(wx + cx, wy + cy, c.surface_z + c.card_init_z), rot=c.card_init_quat
|
| 234 |
+
),
|
| 235 |
+
),
|
| 236 |
+
}
|
| 237 |
+
if c.card_stand:
|
| 238 |
+
# Foam holder for a gripper env: three STATIC boxes (no rigid body). The floor pad's
|
| 239 |
+
# top is the card spawn height (`card_init_z` = the tab-bottom plane), the two rails
|
| 240 |
+
# flank the body slab's faces at `card_stand_gap` per side. Rail tops stay 35+ mm
|
| 241 |
+
# below the pick grip band, so descending open fingers never meet them.
|
| 242 |
+
y0, y1 = self.CARD_BODY_Y
|
| 243 |
+
mid_y = wy + cy + 0.5 * (y0 + y1) # body-slab mid-plane (the pinch/rail centre)
|
| 244 |
+
half_gap = 0.5 * (y1 - y0) + c.card_stand_gap # rail inner face off the mid-plane
|
| 245 |
+
rail_h, rail_t = 0.055, 0.008
|
| 246 |
+
foam = sim_utils.PreviewSurfaceCfg(diffuse_color=(0.17, 0.17, 0.2), roughness=0.9)
|
| 247 |
+
for name, size, pos in (
|
| 248 |
+
("card_stand_floor", (0.11, 0.09, c.card_init_z),
|
| 249 |
+
(wx + cx, mid_y, c.surface_z + 0.5 * c.card_init_z)),
|
| 250 |
+
("card_stand_rail_pcb", (0.11, rail_t, rail_h),
|
| 251 |
+
(wx + cx, mid_y - half_gap - 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 252 |
+
("card_stand_rail_fan", (0.11, rail_t, rail_h),
|
| 253 |
+
(wx + cx, mid_y + half_gap + 0.5 * rail_t, c.surface_z + c.card_init_z + 0.5 * rail_h)),
|
| 254 |
+
):
|
| 255 |
+
assets[name] = AssetBaseCfg(
|
| 256 |
+
prim_path="{ENV_REGEX_NS}/" + "".join(p.capitalize() for p in name.split("_")),
|
| 257 |
+
spawn=sim_utils.CuboidCfg(
|
| 258 |
+
size=size,
|
| 259 |
+
collision_props=sim_utils.CollisionPropertiesCfg(
|
| 260 |
+
contact_offset=0.001, rest_offset=0.0
|
| 261 |
+
),
|
| 262 |
+
visual_material=foam,
|
| 263 |
+
),
|
| 264 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=pos),
|
| 265 |
+
)
|
| 266 |
+
# Immutable visual-only set dressing, clear of the arm/task swept volume.
|
| 267 |
+
assets['pilot_parts_box'] = AssetBaseCfg(
|
| 268 |
+
prim_path='{ENV_REGEX_NS}/PilotPartsBox',
|
| 269 |
+
spawn=sim_utils.CuboidCfg(size=(.075, .075, .045),
|
| 270 |
+
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(.08, .35, .65), roughness=.8)),
|
| 271 |
+
init_state=AssetBaseCfg.InitialStateCfg(pos=(.90, .36, c.surface_z+.0225)))
|
| 272 |
+
return assets
|
| 273 |
+
|
| 274 |
+
def sim_cfg(self) -> SimCfg:
|
| 275 |
+
return SimCfg(
|
| 276 |
+
dt=1.0 / 120.0,
|
| 277 |
+
physx={
|
| 278 |
+
"solver_type": 1,
|
| 279 |
+
"bounce_threshold_velocity": 0.2,
|
| 280 |
+
"friction_offset_threshold": 0.01,
|
| 281 |
+
"friction_correlation_distance": 0.00625,
|
| 282 |
+
"gpu_max_rigid_contact_count": 2**23,
|
| 283 |
+
"gpu_max_rigid_patch_count": 2**23,
|
| 284 |
+
"gpu_collision_stack_size": 2**28,
|
| 285 |
+
"gpu_max_num_partitions": 1,
|
| 286 |
+
},
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# ----- lifecycle ----------------------------------------------------------------------------
|
| 290 |
+
|
| 291 |
+
def __getattr__(self, name: str):
|
| 292 |
+
# Legacy surface: the grasp contract's state used to live directly on the scene
|
| 293 |
+
# (inline machinery era) and existing solutions read it there — forward to the
|
| 294 |
+
# composed contract. `__getattr__` only fires for attributes not found normally.
|
| 295 |
+
if name.startswith("_gw_") and "grasp_weld" in self.__dict__:
|
| 296 |
+
return getattr(self.grasp_weld, name)
|
| 297 |
+
raise AttributeError(name)
|
| 298 |
+
|
| 299 |
+
def bind(self, env: BaseEnv) -> None:
|
| 300 |
+
"""Grab the case + card handles, cache env origins, and set the part frictions."""
|
| 301 |
+
super().bind(env)
|
| 302 |
+
self.case: RigidObject = env.iscene["case"]
|
| 303 |
+
self.card: RigidObject = env.iscene["card"]
|
| 304 |
+
self.env_origins = env.iscene.env_origins
|
| 305 |
+
self._set_friction(self.case, self.cfg.case_friction)
|
| 306 |
+
self._set_friction(self.card, self.cfg.card_friction)
|
| 307 |
+
self.grasp_weld = GraspWeldContract(self) # composed, publishes self.grasp_held
|
| 308 |
+
self.grasp_weld.bind()
|
| 309 |
+
|
| 310 |
+
def grasp_sites(self) -> list:
|
| 311 |
+
"""One grip band: across the body slab (faces at CARD_BODY_Y, 34.8 mm wide), along the
|
| 312 |
+
card's upper length — band centre 15 mm below the shroud's top edge (z 0.1155)."""
|
| 313 |
+
y = 0.5 * (self.CARD_BODY_Y[0] + self.CARD_BODY_Y[1])
|
| 314 |
+
return [("card", self.card, (-0.045, y, 0.1005), (0.045, y, 0.1005), (0.030, 0.039))]
|
| 315 |
+
|
| 316 |
+
def post_step(self, env_ids: torch.Tensor | None = None) -> None:
|
| 317 |
+
"""Reconcile the weld-on-closure grasp contract every physics substep."""
|
| 318 |
+
self.grasp_weld.step()
|
| 319 |
+
|
| 320 |
+
def _set_friction(self, asset, value: float) -> None:
|
| 321 |
+
"""Overwrite the static + dynamic friction on every shape of `asset` (across all envs)."""
|
| 322 |
+
mats = asset.root_physx_view.get_material_properties()
|
| 323 |
+
mats[..., 0:2] = value # [static, dynamic, restitution]
|
| 324 |
+
asset.root_physx_view.set_material_properties(mats, torch.arange(self.env.num_envs, device="cpu"))
|
| 325 |
+
|
| 326 |
+
def reset(self, env_ids: torch.Tensor) -> None:
|
| 327 |
+
"""Fresh, unassembled start: the case pinned at spawn, the card lying backplate-down on
|
| 328 |
+
the table beside it, with xy jitter."""
|
| 329 |
+
c = self.cfg
|
| 330 |
+
dev = self.env.device
|
| 331 |
+
m = len(env_ids)
|
| 332 |
+
origin = self.env_origins[env_ids] # (m, 3)
|
| 333 |
+
wx, wy = c.workbench_pos
|
| 334 |
+
cx, cy = c.card_init_xy
|
| 335 |
+
|
| 336 |
+
st = torch.zeros(m, 13, device=dev)
|
| 337 |
+
st[:, 0:3] = origin + torch.tensor((wx + cx, wy + cy, c.surface_z + c.card_init_z), device=dev)
|
| 338 |
+
st[:, 0:2] += (torch.rand(m, 2, device=dev) * 2 - 1) * c.reset_pos_jitter
|
| 339 |
+
# Small in-holder variation: below rail clearance; no case/slot changes.
|
| 340 |
+
st[:, :2] += (torch.rand(m, 2, device=dev)*2-1) * torch.tensor(
|
| 341 |
+
[c.pilot_jitter_x, c.pilot_jitter_y], device=dev)
|
| 342 |
+
st[:, 3:7] = torch.tensor(c.card_init_quat, device=dev)
|
| 343 |
+
self.card.write_root_state_to_sim(st, env_ids)
|
| 344 |
+
self.grasp_weld.release_all(env_ids)
|
| 345 |
+
|
| 346 |
+
# ----- state (full, restorable) -------------------------------------------------------------
|
| 347 |
+
def get_state(self, env_ids: torch.Tensor) -> dict[str, Any]:
|
| 348 |
+
"""Restorable scene state: world root states (13) of the case and the card, plus the
|
| 349 |
+
grasp-weld holds."""
|
| 350 |
+
return {
|
| 351 |
+
"case": self.case.data.root_state_w[env_ids].clone(),
|
| 352 |
+
"card": self.card.data.root_state_w[env_ids].clone(),
|
| 353 |
+
**self.grasp_weld.state(env_ids),
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
def set_state(self, state: dict[str, Any], env_ids: torch.Tensor) -> None:
|
| 357 |
+
"""Restore what `get_state` returned. The card's insertion depth is fully captured by its
|
| 358 |
+
root state, so the channel holds it on restore."""
|
| 359 |
+
self.case.write_root_pose_to_sim(state["case"][:, 0:7], env_ids)
|
| 360 |
+
self.card.write_root_state_to_sim(state["card"], env_ids)
|
| 361 |
+
self.grasp_weld.restore(state, env_ids)
|
| 362 |
+
|
| 363 |
+
# ----- description --------------------------------------------------------------------------
|
| 364 |
+
def describe(self) -> str:
|
| 365 |
+
if self.cfg.card_stand:
|
| 366 |
+
card = (
|
| 367 |
+
"Beside the case a loose graphics card stands upright in a foam holder, already "
|
| 368 |
+
"in its installation orientation.\nGoal: grip the card by its top edge, lift it "
|
| 369 |
+
"straight out of the holder, "
|
| 370 |
+
)
|
| 371 |
+
else:
|
| 372 |
+
card = (
|
| 373 |
+
"Beside the case lies a loose graphics card, backplate down.\nGoal: lift the "
|
| 374 |
+
"card upright (fans toward the case front), "
|
| 375 |
+
)
|
| 376 |
+
return (
|
| 377 |
+
"A gaming-PC case lying on its side on a sturdy table, opening up, its motherboard "
|
| 378 |
+
"facing the ceiling. The board's primary PCIe x16 slot is empty, and the rear I/O "
|
| 379 |
+
f"panel has an open expansion-slot cutout. {card}"
|
| 380 |
+
"lower it into the case with its I/O bracket just forward of the rear panel, slide "
|
| 381 |
+
"it rearward until the bracket and ports pass through the cutout, line its PCB edge "
|
| 382 |
+
"connector up with the x16 slot, and press it straight down until it bottoms out. "
|
| 383 |
+
"A seated card stays put on its own. The task is complete once the card is fully "
|
| 384 |
+
"seated."
|
| 385 |
+
+ " A fixed blue parts box decorates the far corner, outside the task volume."
|
| 386 |
+
+ (
|
| 387 |
+
" The card holds in a firm pinch: close the fingers squarely across its body "
|
| 388 |
+
"slab near the top edge and the grip locks; open wide to release."
|
| 389 |
+
if self.cfg.grasp_weld
|
| 390 |
+
else ""
|
| 391 |
+
)
|
| 392 |
+
)
|
| 393 |
+
|
| 394 |
+
# ----- progress (public: seated()/engaged(); reads how far the assembly has got) -------------
|
| 395 |
+
def engaged(self) -> torch.Tensor:
|
| 396 |
+
"""Tab depth below the slot mouth, shape (num_envs,), in metres (negative = still above
|
| 397 |
+
the slot). The card bottoms out on the channel floor at 0.005 depth."""
|
| 398 |
+
rel = self._card_offset_in_case() # (n, 3), zero at the seated pose
|
| 399 |
+
return (self.cfg.slot_mouth_z - self.cfg.seat_pos[2]) - rel[:, 2]
|
| 400 |
+
|
| 401 |
+
def seated(self) -> torch.Tensor:
|
| 402 |
+
"""Whether the card is seated in the slot, shape (num_envs,): pressed down to `seat_depth`
|
| 403 |
+
below the mouth, within `align_xy` of the seated point, and aligned in tilt AND heading."""
|
| 404 |
+
c = self.cfg
|
| 405 |
+
rel = self._card_offset_in_case() # (n, 3)
|
| 406 |
+
depth_ok = self.engaged() >= c.seat_depth
|
| 407 |
+
xy_ok = rel[:, :2].norm(dim=-1) <= c.align_xy
|
| 408 |
+
up_ok = self._axis_cos(2) >= math.cos(math.radians(c.align_axis_deg))
|
| 409 |
+
yaw_ok = self._axis_cos(0) >= math.cos(math.radians(c.align_yaw_deg))
|
| 410 |
+
return depth_ok & xy_ok & up_ok & yaw_ok
|
| 411 |
+
|
| 412 |
+
def success(self) -> torch.Tensor:
|
| 413 |
+
"""(N,) bool: the card seated in its slot — this scene's assembled state
|
| 414 |
+
(scene-level success alias, matching the other suites' surface)."""
|
| 415 |
+
return self.seated()
|
| 416 |
+
|
| 417 |
+
def _card_offset_in_case(self) -> torch.Tensor:
|
| 418 |
+
"""The card origin's offset from the seated point, in the case's local frame, shape
|
| 419 |
+
(num_envs, 3). Zero means the card origin sits exactly at the seated pose."""
|
| 420 |
+
from isaaclab.utils.math import quat_apply_inverse
|
| 421 |
+
|
| 422 |
+
rel = quat_apply_inverse(
|
| 423 |
+
self.case.data.root_quat_w, self.card.data.root_pos_w - self.case.data.root_pos_w
|
| 424 |
+
)
|
| 425 |
+
return rel - torch.tensor(self.cfg.seat_pos, device=rel.device)
|
| 426 |
+
|
| 427 |
+
def _axis_cos(self, axis: int) -> torch.Tensor:
|
| 428 |
+
"""cos of the angle between the card's and the case's local `axis` (0=x: heading along the
|
| 429 |
+
slot, 2=z: insertion axis), shape (num_envs,). Seated orientation = the case's own axes."""
|
| 430 |
+
from isaaclab.utils.math import quat_apply
|
| 431 |
+
|
| 432 |
+
e = torch.zeros(3, device=self.env.device)
|
| 433 |
+
e[axis] = 1.0
|
| 434 |
+
e = e.expand(self.env.num_envs, 3)
|
| 435 |
+
case_ax = quat_apply(self.case.data.root_quat_w, e)
|
| 436 |
+
card_ax = quat_apply(self.card.data.root_quat_w, e)
|
| 437 |
+
return (card_ax * case_ax).sum(dim=-1)
|
| 438 |
+
|
| 439 |
+
# Grasp-weld contract: composed `GraspWeldContract` (robobench.core.grasp_weld),
|
| 440 |
+
# created in `bind()`; this scene supplies the part-side `grasp_sites()`.
|
| 441 |
+
# Grasp-weld contract constants — the scene's public knobs (solutions read these off the
|
| 442 |
+
# scene, e.g. `scene.GRASP_PINCH_OFFSET`); the composed GraspWeldContract consumes them.
|
| 443 |
+
GRASP_HAND_BODY: ClassVar[str] = "panda_hand"
|
| 444 |
+
GRASP_FINGER_JOINTS: ClassVar[str] = "panda_finger_joint.*"
|
| 445 |
+
GRASP_PINCH_OFFSET: ClassVar[float] = 0.1034 # hand origin -> finger-pad centre, along approach
|
| 446 |
+
GRASP_POOL: ClassVar[int] = 8 # engages per (env, site) per run; exhausted -> warn, no weld
|
| 447 |
+
GRASP_STALL: ClassVar[float] = 0.01 # max |finger vel| sum (m/s): fingers stopped ON the part
|
| 448 |
+
GRASP_DEBOUNCE: ClassVar[int] = 8 # consecutive qualifying substeps before the weld engages
|
| 449 |
+
GRASP_RELEASE_MARGIN: ClassVar[float] = 0.008 # release at window-top + this (m), hysteresis
|
| 450 |
+
|
provenance/generation_code/p03_dynamics/strategy/SUMMARY.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Base state-feedback program; 20 mm off-centre grasp plus side staging waypoint at (0.34,-0.14), then normal insertion. DART offered only during high free-space transport. Initially UNTESTED; see pilot_report.json.
|
provenance/generation_code/p03_dynamics/strategy/meta.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"episodes": 0,
|
| 3 |
+
"successes": 0,
|
| 4 |
+
"success_rate": null,
|
| 5 |
+
"batches": [],
|
| 6 |
+
"refreshed": "2026-10-12T10:47:21+00:00"
|
| 7 |
+
}
|