From 3cb727e1518a9c11b5ee3025b83b305a82396ed8 Mon Sep 17 00:00:00 2001 From: SkyLi Date: Tue, 2 Jun 2026 16:41:06 +0800 Subject: [PATCH] refactor: remove deprecated zero_force field from manual control frame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VISION_MANUAL_LEN 11→10, frame [SOF:0xA6][yaw_velocity:4][pitch_velocity:4][checksum:1]. Protocol comment, docs, README struct diagram all updated. --- README.md | 5 ++--- docs/host_comm_guide.md | 14 ++++++-------- modules/master_machine/master_machine.c | 5 ++--- modules/master_machine/master_machine.h | 8 +++----- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 079e8ac..37b7da0 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ main() | 帧头 | 长度 | 用途 | |------|------|------| | 0xA5 | 10 | 自动/视觉追踪数据帧 (error_x, error_y) | -| 0xA6 | 11 | 手动控制数据帧 (zero_force, yaw_velocity, pitch_velocity) | +| 0xA6 | 10 | 手动控制数据帧 (yaw_velocity, pitch_velocity) | | 0xA7 | 3 | 命令帧 (模式切换, 激光) | | 0xA8 | 50 | 调试调参帧 (12 个 float PID 参数) | @@ -135,7 +135,7 @@ main() ``` 上位机 USART10 → DecodeVision() → vision_data (全局结构体) ├── 0xA5 → auto_updated=1, error_x/y - ├── 0xA6 → manual_updated=1, zero_force, yaw/pitch velocity + ├── 0xA6 → manual_updated=1, yaw/pitch velocity ├── 0xA7 → cmd_pending=1, cmd └── 0xA8 → debug_updated=1, 12 个 PID 参数 @@ -323,7 +323,6 @@ typedef struct { typedef struct { float error_x, error_y; // 自动模式: 归一化误差 uint8_t auto_updated; - uint8_t zero_force; // 手动模式: 零力标志 float yaw_degree_velocity, pitch_degree_velocity; // 手动模式: 角速度 uint8_t manual_updated; // 调试模式数据 diff --git a/docs/host_comm_guide.md b/docs/host_comm_guide.md index 145e967..a989070 100644 --- a/docs/host_comm_guide.md +++ b/docs/host_comm_guide.md @@ -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('