supermachine--tomato-passio.../20240529RGBtest3/通信协议(20240612).md

63 lines
3.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 百香果&西红柿通信
基于pipe命名管道数据共3个字段长度、指令、数据
| 长度1 | 长度2 | 长度3 | 长度4 | 指令1 | 指令2 | 数据1 | 数据2 | ... | 数据i |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :--: | :---: |
| 8'hzz | 8'hzz | 8'hzz | 8'hzz | 8'hzz | 8'hzz | 8'hzz | 8'hzz | ... | 8'hzz |
## 长度
一个32位无符号数length长度 = 数据字节数i + 6 。<br>`长度1`指length[31:24]`长度2`指length[23:16]`长度3`指length[15:8]`长度4`指length[7:0]
## 指令
ASCII字符共2字节16位比如`指令1`为'T'`指令2`为'O',代表番茄数据包
具体指令:
| 指令1 | 指令2 | 指令含义 |
| :---: | :---: | :----------: |
| T | O | 番茄数据 |
| P | F | 百香果数据 |
| R | E | 返回结果数据 |
## **数据**
**RGB图像数据包'指令1''指令2 '**`数据1`~`数据i`包含了图像的行数rows(高度)、列数cols(宽度)、以及图像的RGB数据组合方式为**高度+宽度+RGB数据**
$$
i-4=rows \times cols \times 3
$$
`数据1`~`数据i`的分布具体如下:
| 行数1 | 行数2 | 列数1 | 列数2 | 图像数据1 | ... | 图像数据(i-4) |
| :--------: | :-------: | :--------: | :-------: | :-------: | :--: | :-----------: |
| rows[15:8] | rows[7:0] | cols[15:8] | cols[7:0] | | ... | |
**光谱数据包:' 指令1''指令2 '**`数据1`~`数据i`包含了光谱数据的行数rows(高度)、列数cols(宽度)、谱段数bands、以及光谱数据组合方式为**高度+宽度+谱段数+光谱数据**
$$
i-6=rows \times cols \times bands \times 4
$$
`数据1`~`数据i`的分布具体如下:
| 行数1 | 行数2 | 列数1 | 列数2 | 谱段1 | 谱段2 | 图像数据1 | ... | 图像数据(i-6) |
| :--------: | :-------: | :--------: | :-------: | :---------: | :--------: | :-------: | :--: | :-----------: |
| rows[15:8] | rows[7:0] | cols[15:8] | cols[7:0] | bands[15:8] | bands[7:0] | | ... | |
**返回结果数据包:'R''E'**`数据1`~`数据i`包含了糖度值Brix、颜色占比color、直径long、预估重量weight、缺陷个数num、缺陷面积area、结果图像的行数rows(高度)、列数cols(宽度)、以及结果图像的RGB数据组合方式为**糖度值+颜色占比+直径+预估重量+缺陷个数+缺陷面积+高度+宽度+RGB数据**
$$
i-15=rows \times cols \times 3
$$
`数据1`~`数据i`的分布具体如下:
| 糖度值 | 颜色占比 | 直径2 | 直径1 | 预估重量 | 缺陷个数1 | 缺陷个数2 | 缺陷面积1 | 缺陷面积2 | 缺陷面积3 | 缺陷面积4 | 行数1 | 行数2 | 列数1 | 列数2 | 图像数据1 | ... | 图像数据(i-16) |
| :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | --- | --- | --- |
| Brix[7:0] | color[7:0] | long[15:8] | long[7:0] | weight[7:0] | num[15:8] | num[7:0] | area[31:24] | area[23:16] | area[15:8] | area[7:0] | rows[15:8] | rows[7:0] | cols[15:8] | cols[7:0] | | ... | |