diff --git a/.gitignore b/.gitignore
index dfbba72..0c2aecf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,7 @@ __pycache__/
out/
*.mp4
backup/
+
+external/
+.retarget/
+config/local.env
diff --git a/README.md b/README.md
index 6ea741f..2eb7666 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
## 快速查看
-Python 3.12 + venv(不使用conda):
+Python 3.12 + venv:
```bash
python3.12 -m venv .venv
@@ -14,7 +14,7 @@ python3 scripts/prepare_snapshot.py
.venv/bin/python scripts/view_cup_approach.py --middle --dynamic
```
-需要桌面显示环境;鼠标自由转动,空格暂停,R重播。第一条查看接近路径,第二条查看最新动力学试抓。场景主文件 `scene/cup_workcell.xml`,试抓场景 `data/cup_middle_search/dynamic_scene.xml`。几何文件已随仓库打包,路径为相对路径;prepare_snapshot仅重定位记录中的本地项目路径。
+需要桌面显示环境;鼠标自由转动,空格暂停,R重播。第一条查看接近路径,第二条查看最新动力学试抓。场景主文件 `scene/cup_workcell.xml`,试抓场景 `data/cup_middle_search/dynamic_scene.xml`。prepare_snapshot 检查必要模型资源。
## 当前流程
@@ -25,7 +25,7 @@ D405 RGB-D → 杯子尺寸/位置 → 仿真相机 → 杯子感知 → HUG候
CUP_TRIAL_DIR=data/cup_middle_search .venv/bin/python scripts/test_cup_dynamic_grasp.py
```
-搜索复用已保存的HUG候选,无需模型权重。完整重新生成HUG候选另外需要HUG及其权重、MANO授权资产;重定向需要dex-retargeting/Pinocchio以及 `~/do-as-i-do/retargeting/l20/retarget_l20_v2.py`。这些环境/权重未包含,也不影响已保存场景回放及中段搜索。D405采集另需pyrealsense2和相机。历史脚本保留供参考,不代表全部外部依赖都已打包。
+搜索复用已保存的HUG候选,无需模型权重。完整重新生成HUG候选另外需要HUG及其权重、MANO授权资产;重定向需要dex-retargeting/Pinocchio以及 `retarget_l20_v2.py`。这些环境/权重未包含,也不影响已保存场景回放及中段搜索。D405采集另需pyrealsense2和相机。可选工具的安装与配置见 [环境配置](docs/INSTALL.md)。
## 场景与当前结果
diff --git a/assets/hand_adapter/cad_measurements.json b/assets/hand_adapter/cad_measurements.json
index fee2cf5..45815c4 100644
--- a/assets/hand_adapter/cad_measurements.json
+++ b/assets/hand_adapter/cad_measurements.json
@@ -1,5 +1,5 @@
{
- "source": "/home/timessage/\u6587\u6863/A7V2-L20\u94fe\u63a5\u6cd5\u5170 .STEP",
+ "source": "A7V2-L20链接法兰 .STEP",
"bbox_mm": [
-30.0000001,
-30.0000001,
@@ -1639,5 +1639,6 @@
}
],
"mesh_units": "m",
- "assembly_transform_verified": false
-}
\ No newline at end of file
+ "assembly_transform_verified": false,
+ "historical_external_sources": "Photo/STEP names are provenance only; original external files are not bundled."
+}
diff --git a/assets/l20_left_mj.urdf b/assets/l20_left_mj.urdf
index f480f15..51aba88 100644
--- a/assets/l20_left_mj.urdf
+++ b/assets/l20_left_mj.urdf
@@ -6,7 +6,7 @@
name="linkerhand_g20_left.urdf">
-
+
diff --git a/assets/l20_right_mj.urdf b/assets/l20_right_mj.urdf
index fe2484f..9db8de7 100644
--- a/assets/l20_right_mj.urdf
+++ b/assets/l20_right_mj.urdf
@@ -6,7 +6,7 @@
name="linkerhand_L25NS_right.urdf">
-
+
diff --git a/assets/retarget/l20_left_scene_with_tips.urdf b/assets/retarget/l20_left_scene_with_tips.urdf
index b25c9ce..d680075 100644
--- a/assets/retarget/l20_left_scene_with_tips.urdf
+++ b/assets/retarget/l20_left_scene_with_tips.urdf
@@ -1,6 +1,6 @@
-
+
diff --git a/config/l20_left_scene_position.yml b/config/l20_left_scene_position.yml
index cd678bf..930e99a 100644
--- a/config/l20_left_scene_position.yml
+++ b/config/l20_left_scene_position.yml
@@ -1,6 +1,6 @@
retargeting:
type: position
- urdf_path: /home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/assets/retarget/l20_left_scene_with_tips.urdf
+ urdf_path: assets/retarget/l20_left_scene_with_tips.urdf
target_joint_names:
- thumb_cmc_yaw
- thumb_cmc_roll
diff --git a/config/local.env.example b/config/local.env.example
new file mode 100644
index 0000000..06cd850
--- /dev/null
+++ b/config/local.env.example
@@ -0,0 +1,5 @@
+# Copy to local.env, edit and source before using optional tools.
+# export HUG_ROOT="external/hug"
+# export RETARGETING_ROOT="external/retargeting"
+# export RETARGET_PYTHON=".retarget/bin/python"
+# export A7_SDK_LIBRARY="external/a7_sdk/liblbot_api_cpp.so.1.0.5"
diff --git a/config/measured_layout.json b/config/measured_layout.json
index a1288c8..fa9acc3 100644
--- a/config/measured_layout.json
+++ b/config/measured_layout.json
@@ -26,10 +26,10 @@
"table_near": "User measured column front face to desk near edge: 0.205m. Corrected column depth 0.09m gives near x=0.09/2+0.205=0.25m. Assumes desk edge parallel to column front.",
"unmeasured": "Desk width/depth, caster/deck height, exact column center relative to CAD base and desk yaw are display estimates. Deck center is 8cm forward of column to reproduce its visible extension underneath desk; desk yaw zero.",
"photos": [
- "/home/timessage/图片/a7/IMG20260928115533.jpg",
- "/home/timessage/图片/a7/IMG20260928115542.jpg",
- "/home/timessage/图片/a7/IMG20260928115548.jpg",
- "/home/timessage/图片/a7/IMG20260928115553.jpg"
+ "IMG20260928115533.jpg",
+ "IMG20260928115542.jpg",
+ "IMG20260928115548.jpg",
+ "IMG20260928115553.jpg"
],
"assembly": "Preserve scene/real_assembly.xml bodies, hand adapter transform and keyframes exactly; only translate the assembly to floor coordinates. No hardware actions."
},
@@ -39,5 +39,6 @@
"clearance_m": 0.0,
"note": "Fit freshly subscribed arm pose to nominal desktop contact. Finger angles remain model zero, not measured. Pure offline display alignment."
},
- "snapshot_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json"
+ "snapshot_file": "data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
+ "historical_external_sources": "Photo/STEP names are provenance only; original external files are not bundled."
}
diff --git a/data/cup_model_20260928/cup_model.json b/data/cup_model_20260928/cup_model.json
index b10608f..07f8f13 100644
--- a/data/cup_model_20260928/cup_model.json
+++ b/data/cup_model_20260928/cup_model.json
@@ -99,5 +99,5 @@
"dimension_uncertainty": "not independently quantified; residual is NOT absolute accuracy",
"table_margin_m": 0.005,
"physical_execution_authorized": false,
- "position_capture": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/cup_moved_capture_20260928"
+ "position_capture": "data/cup_moved_capture_20260928"
}
\ No newline at end of file
diff --git a/data/cup_sim_capture_20260928/grasp_l20_cup_0.json b/data/cup_sim_capture_20260928/grasp_l20_cup_0.json
index eab68df..cea5cb3 100644
--- a/data/cup_sim_capture_20260928/grasp_l20_cup_0.json
+++ b/data/cup_sim_capture_20260928/grasp_l20_cup_0.json
@@ -3,7 +3,7 @@
"source": "data/cup_sim_capture_20260928/hug_cup.npz",
"hand_side": "left",
"human_landmarks_mirrored": true,
- "retarget_config": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/config/l20_left_scene_position.yml",
+ "retarget_config": "config/l20_left_scene_position.yml",
"sample": 5,
"wrist_pos": [
0.25767,
diff --git a/data/cup_sim_capture_20260928/grasp_l20_cup_1.json b/data/cup_sim_capture_20260928/grasp_l20_cup_1.json
index cf9c7c4..808cd50 100644
--- a/data/cup_sim_capture_20260928/grasp_l20_cup_1.json
+++ b/data/cup_sim_capture_20260928/grasp_l20_cup_1.json
@@ -3,7 +3,7 @@
"source": "data/cup_sim_capture_20260928/hug_cup.npz",
"hand_side": "left",
"human_landmarks_mirrored": true,
- "retarget_config": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/config/l20_left_scene_position.yml",
+ "retarget_config": "config/l20_left_scene_position.yml",
"sample": 4,
"wrist_pos": [
0.25392,
diff --git a/data/cup_sim_capture_20260928/grasp_l20_cup_2.json b/data/cup_sim_capture_20260928/grasp_l20_cup_2.json
index bf5dea6..0eb9131 100644
--- a/data/cup_sim_capture_20260928/grasp_l20_cup_2.json
+++ b/data/cup_sim_capture_20260928/grasp_l20_cup_2.json
@@ -3,7 +3,7 @@
"source": "data/cup_sim_capture_20260928/hug_cup.npz",
"hand_side": "left",
"human_landmarks_mirrored": true,
- "retarget_config": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/config/l20_left_scene_position.yml",
+ "retarget_config": "config/l20_left_scene_position.yml",
"sample": 6,
"wrist_pos": [
0.26474,
diff --git a/data/cup_workcell/escape_report.json b/data/cup_workcell/escape_report.json
index 186bcc1..18fd7bd 100644
--- a/data/cup_workcell/escape_report.json
+++ b/data/cup_workcell/escape_report.json
@@ -118,7 +118,7 @@
"margin_m": 0.005,
"executable_on_hardware": false,
"scope": "continuous finite-table checks for fixed nominal hand; no self/cup/other-arm validation",
- "snapshot": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
+ "snapshot": "data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
"table_top_base_m": -0.29512236765524225,
"table_evidence": "simulation dimensions only"
}
\ No newline at end of file
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
new file mode 100644
index 0000000..acf4085
--- /dev/null
+++ b/docs/INSTALL.md
@@ -0,0 +1,47 @@
+# 环境配置
+
+主场景回放与杯身中段搜索使用 Python 3.12 + venv:
+
+~~~bash
+python3.12 -m venv .venv
+.venv/bin/python -m pip install -r requirements-sim.txt
+.venv/bin/python scripts/prepare_snapshot.py
+~~~
+
+Ubuntu 系统组件:python3.12-venv、libgl1、libegl1、libglfw3。图形回放需要桌面显示;无头模型检查使用 MUJOCO_GL=egl。
+
+## 可选工具
+
+| 用途 | 安装 |
+| --- | --- |
+| 网格检查、几何构建 | .venv/bin/python -m pip install -r requirements-geometry.txt |
+| D405 采集 | .venv/bin/python -m pip install -r requirements-camera.txt |
+| 旧 mink 抓取演示 | .venv/bin/python -m pip install -r requirements-demo.txt |
+| STEP 转网格 | .venv/bin/python -m pip install -r requirements-cad.txt |
+| 历史控制器/手部工具 | .venv/bin/python -m pip install -r requirements-controller.txt |
+
+旧演示依赖已固定版本;CAD 依赖按上游解析,尚未完成各可选环境的全新安装验证;历史硬件工具不属于默认仿真流程,不应为环境检查而运行。
+
+HUG 推理使用其自身兼容 venv、源码与 hug_full.safetensors;MANO 按提供方条件取得。重定向可单独创建 Python 3.12 的 .retarget 环境,安装 requirements-retarget.txt,并准备 retarget_l20_v2.py 及其配置。回放现有候选无需这些工具。
+
+## 可选资源配置
+
+在运行相关入口前 export 对应变量;Python 工具的相对配置以仓库根目录为基准。config/local.env.example 提供示例。
+
+| 变量 | 默认位置/用途 |
+| --- | --- |
+| HUG_ROOT | external/hug;HUG 源码 |
+| HUG_PYTHON | HUG_ROOT/.venv/bin/python |
+| HUG_CHECKPOINT | HUG_ROOT/checkpoints/hug_full.safetensors |
+| RETARGET_PYTHON | .retarget/bin/python |
+| RETARGETING_ROOT | external/retargeting,需含 l20/retarget_l20_v2.py 和 config/l20 |
+| LINKERHAND_SDK_ROOT | external/linkerhand-python-sdk;仅历史映射工具使用 |
+| P7_SCENE_XML | external/p7_bimanual/model.xml;旧场景构建器使用,旁边需有 meta.json,可由 wasm-bimanual-grasp 的 P7 场景提供 |
+| G20_LEFT_TABLE | assets/L20/LEFT/g20_left_G20.json;当前设备标定,不可直接套用其他设备 |
+| CALIBRATED_LEFT_URDF | external/calibrated_left/linkerhand_g20_left.urdf;离线标定诊断专用,需相邻网格,缺失时不替换成未标定模型 |
+| REFERENCE_LEFT_URDF | external/reference/l20_left_with_tips.urdf;独立坐标对比基准 |
+| HAND_ADAPTER_STEP | external/hand_adapter.STEP;重新测量法兰时使用 |
+| A7_SDK_LIBRARY | external/a7_sdk/liblbot_api_cpp.so.1.0.5;可选厂家库 |
+| A7_BRIDGE_SETUP | 现场 ROS 桥的 setup.bash;仅相关历史硬件工具使用 |
+
+外部源码、权重、参考标定模型和 SDK 需另外提供。修改路径不会改变模型物理参数或控制保护。
diff --git a/docs/cup_workcell.md b/docs/cup_workcell.md
index 735c380..3961bd7 100644
--- a/docs/cup_workcell.md
+++ b/docs/cup_workcell.md
@@ -20,7 +20,7 @@
2026-09-28 坐标/安装核验:控制器快照与模型 FK 左右臂位置差 <0.002mm,安装矩阵与已确认配置一致(矩阵最大差 8.2e-7);HUG 相机到世界变换数值一致。这些是软件一致性检查,不代表真实标定精度。发现旧重定向 left URDF 与实际 LEFT 装配的手指侧向/轴方向镜像不一致;新增 assets/retarget/l20_left_scene_with_tips.urdf、config/l20_left_scene_position.yml 与实际模型一致。HUG MANO 默认 right,需显式 --mirror-human-hand 生成左手候选;转换后指尖拟合误差8.7–9.6mm。原装配/法兰安装未改。修正后3候选×8种子仍未找到预抓取IK,未进入路径碰撞检查,不能归因为桌面碰撞,也未完成抓取。报告 data/cup_coordinate_audit_20260928/report.json。
-重定向复现:`PYTHONPATH= LD_LIBRARY_PATH= /home/timessage/linkerhand-python-sdk/.venv/bin/python scripts/hug_to_l20.py --npz data/cup_sim_capture_20260928/hug_cup.npz --side left --top 3 --table-top .755 --config config/l20_left_scene_position.yml --mirror-human-hand`。仅离线候选验证,原真机 RealArm 安装参数未迁移,不能直接执行。
+重定向复现:`PYTHONPATH= LD_LIBRARY_PATH= $RETARGET_PYTHON scripts/hug_to_l20.py --npz data/cup_sim_capture_20260928/hug_cup.npz --side left --top 3 --table-top .755 --config config/l20_left_scene_position.yml --mirror-human-hand`。仅离线候选验证,原真机 RealArm 安装参数未迁移,不能直接执行。
抓取方向调整:scripts/search_cup_approach.py 搜索103种姿态,找到相对原候选 yaw=-90°、倾角=-60°、高度不变的可达解。接近前段桌面采样最小间隙8.845mm;scripts/check_cup_final_approach.py 验证末段70个笛卡尔点,终点桌面间隙15.193mm、手杯距离2.936mm。保存 data/cup_approach_search/{selected.json,approach_qpos.npy,approach_report.json}。只证明采样几何路径;末段允许接近杯子至接触,桌板仍保留5mm。
diff --git a/docs/elbow_trajectory_supervisor.md b/docs/elbow_trajectory_supervisor.md
index b9883c1..0827abf 100644
--- a/docs/elbow_trajectory_supervisor.md
+++ b/docs/elbow_trajectory_supervisor.md
@@ -48,7 +48,7 @@ ArmState反馈映射、固定轨迹引用检查、50~200Hz时间间隔检查
## 运行模拟
```bash
-/home/timessage/a7l20-hug-sim/.venv/bin/python /home/timessage/a7l20-hug-sim/scripts/demo_elbow_supervisor.py
+.venv/bin/python scripts/demo_elbow_supervisor.py
```
追加`--fault feedback-timeout`或`--fault stop-timeout`注入故障。
diff --git a/docs/left_hand_fist_restore.md b/docs/left_hand_fist_restore.md
index 6370b61..a3d3dbc 100644
--- a/docs/left_hand_fist_restore.md
+++ b/docs/left_hand_fist_restore.md
@@ -1,7 +1,7 @@
# 左手握合与恢复:JSON查表和诊断日志
入口:`scripts/left_hand_fist_restore.py`,使用
-`/home/timessage/linkerhand-python-sdk/.venv/bin/python`。
+`$RETARGET_PYTHON`。
默认仅离线加载标定表,`--execute`才打开can0并控制左手0x28。
不连接机械臂,不写使能、速度、扭矩或工厂校准设置。
@@ -12,7 +12,7 @@
## 标定表
-默认 `/home/timessage/Linkerbot_URDF/L20/LEFT/g20_left_G20.json`。
+默认 `assets/L20/LEFT/g20_left_G20.json`。
要求schema v4、LEFT G20、16主动+5被动关节、每关节256点。
指令和反馈角度均按angle_rad原表查找,不用SDK线性范围替代。
角度反查采用最接近的实测点;越界请求直接拒绝。zero_angles偏置不重复叠加。
diff --git a/docs/real_grasp_deploy.md b/docs/real_grasp_deploy.md
index be38723..f6ff6a2 100644
--- a/docs/real_grasp_deploy.md
+++ b/docs/real_grasp_deploy.md
@@ -27,8 +27,8 @@
| 相机 | Intel RealSense **D405**,USB 接本机(`8086:0b5b`);固定在躯干,**标定后别再动** |
| 控制器 | `192.168.10.21`,官方 web 控制平台 `http://192.168.10.21:8000/`(灵心巧手平台)|
| 通信 | **rosbridge `ws://192.168.10.21:9090`**(本机不在控制器 ROS 网络内,走 websocket)|
-| 本机 venv | `~/a7l20-hug-sim/.venv`(py3.12):mujoco/scipy/trimesh/cv2 + **pyrealsense2**、**roslibpy**(已装)|
-| HUG venv | `~/hug/.venv`(py3.10);重定向 venv `~/linkerhand-python-sdk/.venv` |
+| 本机 venv | `.venv`(py3.12):mujoco/scipy/trimesh/cv2 + **pyrealsense2**、**roslibpy**(已装)|
+| HUG venv | `$HUG_PYTHON`(py3.10);重定向 venv `$RETARGET_PYTHON` |
| ⚠ 安全拦截 | **Claude Code 安全分类器会拦"控制真机的命令"**,所有真机运动/桥接命令**由人在终端外部运行**(`!` 或自己终端)|
---
@@ -148,7 +148,7 @@
- `view_pointcloud.py` 点云可视化
**仍待打通(装手后)**
-- **L20 合指映射**:`hand_qpos`(16关节弧度) → `L20Hand{finger,cmd}`(逐指、cmd 量纲待定 0~255?/角度?)——接 `~/linkerhand-python-sdk`。`real_arm.set_hand` 已留接口。
+- **L20 合指映射**:`hand_qpos`(16关节弧度) → `L20Hand{finger,cmd}`(逐指、cmd 量纲待定 0~255?/角度?)——接 `$LINKERHAND_SDK_ROOT`。`real_arm.set_hand` 已留接口。
- **自体滤除**:真机臂在视野污染感知——先"移臂出视野",后补 URDF(`robot_description`)+关节角滤自身点云。
- **抓取成功判定**:再感知 / 手指电流 / 力矩(接 LinkerHand SDK)。
- **真机物体模板**:感知 ICP 分类需对应物体模板(`build_templates` 从 mesh/STEP 采);只求位置可用簇中心。
@@ -181,5 +181,3 @@
- [ ] **双臂协同/避碰**:目前只动右臂,右臂够 +y 侧须防撞左臂。
---
-
-*相关仿真侧文档见 `~/ObsidianVault/02-Projects/a7l20-hug-sim.md`。*
diff --git a/docs/table_contact_escape.md b/docs/table_contact_escape.md
index 4aff55a..695e9e5 100644
--- a/docs/table_contact_escape.md
+++ b/docs/table_contact_escape.md
@@ -49,13 +49,13 @@
保存快照+已采集桌面的条件诊断(不访问硬件):
```bash
-/home/timessage/a7l20-hug-sim/.venv/bin/python /home/timessage/a7l20-hug-sim/scripts/plan_table_escape.py
+.venv/bin/python scripts/plan_table_escape.py
```
真实装配几何+**合成接触桌面**演示(不是实际桌面验证,不改变标定):
```bash
-/home/timessage/a7l20-hug-sim/.venv/bin/python /home/timessage/a7l20-hug-sim/scripts/plan_table_escape.py --demo
+.venv/bin/python scripts/plan_table_escape.py --demo
```
回归测试:`scripts/test_table_contact_escape.py`。
diff --git a/requirements-cad.txt b/requirements-cad.txt
new file mode 100644
index 0000000..38ab370
--- /dev/null
+++ b/requirements-cad.txt
@@ -0,0 +1,2 @@
+-r requirements-geometry.txt
+cadquery-ocp
diff --git a/requirements-camera.txt b/requirements-camera.txt
new file mode 100644
index 0000000..90f5e5a
--- /dev/null
+++ b/requirements-camera.txt
@@ -0,0 +1,2 @@
+-r requirements-sim.txt
+pyrealsense2==2.58.4.10922
diff --git a/requirements-controller.txt b/requirements-controller.txt
new file mode 100644
index 0000000..a55648d
--- /dev/null
+++ b/requirements-controller.txt
@@ -0,0 +1,3 @@
+-r requirements-geometry.txt
+roslibpy==2.1.0
+python-can==4.6.1
diff --git a/requirements-demo.txt b/requirements-demo.txt
new file mode 100644
index 0000000..c35a135
--- /dev/null
+++ b/requirements-demo.txt
@@ -0,0 +1,5 @@
+-r requirements-geometry.txt
+mink==1.3.0
+daqp==0.9.1
+imageio[ffmpeg]==2.37.4
+imageio-ffmpeg==0.6.0
diff --git a/requirements-geometry.txt b/requirements-geometry.txt
new file mode 100644
index 0000000..c861123
--- /dev/null
+++ b/requirements-geometry.txt
@@ -0,0 +1,2 @@
+-r requirements-sim.txt
+trimesh==5.1.0
diff --git a/requirements-retarget.txt b/requirements-retarget.txt
new file mode 100644
index 0000000..2ac6015
--- /dev/null
+++ b/requirements-retarget.txt
@@ -0,0 +1,5 @@
+dex-retargeting==0.5.0
+pin==4.1.0
+PyYAML==6.0.3
+numpy==2.5.3
+scipy==1.18.1
diff --git a/scene/build_measured_layout.py b/scene/build_measured_layout.py
index fb64cbf..f6b08ce 100644
--- a/scene/build_measured_layout.py
+++ b/scene/build_measured_layout.py
@@ -34,7 +34,7 @@ def build():
old_model = mujoco.MjModel.from_xml_path(str(SOURCE))
fresh_snapshot = None
if cfg.get('snapshot_file'):
- fresh_snapshot = json.loads(Path(cfg['snapshot_file']).read_text())
+ fresh_snapshot = json.loads((ROOT / cfg['snapshot_file']).read_text())
key_id = old_model.key('snapshot').id
for side, letter in [('left','L'),('right','R')]:
state = fresh_snapshot['states'][side]['joint_state']
@@ -150,7 +150,7 @@ def build():
info['snapshot_received_at_utc'] = fresh_snapshot['received_at_utc']
info['snapshot_is_live'] = False
info['snapshot_source'] = 'fresh read saved once; not continuous live streaming'
- info['input_sha256'][cfg['snapshot_file']] = hashlib.sha256(Path(cfg['snapshot_file']).read_bytes()).hexdigest()
+ info['input_sha256'][cfg['snapshot_file']] = hashlib.sha256((ROOT / cfg['snapshot_file']).read_bytes()).hexdigest()
info.pop('checks', None) # Original historical FK numbers do not describe this snapshot.
info['snapshot_limit_warnings'] = []
for jid in range(old_model.njnt):
diff --git a/scene/build_real_assembly.py b/scene/build_real_assembly.py
index d1bed31..9cbf8d2 100644
--- a/scene/build_real_assembly.py
+++ b/scene/build_real_assembly.py
@@ -125,7 +125,7 @@ def build(snapshot_path=DEFAULT_SNAPSHOT):
hand, _ = prepare_hand("left", kp=2., kv=.08)
for mesh in hand.meshes:
if mesh.file and not Path(mesh.file).is_absolute():
- mesh.file = str(Path("/home/timessage/Linkerbot_URDF/L20/LEFT") / mesh.file)
+ mesh.file = str((ROOT / "assets/L20/LEFT") / mesh.file)
hand.compiler.meshdir = ""
for body in hand.bodies:
for geom in body.geoms:
@@ -208,7 +208,7 @@ def verify_model(model, info):
data = mujoco.MjData(model)
mujoco.mj_resetDataKeyframe(model, data, model.key("snapshot").id)
mujoco.mj_forward(model, data)
- snapshot = json.loads(Path(info["snapshot_file"]).read_text())
+ snapshot = json.loads((ROOT / info["snapshot_file"]).read_text())
checks = {}
for side in ("left", "right"):
pose = snapshot["states"][side]["pose"]
diff --git a/scene/build_scene.py b/scene/build_scene.py
index 7190e84..19a95a3 100644
--- a/scene/build_scene.py
+++ b/scene/build_scene.py
@@ -4,6 +4,7 @@
"""
from __future__ import annotations
+import os
import argparse
import json
import re
@@ -13,7 +14,9 @@ import mujoco
import numpy as np
ROOT = Path(__file__).resolve().parents[1]
-P7_XML = Path.home() / "wasm-bimanual-grasp/scenes/p7_bimanual/model.xml"
+P7_XML = Path(os.environ.get("P7_SCENE_XML", ROOT / "external/p7_bimanual/model.xml")).expanduser()
+if not P7_XML.is_absolute():
+ P7_XML = ROOT / P7_XML
P7_META = P7_XML.with_name("meta.json")
HAND_URDF = {"right": ROOT / "assets/l20_right_mj.urdf", "left": ROOT / "assets/l20_left_mj.urdf"}
FLANGE = {"right": "arm_right_R8_Link", "left": "arm_left_L8_Link"}
@@ -268,7 +271,7 @@ def build(kp: float, kv: float, obj_scale: float = 1.0, obj_spacing: float = 0.1
if f and not f.startswith("/"):
for side in ("left", "right"):
if mesh.name.startswith(f"{side}_hand_"):
- mesh.file = str(Path("/home/timessage/Linkerbot_URDF/L20") / ("RIGHT" if side == "right" else "LEFT") / f)
+ mesh.file = str((ROOT / "assets/L20") / ("RIGHT" if side == "right" else "LEFT") / f)
# 关节/执行器信息
for side in ("left", "right"):
info["arms"][side] = {"joints": [f"arm_{side}_{'L' if side == 'left' else 'R'}{i}_Joint" for i in range(1, 8)],
diff --git a/scene/cup_workcell.json b/scene/cup_workcell.json
index 86110b3..96e39ec 100644
--- a/scene/cup_workcell.json
+++ b/scene/cup_workcell.json
@@ -4,8 +4,8 @@
"execution_authorized": false,
"purpose": "Offline visual layout. Estimated desk extents, gap and caster dimensions are not collision evidence.",
"world_frame": "floor frame: controller base_link translated only along +Z",
- "source_arm_urdf": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/assets/controller_model/lingzuv2_description.urdf",
- "mount_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/config/left_hand_mount.json",
+ "source_arm_urdf": "assets/controller_model/lingzuv2_description.urdf",
+ "mount_file": "config/left_hand_mount.json",
"mount": {
"basis": "User: all 7 joints zero, then ONLY elbow J4 +90 degrees; palm down, 45deg to horizontal, pinky side lower.",
"status": "user_reference_resolved_not_physical_motion_validation",
@@ -64,7 +64,7 @@
"hand_side_evidence": "LEFT URDF index root y=-0.03525m, pinky root y=+0.03525m; do not reuse right-hand side signs.",
"execution_authorized": false
},
- "snapshot_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
+ "snapshot_file": "data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
"snapshot_received_at_utc": "20260928T052840Z",
"snapshot_is_live": false,
"finger_pose": "nominal URDF zero, NOT measured hardware state",
@@ -172,10 +172,10 @@
"assets/controller_model/lingzuv2_description.urdf": "136c6c0781ade1baca92aeeb13136c732008ff1177a1f9f47382688b4c12329d",
"config/left_hand_mount.json": "42716134cd7f440f9ce26a914b848bd6b3f8f59dc4a87925908880ce993ea4e4",
"data/left_cup_current/arm_snapshot_20260924T084830651325Z.json": "c1f960ae08975c52d04e778752cdd2e1e23bc9cf0c16a5c1d9df132dea7575aa",
- "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json": "719b929afa14bad7433b889d1141f879331be84646731b35b8132fe324dd32a4"
+ "data/layout_joint_read_20260928T052840Z/arm_snapshot.json": "719b929afa14bad7433b889d1141f879331be84646731b35b8132fe324dd32a4"
},
"snapshot_source": "fresh read saved once; not continuous live streaming",
- "source_scene": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/scene/real_assembly.xml",
+ "source_scene": "scene/real_assembly.xml",
"source_sha256": "f833889d39f149064a9e32d218eade50b6c6e84344df1c97c5c8dd22f59ada5b",
"layout": {
"measured": {
@@ -205,10 +205,10 @@
"table_near": "User measured column front face to desk near edge: 0.205m. Corrected column depth 0.09m gives near x=0.09/2+0.205=0.25m. Assumes desk edge parallel to column front.",
"unmeasured": "Desk width/depth, caster/deck height, exact column center relative to CAD base and desk yaw are display estimates. Deck center is 8cm forward of column to reproduce its visible extension underneath desk; desk yaw zero.",
"photos": [
- "/home/timessage/\u56fe\u7247/a7/IMG20260928115533.jpg",
- "/home/timessage/\u56fe\u7247/a7/IMG20260928115542.jpg",
- "/home/timessage/\u56fe\u7247/a7/IMG20260928115548.jpg",
- "/home/timessage/\u56fe\u7247/a7/IMG20260928115553.jpg"
+ "IMG20260928115533.jpg",
+ "IMG20260928115542.jpg",
+ "IMG20260928115548.jpg",
+ "IMG20260928115553.jpg"
],
"assembly": "Preserve scene/real_assembly.xml bodies, hand adapter transform and keyframes exactly; only translate the assembly to floor coordinates. No hardware actions."
},
@@ -218,7 +218,7 @@
"clearance_m": 0.0,
"note": "Fit freshly subscribed arm pose to nominal desktop contact. Finger angles remain model zero, not measured. Pure offline display alignment."
},
- "snapshot_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json"
+ "snapshot_file": "data/layout_joint_read_20260928T052840Z/arm_snapshot.json"
},
"measured_controller_base_height_m": 1.0059999942912263,
"display_lift_m": 0.04412237336401603,
@@ -915,6 +915,7 @@
"dimension_uncertainty": "not independently quantified; residual is NOT absolute accuracy",
"table_margin_m": 0.005,
"physical_execution_authorized": false,
- "position_capture": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/cup_moved_capture_20260928"
- }
-}
\ No newline at end of file
+ "position_capture": "data/cup_moved_capture_20260928"
+ },
+ "historical_external_sources": "Photo/STEP names are provenance only; original external files are not bundled."
+}
diff --git a/scene/measured_layout.json b/scene/measured_layout.json
index 47ca928..7904305 100644
--- a/scene/measured_layout.json
+++ b/scene/measured_layout.json
@@ -4,8 +4,8 @@
"execution_authorized": false,
"purpose": "Offline visual layout. Estimated desk extents, gap and caster dimensions are not collision evidence.",
"world_frame": "floor frame: controller base_link translated only along +Z",
- "source_arm_urdf": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/assets/controller_model/lingzuv2_description.urdf",
- "mount_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/config/left_hand_mount.json",
+ "source_arm_urdf": "assets/controller_model/lingzuv2_description.urdf",
+ "mount_file": "config/left_hand_mount.json",
"mount": {
"basis": "User: all 7 joints zero, then ONLY elbow J4 +90 degrees; palm down, 45deg to horizontal, pinky side lower.",
"status": "user_reference_resolved_not_physical_motion_validation",
@@ -64,7 +64,7 @@
"hand_side_evidence": "LEFT URDF index root y=-0.03525m, pinky root y=+0.03525m; do not reuse right-hand side signs.",
"execution_authorized": false
},
- "snapshot_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
+ "snapshot_file": "data/layout_joint_read_20260928T052840Z/arm_snapshot.json",
"snapshot_received_at_utc": "20260928T052840Z",
"snapshot_is_live": false,
"finger_pose": "nominal URDF zero, NOT measured hardware state",
@@ -172,10 +172,10 @@
"assets/controller_model/lingzuv2_description.urdf": "136c6c0781ade1baca92aeeb13136c732008ff1177a1f9f47382688b4c12329d",
"config/left_hand_mount.json": "42716134cd7f440f9ce26a914b848bd6b3f8f59dc4a87925908880ce993ea4e4",
"data/left_cup_current/arm_snapshot_20260924T084830651325Z.json": "c1f960ae08975c52d04e778752cdd2e1e23bc9cf0c16a5c1d9df132dea7575aa",
- "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json": "719b929afa14bad7433b889d1141f879331be84646731b35b8132fe324dd32a4"
+ "data/layout_joint_read_20260928T052840Z/arm_snapshot.json": "719b929afa14bad7433b889d1141f879331be84646731b35b8132fe324dd32a4"
},
"snapshot_source": "fresh read saved once; not continuous live streaming",
- "source_scene": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/scene/real_assembly.xml",
+ "source_scene": "scene/real_assembly.xml",
"source_sha256": "f833889d39f149064a9e32d218eade50b6c6e84344df1c97c5c8dd22f59ada5b",
"layout": {
"measured": {
@@ -205,10 +205,10 @@
"table_near": "User measured column front face to desk near edge: 0.205m. Corrected column depth 0.09m gives near x=0.09/2+0.205=0.25m. Assumes desk edge parallel to column front.",
"unmeasured": "Desk width/depth, caster/deck height, exact column center relative to CAD base and desk yaw are display estimates. Deck center is 8cm forward of column to reproduce its visible extension underneath desk; desk yaw zero.",
"photos": [
- "/home/timessage/图片/a7/IMG20260928115533.jpg",
- "/home/timessage/图片/a7/IMG20260928115542.jpg",
- "/home/timessage/图片/a7/IMG20260928115548.jpg",
- "/home/timessage/图片/a7/IMG20260928115553.jpg"
+ "IMG20260928115533.jpg",
+ "IMG20260928115542.jpg",
+ "IMG20260928115548.jpg",
+ "IMG20260928115553.jpg"
],
"assembly": "Preserve scene/real_assembly.xml bodies, hand adapter transform and keyframes exactly; only translate the assembly to floor coordinates. No hardware actions."
},
@@ -218,7 +218,7 @@
"clearance_m": 0.0,
"note": "Fit freshly subscribed arm pose to nominal desktop contact. Finger angles remain model zero, not measured. Pure offline display alignment."
},
- "snapshot_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/layout_joint_read_20260928T052840Z/arm_snapshot.json"
+ "snapshot_file": "data/layout_joint_read_20260928T052840Z/arm_snapshot.json"
},
"measured_controller_base_height_m": 1.0059999942912263,
"display_lift_m": 0.04412237336401603,
@@ -813,5 +813,6 @@
"preserved_body_max_translation_error_m": 5.351041609389175e-12,
"all_original_keyframes_checked": 3,
"all_original_body_orientations_unchanged": true
- }
+ },
+ "historical_external_sources": "Photo/STEP names are provenance only; original external files are not bundled."
}
diff --git a/scene/real_assembly.json b/scene/real_assembly.json
index 81677be..411d249 100644
--- a/scene/real_assembly.json
+++ b/scene/real_assembly.json
@@ -4,8 +4,8 @@
"execution_authorized": false,
"purpose": "offline kinematic assembly inspection, NOT validated dynamic grasping",
"world_frame": "controller base_link; no display height offset",
- "source_arm_urdf": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/assets/controller_model/lingzuv2_description.urdf",
- "mount_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/config/left_hand_mount.json",
+ "source_arm_urdf": "assets/controller_model/lingzuv2_description.urdf",
+ "mount_file": "config/left_hand_mount.json",
"mount": {
"basis": "User: all 7 joints zero, then ONLY elbow J4 +90 degrees; palm down, 45deg to horizontal, pinky side lower.",
"status": "user_reference_resolved_not_physical_motion_validation",
@@ -64,7 +64,7 @@
"hand_side_evidence": "LEFT URDF index root y=-0.03525m, pinky root y=+0.03525m; do not reuse right-hand side signs.",
"execution_authorized": false
},
- "snapshot_file": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/left_cup_current/arm_snapshot_20260924T084830651325Z.json",
+ "snapshot_file": "data/left_cup_current/arm_snapshot_20260924T084830651325Z.json",
"snapshot_received_at_utc": "20260924T084830651325Z",
"snapshot_is_live": false,
"finger_pose": "nominal URDF zero, NOT measured hardware state",
@@ -150,7 +150,7 @@
"dynamic_mass_inertia": "not identified; viewer must not step dynamics"
},
"table_reference": {
- "source": "/home/timessage/a7l20-hug-sim/exports/a7l20-hug-sim/data/table_edge_check_20260924_01/start_edge_audit.json",
+ "source": "data/table_edge_check_20260924_01/start_edge_audit.json",
"normal": [
0.017866379380500577,
-0.04739512024276286,
diff --git a/scripts/audit_adapter_geometry.py b/scripts/audit_adapter_geometry.py
index d684bc1..f0244d2 100644
--- a/scripts/audit_adapter_geometry.py
+++ b/scripts/audit_adapter_geometry.py
@@ -26,7 +26,7 @@ def circles(path,z):
def main():
arm=circles(ROOT/'assets/controller_model/meshes/L7_Link.STL',-.0525)
- hand=circles('/home/timessage/Linkerbot_URDF/L20/LEFT/meshes/hand_base_link.STL',0.)
+ hand=circles(ROOT/'assets/L20/LEFT/meshes/hand_base_link.STL',0.)
if len(arm)!=6 or len(hand)!=4:raise RuntimeError('Hole pattern mismatch')
center=np.mean([h['center_mm'] for h in arm],axis=0)
if not np.allclose(center,[-28,0],atol=.001):raise RuntimeError('Unexpected flange center')
diff --git a/scripts/audit_cup_coordinates.py b/scripts/audit_cup_coordinates.py
index 5fb9877..37dd1dd 100644
--- a/scripts/audit_cup_coordinates.py
+++ b/scripts/audit_cup_coordinates.py
@@ -1,5 +1,6 @@
"""Audit saved transforms and IK, without hardware access."""
from pathlib import Path
+from project_paths import configured_path
import json,xml.etree.ElementTree as ET
import numpy as np,mujoco
from scipy.spatial.transform import Rotation as R
@@ -14,12 +15,12 @@ def main():
base=pose(d.body('base_link').xpos,d.body('base_link').xmat.reshape(3,3));mount=json.loads((ROOT/'config/left_hand_mount.json').read_text());M=np.array(mount['rotation_Arm_Tip_to_hand']);tiphand=pose(mount['translation_Arm_Tip_to_hand_m'],M);l7hand=pose(mount['translation_L7_to_hand_m'],M)
h=pose(d.body('left_hand_hand_base_link').xpos,d.body('left_hand_hand_base_link').xmat.reshape(3,3));tip=pose(d.site('left_Arm_Tip').xpos,d.site('left_Arm_Tip').xmat.reshape(3,3));l7=pose(d.body('L7_Link').xpos,d.body('L7_Link').xmat.reshape(3,3))
rep={'hardware_connected':False,'base_world_translation_m':base[:3,3].tolist(),'mount':{'tip_to_hand_matrix_error':float(abs(np.linalg.inv(tip)@h-tiphand).max()),'L7_to_hand_matrix_error':float(abs(np.linalg.inv(l7)@h-l7hand).max())}}
- meta=json.loads((ROOT/'scene/measured_layout.json').read_text());snap=json.loads(Path(meta['snapshot_file']).read_text());rep['controller_fk']={}
+ meta=json.loads((ROOT/'scene/measured_layout.json').read_text());snap=json.loads((ROOT / meta['snapshot_file']).read_text());rep['controller_fk']={}
for side in ['left','right']:
p=snap['states'][side]['pose'];expected=pose([p['position'][x] for x in 'xyz'],R.from_quat([p['orientation'][x] for x in 'xyzw']).as_matrix());site=d.site(side+'_Arm_Tip');actual=np.linalg.inv(base)@pose(site.xpos,site.xmat.reshape(3,3));rep['controller_fk'][side]={'position_mm':float(np.linalg.norm(actual[:3,3]-expected[:3,3])*1000),'rotation_deg':float(np.degrees(R.from_matrix(expected[:3,:3].T@actual[:3,:3]).magnitude()))}
cap=ROOT/'data/cup_sim_capture_20260928';cam=json.loads((cap/'camera.json').read_text());T=np.array(cam['T_world_cam_opencv']);npz=np.load(cap/'hug_cup.npz');rep['hug_camera_to_world']={'landmarks_max_error_m':float(abs(npz['landmarks_cam']@T[:3,:3].T+T[:3,3]-npz['landmarks_world']).max()),'wrist_matrix_error':float(abs(T@npz['T_cam_wrist']-npz['T_world_wrist']).max()),'exported_camera_matrix_error':float(abs(T-npz['T_world_cam']).max())}
# Compare all common hand-joint transforms/axes; virtual fingertip additions are allowed.
- paths=[ROOT/'assets/l20_left_mj.urdf',Path('/home/timessage/do-as-i-do/retargeting/config/l20/l20_left_with_tips.urdf')];trees=[ET.parse(p).getroot() for p in paths];maps=[{j.get('name'):j for j in t.findall('joint')} for t in trees];diff=[]
+ paths=[ROOT/'assets/l20_left_mj.urdf',configured_path('REFERENCE_LEFT_URDF', 'external/reference/l20_left_with_tips.urdf', required=True)];trees=[ET.parse(p).getroot() for p in paths];maps=[{j.get('name'):j for j in t.findall('joint')} for t in trees];diff=[]
for name,a in maps[0].items():
b=maps[1].get(name)
if b is None:diff.append([name,'missing']);continue
diff --git a/scripts/check_index_board_hover.py b/scripts/check_index_board_hover.py
index e39bfa7..a7f1cde 100644
--- a/scripts/check_index_board_hover.py
+++ b/scripts/check_index_board_hover.py
@@ -8,6 +8,7 @@ import argparse
import tempfile
import xml.etree.ElementTree as ET
from pathlib import Path
+from project_paths import configured_path
import numpy as np
import trimesh
@@ -22,7 +23,7 @@ from search_cup_poses_offline import PoseGuard
def hand_geometry(raw):
lookup = LeftLookup()
values = {k: v['table_angle_rad'] for k, v in lookup.describe(raw).items()}
- path = Path('/home/timessage/Linkerbot_URDF_cal/L20/LEFT/linkerhand_g20_left.urdf')
+ path = configured_path('CALIBRATED_LEFT_URDF', 'external/calibrated_left/linkerhand_g20_left.urdf', required=True)
robot = ET.parse(path).getroot()
transforms = {'hand_base_link': np.eye(4)}
pending = list(robot.findall('joint'))
diff --git a/scripts/g20_left_lookup.py b/scripts/g20_left_lookup.py
index cb9839c..950f36c 100644
--- a/scripts/g20_left_lookup.py
+++ b/scripts/g20_left_lookup.py
@@ -7,8 +7,9 @@ import hashlib
import json
import math
from pathlib import Path
+from project_paths import configured_path
-DEFAULT_TABLE = Path('/home/timessage/Linkerbot_URDF/L20/LEFT/g20_left_G20.json')
+DEFAULT_TABLE = configured_path('G20_LEFT_TABLE', 'assets/L20/LEFT/g20_left_G20.json')
# SDK20 motor_index -> native G20 (finger index, payload slot).
MOTOR_SLOT = {0:(0,2), 5:(0,1), 10:(0,0), 15:(0,5)}
for _i in range(1,5):
diff --git a/scripts/hand_mapper.py b/scripts/hand_mapper.py
index f9ccaf5..1d34621 100644
--- a/scripts/hand_mapper.py
+++ b/scripts/hand_mapper.py
@@ -31,9 +31,10 @@
import sys
import numpy as np
from pathlib import Path
+from project_paths import configured_path
# 导入 LinkerHand SDK 的映射工具
-SDK_PATH = Path.home() / "linkerhand-python-sdk"
+SDK_PATH = configured_path('LINKERHAND_SDK_ROOT', 'external/linkerhand-python-sdk')
sys.path.insert(0, str(SDK_PATH / "LinkerHand" / "utils"))
from mapping import arc_to_range_right_l20, arc_to_range_left_l20, is_within_range
diff --git a/scripts/hug_infer_point.py b/scripts/hug_infer_point.py
index 357161e..715f3e2 100644
--- a/scripts/hug_infer_point.py
+++ b/scripts/hug_infer_point.py
@@ -1,14 +1,15 @@
"""无头跑 HUG:对采集目录里的 RGB-D,在指定像素(或 camera.json 里记录的物体像素)处采样 N 个人手抓取。
-解释器:~/hug/.venv/bin/python(HUG 环境)。
-用法:cd ~/hug && HF_HUB_OFFLINE=1 .venv/bin/python ~/a7l20-hug-sim/scripts/hug_infer_point.py \
- --capture ~/a7l20-hug-sim/data/capture_ready --object jar --num 16 [--steps 1]
+解释器:$HUG_PYTHON(HUG 环境)。
+用法(仓库根目录):HF_HUB_OFFLINE=1 "$HUG_PYTHON" scripts/hug_infer_point.py \
+ --capture data/capture_ready --object jar --num 16 [--steps 1]
输出:/hug_