工具/软件:
您好、我正在使用配置为仅使用 MRR 子帧的 MRR Lab。 但雷达模块似乎一次每 60ms 发送两个 MRR 子帧、而不是每 30ms 发送一个 MRR 子帧、因此即使每个子帧的持续时间为 30ms、但我没有获得 30fps、因为雷达模块固定在第一个子帧上等待第二个子帧完成、然后再发送出去。 下面是我用于解码传入原始数据的 python 代码、您可以看到、我每次收到的消息都有两个标头、即两个子帧。 如何更改 MRR 代码、使其每 30ms 发出子帧、也许是 dss_main.c 中的 MRR_DSS_DataPathOutputLogging 函数?
import serial
from mrr_structs import MRR_session
magic_word = b"\x02\x01\x04\x03\x06\x05\x08\x07"
ser = serial.Serial('COM5', 921600, timeout=0.1)
buffer = b""
def update():
global buffer
if ser.in_waiting:
buffer += ser.read(ser.in_waiting)
ptr = buffer.find(magic_word)
count = buffer.count(magic_word)
print(count)
if ptr != -1:
try:
session = MRR_session(buffer, ptr)
messages = session.get_dict()
print(messages)
##OUTPUT##
#{'messages': [{'header': {'magic_word_0': 258, 'magic_word_1': 772, 'magic_word_2': 1286, 'magic_word_3': 1800, 'version': 50725376, 'totalPacketLen': 64, 'platform': 661058, 'frameNumber': 93315, 'timeCpuCycles': 389067100, 'numDetectedObj': 0, 'numTLVs': 0, 'subFrameNumber': 0}, 'body': []},
# {'header': {'magic_word_0': 258, 'magic_word_1': 772, 'magic_word_2': 1286, 'magic_word_3': 1800, 'version': 50725376, 'totalPacketLen': 64, 'platform': 661058, 'frameNumber': 93316, 'timeCpuCycles': 407057434, 'numDetectedObj': 0, 'numTLVs': 0, 'subFrameNumber': 0}, 'body': []}]}
##########
buffer = b""
except Exception as e:
print("Incomplete or corrupt message:", e)
while True:
update()
