function [] = read_serial_port_and_showFFT(comportSnum)
global load_parking_assist load_point_cloud_srr load_point_cloud_usrr load_clusters load_trackers view_range use_perspective_projection;
global platformType MAX_NUM_OBJECTS OBJ_STRUCT_SIZE_BYTES MAX_NUM_CLUSTERS;
global CLUSTER_STRUCT_SIZE_BYTES TOTAL_PAYLOAD_SIZE_BYTES MAX_NUM_TRACKERS;
global TRACKER_STRUCT_SIZE_BYTES STATS_SIZE_BYTES bytevec_log readUartFcnCntr;
global ELEV_VIEW EXIT_KEY_PRESSED BYTE_VEC_ACC_MAX_SIZE bytevecAcc;
global BYTES_AVAILABLE_FCN_CNT BYTES_AVAILABLE_FLAG bytevecAccLen StatsInfo;
global activeFrameCPULoad interFrameCPULoad guiCPULoad guiProcTime;
global loggingEnable fidLog recordingHandle;
% The SRR demo only works on the 1642.
platformType = hex2dec('1642');
MMWDEMO_UART_MSG_DETECTED_POINTS = 1;
MMWDEMO_UART_MSG_CLUSTERS = 2;
MMWDEMO_UART_MSG_TRACKED_OBJ = 3;
MMWDEMO_UART_MSG_PARKING_ASSIST = 4;
MMWDEMO_UART_MSG_TRACKED_OBJ = 5;
MMWDEMO_UART_MSG_STATS = 6;
MMWDEMO_UART_MSG_STATS = 7;
load_point_cloud_srr = 1;
load_point_cloud_usrr = 1;
load_clusters = 1;
load_trackers = 1;
view_range = 0;
load_parking_assist = 0;
view_range_curr = view_range;
%% Initialize some constants.
MAX_NUM_OBJECTS = 200;
OBJ_STRUCT_SIZE_BYTES = 8;
MAX_NUM_CLUSTERS = 24;
CLUSTER_STRUCT_SIZE_BYTES = 8;
MAX_NUM_TRACKERS = 24;
TRACKER_STRUCT_SIZE_BYTES = 12;
STATS_SIZE_BYTES = 16;
bytevec_log = zeros(0,1,'single');
readUartFcnCntr = 0;
ELEV_VIEW = 3;
EXIT_KEY_PRESSED = 0;
BYTES_AVAILABLE_FLAG = 0;
BYTES_AVAILABLE_FCN_CNT = 32*8;
BYTE_VEC_ACC_MAX_SIZE = 2^20;
bytevecAcc = zeros(BYTE_VEC_ACC_MAX_SIZE,1);
bytevecAccLen = 0;
%% Some more Initialisations
StatsInfo.interFrameProcessingTime = 0;
StatsInfo.transmitOutputTime = 0;
StatsInfo.interFrameProcessingMargin = 0;
StatsInfo.interChirpProcessingMargin = 0;
StatsInfo.interFrameCPULoad = 0;
StatsInfo.activeFrameCPULoad = 0;
activeFrameCPULoad = zeros(100,1,'single');
interFrameCPULoad = zeros(100,1,'single');
guiCPULoad = zeros(100,1,'single');
view_range = 0;
guiProcTime = 0;
displayUpdateCntr = 0;
timeout_ctr = 0;
bytevec_cp_max_len = 2^18;
bytevec_cp = zeros(bytevec_cp_max_len,1,'uint8');
bytevec_cp_len = 0;
packetNumberPrev = 0;
loggingEnable = 0;
fidLog = 0;
use_perspective_projection = 0;
prev_use_perspective_projection = use_perspective_projection;
% %% Parse CLI parameters
% Params = generate_params_for_SRR();
%% 雷达参数设置
% parameter = generateParameter();
% numADCSamples = parameter.Samples; % number of ADC samples per chirp
% numADCBits = 16; % number of ADC bits per sample
% numRx = 4; % number of receivers
% numTx =1;
% numLanes = 2; % do not change. number of lanes is always 2
% isReal = 0; % set to 1 if real only data, 0 if complex data0
% chirpLoop = parameter.Chirps;
%% Configure monitoring UART port
sphandle = configureSport(comportSnum);
recordingHandle.enable = 1;
if recordingHandle.enable == 1
recordingHandle.size = 2^18;
recordingHandle.indx = 1;
recordingHandle.array = zeros(recordingHandle.size,1,'uint8');
end
% % Initialize the GUI.
% guiMonitor = gui_initializer(Params, dim);
magicNotOkCntr=0;
% Every packet from the AWR1642 has the following barker code at the beginning.
barker_code = char([2 1 4 3 6 5 8 7]);
%-------------------- Main Loop ------------------------
while (~EXIT_KEY_PRESSED )
%Read bytes from the UART port.
readUartCallbackFcn(sphandle, 0);
disp("Waiting Buffer fill");
recordingHandle.indx
% If bytes are available, append the new bytes to bytevec_cp
if BYTES_AVAILABLE_FLAG == 1
BYTES_AVAILABLE_FLAG = 0;
fprintf('bytevec_cp_len, bytevecAccLen = %d %d \n',bytevec_cp_len, bytevecAccLen)
if (bytevec_cp_len + bytevecAccLen) < bytevec_cp_max_len
bytevec_cp(bytevec_cp_len+1:bytevec_cp_len + bytevecAccLen) = bytevecAcc(1:bytevecAccLen);
bytevec_cp_len = bytevec_cp_len + bytevecAccLen;
bytevecAccLen = 0;
else
fprintf('Error: Buffer overflow, bytevec_cp_len, bytevecAccLen = %d %d \n',bytevec_cp_len, bytevecAccLen)
bytevecAccLen = 0;
bytevec_cp_len = 0;
end
end
try
bytevecStr = (bytevec_cp);
magicOk = 0;
% if the bytevecStr is atleast as large as the header, check if it contains the header.
if (bytevec_cp_len > 72) && (size(bytevecStr,2) == 1)
startIdx = strfind(bytevecStr', barker_code);
else
startIdx = [];
end
% abstruct a frame data from buff,startIdx is the first of the frame index.
if ~isempty(startIdx)
if startIdx(1) > 1
bytevec_cp(1: bytevec_cp_len-(startIdx(1)-1)) = bytevec_cp(startIdx(1):bytevec_cp_len);
bytevec_cp_len = bytevec_cp_len - (startIdx(1)-1);
end
if bytevec_cp_len < 0
fprintf('Error: %d %d \n',bytevec_cp_len, bytevecAccLen)
bytevec_cp_len = 0;
end
packetlenNum = single(bytevec_cp(8+4+[1:4]));
totalPacketLen = sum(packetlenNum .* [1 256 65536 16777216]');
if bytevec_cp_len >= totalPacketLen
magicOk = 1;
else
magicOk = 0;
end
end
% parse the framedata
byteVecIdx = 0; % index of the inner frame
if(magicOk == 1)
%tStart = tic;
bytevec_cp_flt = single(bytevec_cp);
% Extract the header.
[Header, byteVecIdx] = getHeader(bytevec_cp_flt, byteVecIdx);
sfIdx = Header.subframeNumber+1;
if (sfIdx > 2) || (Header.numDetectedObj > MAX_NUM_OBJECTS)
continue;
end
detObj.numObj = 0;
clusterObj.numObj = 0;
trackedObj.numObj = 0;
detObj.peakIndex=zeros(1,3);
% Extract each of the TLVs (type length value) in the current message.
for tlvIdx = 1:Header.numTLVs
[tlv, byteVecIdx] = getTlv(bytevec_cp_flt, byteVecIdx);
switch tlv.type
case MMWDEMO_UART_MSG_DETECTED_POINTS
% if tlv.length >= OBJ_STRUCT_SIZE_BYTES
% [detObj, byteVecIdx] = getDetObj(bytevec_cp_flt, ...
% byteVecIdx, ...
% tlv.length);
% end
case MMWDEMO_UART_MSG_CLUSTERS %ADC samples data output.512*4*2 complex data
% if tlv.length >= CLUSTER_STRUCT_SIZE_BYTES
% [clusterObj, byteVecIdx] = getClusters(bytevec_cp_flt, ...
% byteVecIdx, ...
% tlv.length);
% end
%
if tlv.length >= CHIRP_STRUCT_SIZE_BYTES
[RangeObj, byteVecIdx] = ChirpDataProcess(bytevec_cp_flt, ...
byteVecIdx, ...
tlv.length);
detObj.peakIndexall=[detObj.peakIndex,RangeObj];
end
case MMWDEMO_UART_MSG_TRACKED_OBJ
% if tlv.length >= TRACKER_STRUCT_SIZE_BYTES
% [trackedObj, byteVecIdx] = getTrackers(bytevec_cp_flt, byteVecIdx, tlv.length);
% end
case MMWDEMO_UART_MSG_PARKING_ASSIST
% [parkingAssistRangeBins, byteVecIdx] = getParkingAssistBins(bytevec_cp_flt, byteVecIdx, tlv.length);
case MMWDEMO_UART_MSG_STATS
% [StatsInfo, byteVecIdx]
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
HighAccuracyDemo_6843_matlabProject.rar (16个子文件)
ParseHighAccuracyData(1)
ParseHighAccuracyData(1)
PraseData.m 244B
01.bin 17KB
PraseData.asv 236B
read_file_and_plot_object_location.asv 24KB
read_serial_port_and_plot_object_location.m 24KB
02.bin 242KB
read_serial_port_and_showFFT.m 27KB
04.bin 240KB
06.bin 240KB
read_serial_port_and_showFFT.asv 27KB
read_file_and_plot_object_location.m 25KB
configureSport.m 3KB
03.bin 240KB
generateParameter.m 2KB
05.bin 240KB
串口功能演示.mp4 8.69MB
共 16 条
- 1
资源评论
雷达爆破手
- 粉丝: 179
- 资源: 37
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于matlab实现用有限元法计算电磁场的Matlab工具 .rar
- 基于matlab实现有限元算法 计算电磁场问题 边界条件包括第一类边界和第二类边界.rar
- 基于matlab实现用于计算不同车重下的电动汽车动力性和经济性.rar
- 基于matlab实现遗传算法求解多车场车辆路径问题 有多组算例可以用.rar
- 浏览器.apk
- 基于matlab实现是一个matlab中的power system 中搭建的一个模型
- 基于JSP毕业设计-教学管理系统(源代码+论文).zip
- 基于JSP毕业设计-家政管理系统-毕业设计.zip
- 基于Python实现淘宝商品评论采集(含逆向)源代码
- 基于matlab实现多目标进化算法NSGAⅡ&Matlab讲解.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功