資源簡介
MATLAB程序,能直接處理SICK官方軟件SOPAS導出的log數據文件,生成3D點云圖
代碼片段和文件信息
clear?all
clc
angle_orign_temp?=?[];
angle_step_temp?=?[];
data_length_temp?=?[];
data_range_temp?=[];
data_range?=?[];
data_orign?=?importdata(‘F:\20171204-2.log‘);
[rowcol]=size(data_orign);
for?i_frame?=?1:row
data_orign_temp1?=?strcat(data_orign{i_frame1});????????????????%把讀到的按行存的cell格式轉換成字符串
header_pos?=?findstr(data_orign_temp1‘<02>‘);
data_orign_temp11=?data_orign_temp1(header_pos:end);
data_orign_temp11(find(data_orign_temp11?==?‘<‘))?=?[];?????%去掉字符串中的空格
data_orign_temp2?=?strrep(data_orign_temp11‘>‘‘?‘);????????%用空格替換>
data_orign_temp3?=?regexp(data_orign_temp2?‘?‘?‘split‘);?%按空格將string分割成數組
data_orign_dec?=?hex2dec(data_orign_temp3)‘;????%進制轉換
flag?=?[4848484848484848];???????????????????????????%原始幀結構中的預留標志段,8個0,十進制
flag_postion?=?findstr(data_orign_decflag?);??????????%尋找標志段所在位置
data_orign_use?=?data_orign_dec(flag_postion+8:end);???
%LMS511以空格來區分不同字段,每個字段有各自的含義,只取有用部分
spc_location?=?find(data_orign_use?==?32);???????????%找出空格字符所在的下標
%提取起始角度
for?i1?=?spc_location(1)+1:?spc_location(2)-1
????angle_orign_temp?=?strcat(angle_orign_tempchar(data_orign_use(i1)));
end
if(angle_orign_temp(1)?==?‘F‘)
angle_orign?=?hex2dec(angle_orign_temp)?-?2^32;?%起始角度未負的話,用8位十六進制表示,最高位為F
angle_orign?=?(angle_orign/10000)*pi/180;
else
????angle_orign?=?hex2dec(angle_orign_temp);
????angle_orign?=?(angle_ori
評論
共有 條評論