d289168dd0
先回答"这些模型到底有没有人用",用全仓库引用扫描判定,不靠猜: 在用 yolo/detect_best_0.onnx + .engine ← paths.yolo_weights 在用 hole_insert/detect_best_1.onnx ← hole_detect.weights / workpiece_weights 零引用 detect_hc90(pt/onnx/engine) ← 只剩注释里的历史说明 零引用 detect_yolo26_gongjian.pt 零引用 detect_best(onnx/engine) ← 仅代码兜底候选,而那个候选是 .pt,不存在 所以 detect_hc90 不需要修复,是不用的东西:连同另两个一起移出仓库。 注意**二进制权重被 gitignore**,删掉就找不回来了,因此是移出到 ~/ros2-models-unused-20260923/ 而非 rm。搬回 models/ 即可被 list 重新发现。 顺手挖出并修掉三处悬空引用(和之前 site.yaml 里那个 best.pt 同一类问题): - hole_detector.weights_from_site:兜底路径写死 models/hole_insert/best.pt(不存在) - hole_detector._default_model_path:三个候选路径**全都不存在**,函数却 `return candidates[0]`,于是永远返回不存在的 best.pt;报错路径看着很合理, 极易被误判成"文件被误删"。现改为以 site.yaml 为准,再退到规范模型。 - config/hole_insert.yaml 顶部注释同样写的是 best.pt 新增 test_hole_detector.py(8 项)锁住这个回归。测试刻意**不断言文件存在** ——二进制不进 git,新克隆的仓库里 models/ 是空的——只断言解析结果指向规范模型名。 体检从 4 处问题降到 0:bash scripts/weights.sh doctor --check-engines → "没有发现问题" 测试 233 项通过;18 个包构建通过。 Co-authored-by: Cursor <cursoragent@cursor.com>
scripts — 唯一操作入口
实现细节在 docs/WORKSPACE.md 和 docs/。
每天: run_real.sh · run_camera_d405.sh · run_visual_servo_rt.sh · go_home.sh
三阶段串联: run_all.sh --arm 89 [--hole k2] [--skip-stage1](run_pipeline.sh 是它的旧名别名)
手眼: run_handeye.sh(teach / merge / calibrate / show)
夹爪: run_gripper.sh --arm 89|91 · run_dual_gripper.sh
入孔: run_hole_detect.sh --arm … [--preview]
触觉: run_tactile.sh [--cli]
权重: weights.sh(list / labels / convert / doctor / show)
- 转换:
weights.sh convert <文件> --name <模型名>—— PT→ONNX→TensorRT,自动改名归位 + 固化标签 - 标签:
weights.sh labels <模型名>看,--set "工件,通止规"改 - 体检:
weights.sh doctor --check-engines(能查出 engine 与 TensorRT 版本不匹配这类静默失效) - 规则写在 models/README.md。
export_yolo_trt.sh现在是它的兼容转发壳。 配置:show_site_config.sh·lib/export_site_env.py
环境:env.sh·build_all.sh
RDK:test_rdk_python.sh·rdk_switch_tool.sh·rdk_drag_bridge.py
搁置未用:fetch_isaac_flexiv.sh(拉 Flexiv 的 Isaac Sim / RDK 源码到thirdparty/;Isaac 路线目前搁置,Gazebo 是选定平台)
lib/parse_arm_args.sh 解析 --arm 89|91。
lib/load_site_config.sh 把 config/site.yaml 变成 SITE_*。
排查脚本卡住时的常识
几个脚本开头会等外部条件(控制器 ACTIVE、相机出图、触觉就绪)。正确的判活顺序是
先 ros2 service list / ros2 topic list 看目标在不在,再去 call / echo:
# 对:服务不存在时立刻返回
timeout 3 ros2 service list | grep -q '^/controller_manager/list_controllers$' || exit 1
timeout 3 ros2 service call /controller_manager/list_controllers ...
# 错:服务不存在时每次 call 都要耗满超时才返回,
# 30 次循环 = 白等两三分钟(实测 63s),看起来就像脚本卡死了
for _i in $(seq 1 30); do timeout 5 ros2 service call ... ; done
run_all.sh / run_stage2_locate.sh / run_stage3_search.sh 已按正确顺序改过;
run_handeye.sh 一开始就是对的。