完善夹爪界面、跨平台打包与运行日志

This commit is contained in:
cheng
2026-07-15 16:10:31 +08:00
parent 73ce84f586
commit 45630e6d77
13 changed files with 1001 additions and 201 deletions
+48 -1
View File
@@ -68,9 +68,27 @@ pip install pyinstaller PyOpenGL PyOpenGL_accelerate
然后从项目根目录运行:
```powershell
build\build_exe.bat
python build\build_exe.py
```
默认使用轻量打包配置,使用 OpenCV DIS 光流和 CPU Poisson 后端,不打包
Torch/CUDA、CuPy 和 Orisys 可选的 Open3D 查看器。项目自己的 PyOpenGL
夹爪 3D 模型仍然可用。当前参考产物约为 340 MiB:
```powershell
python build\build_exe.py --profile lite --clean-dist
```
只有需要 RAFT/CUDA 或 CuPy 后端时才使用完整配置。完整配置会包含 CUDA
运行库,产物通常为数 GB:
```powershell
python build\build_exe.py --profile full --clean-dist
```
轻量配置要求传感器配置中的 `tracker.algorithm` 为 `dis`;打包脚本会在
构建前检查并阻止错误的 RAFT 轻量包。
输出文件在:
```text
@@ -86,6 +104,35 @@ dist\GripperDemo02\sdk
现场修改参数时,直接改 exe 同级的 `config\gripper.json`。
窗口版 EXE 的运行日志保存在同级 `logs` 目录。`logs\latest.txt` 记录最近
一次运行的会话目录;其中 `main.log` 是 GUI/控制日志,`worker_*.log` 是
左右传感器进程日志,并包含 OpenCV 原生警告和异常 traceback。程序自动保留
最近 10 次运行。
### Linux
Windows 生成的 `.exe` 仅用于 Windows。Linux 需要在 Linux 环境使用同一份
源码重新安装依赖和打包,推荐 Python 3.11:
```bash
python3.11 -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
pip install -e ../orisys-sdk
python build/build_exe.py --profile lite --clean-dist
```
Linux 产物没有 `.exe` 后缀,位于 `dist/GripperDemo02/GripperDemo02`。直接
运行源码可使用:
```bash
python -m gripper.visualizer --windowed
```
将 `config/gripper.json` 的串口从 `COM*` 改为实际设备,例如
`/dev/ttyUSB0`;摄像头通常对应 `/dev/video0` 和 `/dev/video1`。运行用户需
拥有 `video` 与 `dialout` 设备组权限。WSL 还需要先透传 USB 摄像头和串口。
## 关键配置
- `trigger_normal_force`: 单侧法向力触发阈值。