Files
amadeus_26/docs/Transmit/ctrl_frame.md
2026-03-23 08:47:19 +08:00

1.1 KiB
Raw Permalink Blame History

SRCP 通信协议帧结构

帧格式

字段 内容 长度 说明
SOF 0xBB 0x77 2 bytes 帧头
x_move -660~660 2 bytes 平动左右 (小端序)
y_move -660~660 2 bytes 平动前后 (小端序)
yaw -660~660 2 bytes 云台偏航 (小端序)
pitch -660~660 2 bytes 云台俯仰 (小端序)
feed -660~660 2 bytes 拨弹轮 (小端序)
key 0~15 1 byte 按键
crc8 CRC8-MAXIM 1 byte 校验
EOF 0xEE 1 byte 帧尾

帧长度

SOF(2) + x_move(2) + y_move(2) + yaw(2) + pitch(2) + feed(2) + key(1) + crc8(1) + EOF(1) = 15 bytes

字节序

  • 所有 int16_t 类型字段x_move, y_move, yaw, pitch, feed使用 小端序

代码示例

constexpr int FRAME_LENGTH = 15;  // 总帧长度

frame[0] = 0xBB;                    // SOF
frame[1] = 0x77;                    // SOF
frame[2] = x_move & 0xFF;           // 低字节
frame[3] = (x_move >> 8) & 0xFF;    // 高字节
// ... 其他字段
frame[14] = 0xEE;                   // EOF