fixcompass.m
changeset 20 61b92f8fb463
parent 2 ec6b10ba8a34
equal deleted inserted replaced
19:b0fe24d04ba8 20:61b92f8fb463
     1 %======================================================================
     1 %======================================================================
     2 %                    F I X C O M P A S S . M 
     2 %                    F I X C O M P A S S . M 
     3 %                    doc: Fri Dec 30 14:59:27 2011
     3 %                    doc: Fri Dec 30 14:59:27 2011
     4 %                    dlm: Sat Dec 31 12:32:47 2011
     4 %                    dlm: Sun Mar  6 12:15:39 2016
     5 %                    (c) 2011 A.M. Thurnherr
     5 %                    (c) 2011 A.M. Thurnherr
     6 %                    uE-Info: 31 92 NIL 0 0 72 0 2 4 NIL ofnI
     6 %                    uE-Info: 42 0 NIL 0 0 72 0 2 4 NIL ofnI
     7 %======================================================================
     7 %======================================================================
     8 
     8 
     9 function [d,p]=fixcompass(d,p)
     9 function [d,p]=fixcompass(d,p)
    10 % 
    10 % 
    11 % fix compass issues
    11 % fix compass issues
    27 
    27 
    28 % Changes by ant:
    28 % Changes by ant:
    29 %	Dec 30, 2011: - BUG: p.fix_compass = 2 and = 3 did not work; bug report and fix 
    29 %	Dec 30, 2011: - BUG: p.fix_compass = 2 and = 3 did not work; bug report and fix 
    30 %						 provided by Roman Tarakanov <rtarakanov@gmail.com> today
    30 %						 provided by Roman Tarakanov <rtarakanov@gmail.com> today
    31 %						 bug fix verified with PALE data (old code produces garbage results)
    31 %						 bug fix verified with PALE data (old code produces garbage results)
       
    32 %	Mar  6, 2016: - BUG: p.fix_compass = 1 did not work for single-head profiles
    32 
    33 
    33 disp('FIXCOMPASS adjust compass')
    34 disp('FIXCOMPASS adjust compass')
    34 
    35 
    35 % use tilt sensors to figure out allingment between instruments
    36 % use tilt sensors to figure out allingment between instruments
    36 diary off
    37 if p.fix_compass > 1
    37   hoff2=fminsearch('checktilt',0,[],[d.rol(2,:);d.pit(2,:);d.rol(1,:);d.pit(1,:)]);
    38 	diary off
    38 diary on
    39 	  hoff2=fminsearch('checktilt',0,[],[d.rol(2,:);d.pit(2,:);d.rol(1,:);d.pit(1,:)]);
    39 disp([' mean instrument alignment based on tilt is ',num2str(hoff2),' deg'])
    40 	diary on
       
    41     disp([' mean instrument alignment based on tilt is ',num2str(hoff2),' deg'])
       
    42 end
    40 
    43 
    41 [lb,lt]=size(d.ru);
    44 [lb,lt]=size(d.ru);
    42 if p.fix_compass==2
    45 if p.fix_compass==2
    43  p=setdefv(p,'hdg_offset',[0 hoff2]);
    46  p=setdefv(p,'hdg_offset',[0 hoff2]);
    44 elseif p.fix_compass==3
    47 elseif p.fix_compass==3