Skip to content

Commit b6c0da5

Browse files
committed
small modifications
1 parent 39986a1 commit b6c0da5

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

Data/R2.mat

95 KB
Binary file not shown.

DataParse.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
clear all;
2-
f=fopen('Data_9_16_10_09_PM.txt');
2+
f=fopen('Data/Data_9_16_10_09_PM.txt');
33

44
%%
55
%fgetl(f);%for Roll, pitch and yaw file. Not for General

matlab.mat

445 KB
Binary file not shown.

ukf.m

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
%Unscented Kalman Filter for orientation estimation using quaternions
1+
% Unscented Kalman Filter for orientation estimation using quaternions
22

3+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34
%first 4 components of x is quaternion, last 3 is angular velocities
45

56
%first 3 components of z is accelerometer, next 3 gyroscopes, last 3 magnetometer
67

78
%order is always x, y, z
89

9-
%(just notes for me)
1010
%check if quaternion multiplication convention consistent, Eq. 12
11-
%check if "small rotations" are small
12-
%is there/should there be symmetry breaking?
11+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1312

1413
function [xpost, Ppost] = ukf(x,P,z,dT)
1514
%process noise (fill these two in later)
1615
Q=0.01*eye(6);
1716

1817
%measurement noise
19-
R=0.1*eye(9);
18+
R=0.5*eye(9); %increasing this seems to smooth out the motion; understand why
2019

2120
S = chol(P + Q);
2221

@@ -25,7 +24,7 @@
2524
W(i,:) = sqrt(12)*S(:,i);
2625
W(i+6,:) = -W(i,:);
2726
end
28-
%W(13,:)=zeros(1,6);
27+
2928
x=x(:);
3029
x=x.';
3130
X = addmean(W,x);
@@ -92,19 +91,16 @@
9291
end
9392
wnew = x(5:end);
9493

95-
%q{k+1}=q{k}+dq/dt*t
96-
%dq/dt = w*q{k}/2;
97-
9894
xnew = [qnew(:);wnew(:)];
9995
end
10096

10197
function [z] = state2meas(x)
10298
%maps state into expected measurement
10399
%global gravity field
104-
g = [0,0,-1];%?? [3,3,3];% why 3,3,3 ??
100+
g = [0,0,-1];
105101

106102
%global B field (initialize properly)
107-
b = [0,0,0]; % why 1,1,1
103+
b = [0,0,0];
108104

109105
q = x(1:4);
110106

visualize.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#R is 3 x 3 x numT array
1111
#columns of R are the positions of the basis vectors
12-
R=loadmat('R.mat')
12+
R=loadmat('Data/R.mat')
1313
R=R['R']
1414

1515
lines = [ax.plot([0,0],[0,0],[0,1.],lw=3)[0],

0 commit comments

Comments
 (0)