LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / experimental / SerialLogger / analyzeEKF.m
blob555ad1254ae182be4ae74d7fc443ecf43499e525
1 function analyzeEKF(fn)
3 fid = fopen(fn);
4 dat = uint8(fread(fid,inf,'uchar'));
5 fclose(fid);
7 mag_data_size = 1 + 4*3;
8 accel_sensor_size = 4*3;
9 gyro_sensor_size = 4*3;
10 raw_framing = 15:-1:0;
12 starts = strfind(char(dat'),char(raw_framing));
13 starts(end) = [];
15 counts = typecast(reshape(dat(bsxfun(@plus,starts,(16:19)')),1,[]),'int32');
16 accel = reshape(typecast(reshape(dat(bsxfun(@plus,starts,(20:31)')),1,[]),'single'),3,[])';
17 gyro = reshape(typecast(reshape(dat(bsxfun(@plus,starts,(32:43)')),1,[]),'single'),3,[])';
18 mag_updated = dat(starts+44);
19 mag = reshape(typecast(reshape(dat(bsxfun(@plus,starts,(45:56)')),1,[]),'single'),3,[])';
20 %gps = 28 bytes 57:84
21 X = reshape(typecast(reshape(dat(bsxfun(@plus,starts,(85:85+13*4-1)')),1,[]),'single'),13,[])';
22 P = reshape(typecast(reshape(dat(bsxfun(@plus,starts,(137:137+13*4-1)')),1,[]),'single'),13,[])';