Files
workinf_Blender_Wasm/docs/web/ARMATURE-ROBOT-HEADED-TESTS.md
mes123456 8dcc41c06d
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
feat(web): armature bone parenting, pose evaluation and ABB IRB120 headed suite
- engine: PARBONE parenting, BKE_pose_where_is pose refresh, pose channel readback
- viewport: three.js bone wireframes for the main-thread and offscreen paths
- properties: draft numeric transform inputs (decimals survive typing), armature pose
  readback in degrees with step=any fields so validation cannot block Apply Pose
- tests: headed armature/robot suite (9 cases), receipts bound to candidate hashes

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-29 09:13:02 +08:00

71 lines
3.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 骨骼 / ABB IRB120 有头测试
面向浏览器真实操作的有头(headed)验证:Chromium 打开产品入口、走真实的加载/装配/姿态路径,
断言从引擎快照读回,回执绑定候选构件哈希且标记 `NOT_CLAIMED`(不宣称验收通过)。
## 运行
```bash
# 全量(需要 X11,默认 headed;candidate 默认 web/dist)
DISPLAY=:1 node tools/web/run-armature-robot-headed.mjs --candidate /abs/path/to/web/dist
# 单例
DISPLAY=:1 node tools/web/run-armature-robot-headed.mjs --candidate web/dist --grep armature-viewport-web
# 校验最新回执
node tools/web/check-armature-robot-headed.mjs
node tools/web/check-armature-robot-headed.mjs --dir /abs/tests/golden/ARMATURE-ROBOT-HEADED-<stamp>
```
退出码:`0` 通过、`1` 失败、`2` 前置检查 BLOCKED(缺 DISPLAY/Chrome/候选/机器人样例 provenance)、`64` 参数错误。
回执写入 `tests/golden/ARMATURE-ROBOT-HEADED-<YYYYMMDD-HHMMSS>/`,同名冲突追加 `-HHMMSS`,历史回执不覆盖。
## 用例
| id | 入口 | 断言 |
| --- | --- | --- |
| `robot-sample-web` | 六轴机器人工具 → 加载 ABB IRB120 样例 | provenance/URDF 哈希一致,零件导入后各 link 挂在根对象下 |
| `robot-assemble-check-web` | 建立 URDF 层级 → 六轴检查 | 真实父子链与六轴检查通过 |
| `robot-pose-web` | joint_1 30° → 应用关节角度 → 恢复零位 | link_1 world 变化、复位还原 |
| `armature-bones-web` | 引擎命令 `setArmatureBones` | Root/Child 骨链、rest/pose 通道读回 |
| `armature-bind-web` | `setParent` + `parentType:"BONE"` | 刚性绑定后 world 不变;未知骨名返回 `PARENT_BONE_INVALID` |
| `armature-pose-web` | `setPoseBoneTransform` | poseMatrix/子物体 world 变化、重复写入幂等、归零复原 |
| `armature-viewport-web` | 属性面板姿态表单 → Apply Pose | 画布 `data-armature-bone-count`、截图前后不同 |
| `armature-decimal-input-web` | 用户逐键输入 `0.5` | `缩放 X` 与姿态 `Scale X` 保留小数;姿态提交后 poseScale 读回 0.5 |
| `armature-ui-readback-web` | 姿态表单回填 | UI 显示角度/缩放 = 引擎 pose 通道(弧度×180/π),`data-testid="armature-pose-readback"` |
## 门禁(checker 硬校验)
- `bundleHasRobotTool`:候选包含「加载 ABB IRB120 样例」入口。
- `engineHasArmatureCommands`:wasm 含 `ARMATURE_BONES_INVALID`。
- `engineHasBoneParent`:wasm 含 `PARENT_BONE_INVALID`。
- `enginePoseEvaluated`:wasm 含 `ARMATURE_POSE_EVALUATED`。
- `bundleHasArmatureReadback`:候选包含姿态读回表单。
- `matchesSyncedRuntime`:候选 wasm 与 `web/app/public/vendor/blender` 同步产物一致。
## ABB IRB120 骨骼映射(关节 → 骨骼 → 刚性绑定)
| 关节 | 骨骼 | 子 link | 说明 |
| --- | --- | --- | --- |
| joint_1 | J1 | link_1 | 基座回转,URDF 轴 Z |
| joint_2 | J2 | link_2 | 大臂,轴 Y |
| joint_3 | J3 | link_3 | 小臂,轴 Y |
| joint_4 | J4 | link_4 | 腕回转,轴 Z |
| joint_5 | J5 | link_5 | 腕摆动,轴 Y |
| joint_6 | J6 | link_6 | 法兰,轴 Z |
绑定语义镜像桌面 `ob_parbone`:`pose_mat` 的 Y 列 × 骨长 × `parent_bone_head_tail_factor`(DNA 默认 1.0),
`partype = PARBONE`,`parsubstr = <骨名>`;world = 骨架对象 world × 骨骼矩阵 × `parentinv` × basis。
## 约束
- 全部落盘走 OPFS;禁用 IDBFS/IndexedDB;测试产物不写入 OPFS。
- 下载 `.blend` 只能由用户手动触发独立入口,保存/编辑流程不得自动下载。
- 回执 `acceptance:"NOT_CLAIMED"`,绑定候选哈希,不覆盖历史回执;不以单例通过宣称整体验收。
## 残余
- 机器人工具动作「建立骨架(6 骨骼 + 刚性绑定)」尚未落地(`bundleHasRigAction` 仍为软探针)。
- `armature-reopen-web`(OPFS 保存重开一致)尚未编写。
- 姿态表单「编辑 / 姿态 / 物体」模式分离与 Ctrl+Tab 进入姿态待实现。