refactor: remove deprecated zero_force field from manual control frame

VISION_MANUAL_LEN 11→10, frame [SOF:0xA6][yaw_velocity:4][pitch_velocity:4][checksum:1].
Protocol comment, docs, README struct diagram all updated.
This commit is contained in:
2026-06-02 16:41:06 +08:00
parent da6acdcc89
commit 3cb727e151
4 changed files with 13 additions and 19 deletions
+6 -8
View File
@@ -53,29 +53,27 @@ def send_auto_tracking(ser, error_x: float, error_y: float):
---
## 2. 手动控制数据帧 0xA6 (11 字节)
## 2. 手动控制数据帧 0xA6 (10 字节)
**用途**: 手动模式下发送角速度目标值。
```
[SOF:0xA6][zero_force:1][yaw_velocity:4][pitch_velocity:4][checksum:1]
[SOF:0xA6][yaw_velocity:4][pitch_velocity:4][checksum:1]
```
| 偏移 | 长度 | 类型 | 含义 |
|---|---|---|---|
| 0 | 1 | uint8 | 帧头 0xA6 |
| 1 | 1 | uint8 | 零力标志 (0=正常, 1=零力) |
| 2 | 4 | float | Yaw 角速度 (degrees/s) |
| 6 | 4 | float | Pitch 角速度 (degrees/s) |
| 10 | 1 | uint8 | checksum |
| 1 | 4 | float | Yaw 角速度 (degrees/s) |
| 5 | 4 | float | Pitch 角速度 (degrees/s) |
| 9 | 1 | uint8 | checksum |
**Python 写入示例**:
```python
def send_manual_control(ser, yaw_deg_per_s: float, pitch_deg_per_s: float, zero_force: int = 0):
def send_manual_control(ser, yaw_deg_per_s: float, pitch_deg_per_s: float):
data = bytearray()
data.append(0xA6)
data.append(0 if zero_force else 0)
data.extend(struct.pack('<ff', yaw_deg_per_s, pitch_deg_per_s))
checksum = sum(data) & 0xFF
data.append(checksum)