-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogSensorSubFcn.m
71 lines (65 loc) · 2.37 KB
/
logSensorSubFcn.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function logSensorSubFcn(timeStamp,location, orientation,bevImage,bevSemanticImage)
% Brief: 用于simulink matlab function模块的调用函数,记录传感器数据,便于C++使用其数据
% Details:
% 子函数,undefined function时候,可以独立为m文件使用
%
% Syntax:
% logSensorSubFcn(timeStamp,egoVelocity,poseEgoInGlobalWorld,positionRotationEgoInGloableWorld,imgFrontSurround,imgRearSurround,imgLeftSurround,imgRightSurround,imageImgFrontWindshield,ultrasonicData)
%
% Inputs:
% timeStamp - [1,1] size,[double] type,Description
% egoVelocity - [1,1] size,[double] type,Description
% poseEgoInGlobalWorld - [1,3] size,[double] type,Description
% positionRotationEgoInGloableWorld - [1,6] size,[double] type,Description
% imgFrontSurround - [m,n] size,[None] type,Description
% imgRearSurround - [m,n] size,[None] type,Description
% imgLeftSurround - [m,n] size,[None] type,Description
% imgRightSurround - [m,n] size,[None] type,Description
% imageImgFrontWindshield - [M,N] size,[None] type,Description
% ultrasonicData - [1,12] size,[double] type,Description
%
% Outputs:
% None
%
% Example:
% None
%
% See also: None
% Author: cuixingxing
% Email: cuixingxing150@gmail.com
% Created: 26-Jul-2022 13:43:21
% Version history revision notes:
% None
% Implementation In Matlab R2022a
% Copyright © 2022 TheMatrix.All Rights Reserved.
%
arguments
% required
timeStamp (1,1) double
location
orientation
bevImage
bevSemanticImage
end
% step1: initialize variables
persistent numStep allTT
if isempty(numStep)
numStep = 1;
timeStamp = duration(seconds(timeStamp));
currTT = timetable(timeStamp,location,orientation);% corresponding to C++ mat2BinStruct type
allTT = currTT;
else
timeStamp = duration(seconds(timeStamp));
currTT = timetable(timeStamp,location,orientation);% corresponding to C++ mat2BinStruct type
allTT = [allTT;currTT];
end
% step2: write current images
img1Name = sprintf("./results/original/%05d.jpg",numStep);
img2Name = sprintf("./results/semantic/%05d.png",numStep);
imwrite(bevImage,img1Name);
imwrite(bevSemanticImage,img2Name);
% step3: write csv sensor data
writetimetable(allTT,"./results/sensorData.csv");
% step4: numStep plus one
numStep = numStep+1;
end