release: v1.0 - WL-PRO 轮组机器人遥控脚本

反向实现设备 WebSocket 控制协议,提供单次命令与常驻长连接两种模式。

核心内容:
- robot-ctl.py     单次命令客户端,纯标准库无依赖
- robot-daemon.py  常驻守护进程,维持唯一长连接,
                   解决断开丢尾帧导致的速度残留
- rc.sh            向守护进程注入动作,内置 stable=1 硬锁
- docs/PROTOCOL.md 协议逆向与踩坑记录
- tests/fake-robot-ws.js 离线验证用假设备

实测标定 (50% 速度):
- 前进/后退 ~8 cm/s
- 左转/右转 ~35 deg/s

已知限制:
- 设备为 Arduino WebSocketsServer,纯单向,不回传状态
- 仅摇杆与跳跃有效,linear/angular/方向键无效
- 网页与脚本不可同时连接,会互相覆盖帧
This commit is contained in:
deepseek Bot committed 2026-10-25 17:53:11 +08:00
commit 6dd1fa7e24
11 files changed
+1971

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
// 用 ws 库实现的假机器人,仅用于本地验证 robot-ctl.js 的帧格式
const { WebSocketServer } = require('/root/.local/share/pnpm/global/5/.pnpm/ws@8.21.3/node_modules/ws');
const port = Number(process.argv[2] || 8905);
const wss = new WebSocketServer({ port, host: '127.0.0.1' });
let n = 0;
wss.on('connection', (ws) => {
console.log('CONNECTED');
ws.on('message', (buf) => {
n++;
const txt = buf.toString();
console.log('FRAME#' + n, txt);
ws.send(JSON.stringify({ ok: true, n, echo: JSON.parse(txt) }));
});
});
console.log('fake robot ws on', port);