Refactor control parameters and enhance depth handling for tomato harvesting

- Updated YOLO model path to a relative path.
- Introduced new parameters for depth handling, including minimum and maximum depth, fallback settings, and pixel validation thresholds.
- Increased maximum pick angle to accommodate wider fruit stems.
- Added cut pull assist feature with configurable options.
- Removed unused resource path resolution functions from control_core.py.
- Simplified resource path handling in main.py.
- Updated UI colors and styles for improved aesthetics.
- Removed outdated requirements.txt file.
This commit is contained in:
Brunsmeier
2026-07-14 15:12:08 +08:00
parent b1b17ba9f5
commit 47c08a6466
6 changed files with 180 additions and 604 deletions

View File

@ -113,56 +113,6 @@ start_tomatopick.bat
如果需要桌面入口,可以自行在桌面创建快捷方式,并把目标指向 `start_tomatopick.bat`
## PyInstaller 打包
本项目已经附带 PyInstaller 配置文件:
- `TomatoPick.spec`
- `build_windows_exe.bat`
- `build_linux.sh`
打包时会一起带上:
- `models/` 下的 YOLO 模型文件
- `tools/1.png` 背景图
- `ultralytics` 的运行数据
- `pyrealsense2``pyaubo_sdk``pyaubo_agvc_sdk` 的动态库
### Windows 打包 exe
需要在 Windows 机器上执行PyInstaller 不能在 Linux 上直接交叉生成可运行的 Windows `.exe`
```bat
build_windows_exe.bat
```
生成结果:
```text
dist\TomatoPick\TomatoPick.exe
```
### Linux 打包可执行文件
在 Linux 上执行:
```bash
chmod +x build_linux.sh
./build_linux.sh
```
生成结果:
```text
dist/TomatoPick/TomatoPick
```
### 打包后资源路径说明
- 默认模型路径已调整为 `models/best.pt`
- 背景图会优先在打包资源目录中查找 `tools/1.png`
- `ui_settings.json` 在打包后会保存到可执行文件所在目录,而不是 PyInstaller 的临时解包目录
界面中主要按钮:
- `启动程序`运行完整采摘流程会连接机械臂、AGV、RealSense 并加载 YOLO。
@ -234,6 +184,16 @@ best.pt
模型类别、关键点顺序和训练定义需要与上述逻辑一致。
### 真实果梗的适配
采摘流程仍保持原来的两关键点和单次剪刀动作:第 0 点用于定位采摘点,第 1 点只用于计算末端角度。为适应真实串番茄,控制参数新增了以下处理:
- 剪切点深度无效时,先扩大邻域取中位深度;仍失败时沿第 0 点到第 1 点的果梗方向取有限次数的邻近深度,并将该深度用于剪切点反投影。
- 关键点连线按无方向直线处理,方向点在剪切点的上方、下方或侧方均可;默认最大末端旋转已提高到 $70^\circ$。
- `CUT_PULL_ASSIST_ENABLED` 默认关闭。没有“已剪断”传感反馈时,程序不能可靠判断剪刀是否剪断了老梗。确认撤离方向、碰撞空间和末端承载能力后,才可开启该项,以在原有撤离前增加一个小的 Y 向拉拽动作。
首次调试建议保持辅助拉拽关闭,先以低速确认深度回退输出、关键点角度和机械臂姿态均正确。
## 运行前检查
完整采摘流程会控制真实硬件。启动前请确认: