forked from jason-bula/velodyne_tls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalibration_demo.m
80 lines (60 loc) · 1.8 KB
/
calibration_demo.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
72
73
74
75
76
77
78
79
80
%% Hardware Calibration : Point Cloud Densification
% Author : Jason Bula
% Under the supervision of : Grégoire Mariéthoz
% University of Lausanne
%% Directory Management
clear, close all
% Calibration function to call : 1 for alpha1, 2 for alpha2
calibration = 2;
% Source files folder (.pcap)
global input
input = 'C:\Users\jason\Desktop\Dense point cloud acquisition with a low-cost Velodyne VLP-16';
% Result folder
global output
output ='C:\Users\jason\Desktop\Dense point cloud acquisition with a low-cost Velodyne VLP-16';
% input file name
global input_file_name
input_file_name = 'baulmes_demo.pcap';
% output file name
global output_file_name
output_file_name = 'calib';
%% Initialization of parameters
global times
times = 1800; % Scan duration in tenths of a second (sec^-1)
global angle
angle = 360; % LiDAR rotation angle
global first
first = 199; % Time at the first frame
% Process Speed : set to 1,2 or 5 (5 is the fastest)
global mult
mult = 2;
% The length of the arm
global R
R = 0.0945;
% the distance from the lidar where the optimization is done
global Range
Range = [4 30];
global gridStep
gridStep = 0.01;
cd(input)
global veloReader
veloReader = velodyneFileReader(input_file_name,'VLP16');
%theta0 = [0 0];
cd(input);
%% Calibration alpha1
if calibration == 1
options = optimset('Display','iter','PlotFcns',@optimplotfval);
% Initial parameter
theta00 = 3;
fun = @alpha1_calibration;
[x,fval,exitflag,output] = fminsearch(fun,theta00,options)
%cd(output)
end
%% Calibration alpha2
if calibration == 2
options = optimset('Display','iter','PlotFcns',@optimplotfval);
% Initial parameter
theta00 = 0;
fun = @alpha2_calibration;
[x,fval,exitflag,output] = fminsearch(fun,theta00,options)
end