forked from shenshikexmu/IMUCalibration-Gesture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathICRA2014_acc.m
50 lines (40 loc) · 1.26 KB
/
ICRA2014_acc.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
function [Ta,Ka,Ba,axis]=ICRA2014_acc(fix_point,a0)
% conference: A Robust and Easy to implement method for imu
% calibration without External Equipments
% author Zhang Xin
if nargin<2
a0=[0,0,0,0.0048,0.0048,0.0048,0,0,0];
end
B=fix_point(:,1:3)-ones(size(fix_point,1),1)*(mean(fix_point(:,1:3),1));
options=optimset('TolX',1e-6,'Algorithm','Levenberg-Marquardt',...
'Display','iter');
% options=optimset('Algorithm','Levenberg-Marquardt',...
% 'Display','iter');
%a=lsqnonlin(@elliposoid_acc,a0,[],[],options,B(:,1:3),zeros(size(B,1),1));
[a,resnorm]=lsqnonlin(@elliposoid_acc,a0,[],[],options,B(:,1:3));
Ta=[1 , -a(1), a(2);...
0 , 1 , -a(3);...
0 , 0 , 1];
Ka=[a(4) , 0 , 0;...
0 , a(5) , 0;...
0 , 0 , a(6)];
Ba=-mean(fix_point(:,1:3),1)'+[a(7);a(8);a(9)];
axis=[1/a(4);1/a(5);1/a(6)];
E=elliposoid_acc(a, B(:,1:3) );
end
function E=elliposoid_acc(a, x )
Ta=[1 , -a(1), a(2);...
0 , 1 , -a(3);...
0 , 0 , 1];
Ka=[a(4) , 0 , 0;...
0 , a(5) , 0;...
0 , 0 , a(6)];
Ba=[a(7);a(8);a(9)];
for i=1:size(x,1)
E(i,1)=(9.8-(norm(Ta*Ka*(x(i,1:3)'+Ba))));
end
% E=0;
% for i=1:size(x,1)
% E=E+(9.8^2-norm(Ta*Ka*(x(i,1:3)'+Ba))^2)^2;
% end
end