function tunh=orientunhmeta(mkplots) % metafile to hold the measurements of instrument placement on the tripod % edit as appropriate for what's on for this test % % returns a structure of vectors indicating instrument center (x,y) and % a positon along the direction of 0 or x if appropriate for each element % takes one optional element- a character to disable the plotting option % (use 'n' to disable) if nargin<1 mkplots='y'; end figure; %Sxlim([-6 6]);ylim([-6 6]);daspect([1 1 1]);hold on; %legs (b=blue, g=green, r=red, dist=distance tunh.bgdist=2.37; tunh.brdist=2.27; tunh.grdist=2.26; % x,y pairs in the coordinate system where adcp 0 is y=0, and the % perpendicular under the middle of the adcp is x=0 tunh.gr=[-1.25 -1.16]; tunh.bl= [-0.14 0.892]; tunh.rd=[0.953 -1.076]; % when there are 4 things, it's [x1,y1, x2, y2] % adcp tunh.adcp=[0 0 0 0.30]; % pencil beam tunh.pen=[-0.14 -1.529 -0.174 -1.920]; % fan sonar tunh.fan=[-0.197 -0.512 -0.710 -0.698]; % EZ compass tunh.comp=[0.186 -0.728 .153 -1.014]; % aqudop (location added after the recovery) % used the undreneath position to get to the angled vector for aqd +x %keep even though there isn't one tunh.aqd=[-.11 -.97 -.095 -.775] if strncmp(lower(mkplots),'y',1) % now plot plot(tunh.bl(1),tunh.bl(2),'bo','MarkerSize',10); hold on plot(tunh.bl(1),tunh.bl(2),'bo','MarkerSize',12); plot(tunh.gr(1),tunh.gr(2),'go','MarkerSize',12); plot(tunh.rd(1),tunh.rd(2),'ro','MarkerSize',12); plot(tunh.gr(1),tunh.gr(2),'go','MarkerSize',10); plot(tunh.rd(1),tunh.rd(2),'ro','MarkerSize',10); plot([tunh.bl(1) tunh.rd(1) tunh.gr(1) tunh.bl(1)],... [tunh.bl(2) tunh.rd(2) tunh.gr(2) tunh.bl(2)],'k--') plot(tunh.adcp(1),tunh.adcp(2),'ks','MarkerFaceColor','k'); plot([tunh.adcp(1) tunh.adcp(3)],[tunh.adcp(2) tunh.adcp(4)],'k'); % fanbeam plot(tunh.fan(1),tunh.fan(2),'md','MarkerFaceColor','m'); plot([tunh.fan(1) tunh.fan(3)],[tunh.fan(2) tunh.fan(4)],'k'); %fanrad=rsmak('circle',5,[tunh.fan(1) tunh.fan(2)]); %fnplt(fanrad,'m'); % pencil plot(tunh.pen(1),tunh.pen(2),'ch','MarkerFaceColor','c'); plot([tunh.pen(1) tunh.pen(3)],[tunh.pen(2) tunh.pen(4)],'k'); %pencilrad=rsmak('circle',3,[tunh.pen(1) tunh.pen(2)]); %fnplt(pencilrad,'y') % camera plot(tunh.comp(1),tunh.comp(2),'r^','MarkerFaceColor','r'); plot([tunh.comp(1) tunh.comp(3)],[tunh.comp(2) tunh.comp(4)],'k'); % aquadop % plot(tunh.aqd(1),tunh.aqd(2),'g^','MarkerFaceColor','g'); % plot([tunh.aqd(1) tunh.aqd(3)],[tunh.aqd(2) tunh.aqd(4)],'k'); % % paros % tunh.pr=[-0.63 -0.098]; % tunh.pp=[0.712 -0.051]; % % ABSS % tunh.abss=[0.737 -0.214]; % % trans % tunh.cs132=[0.181 -1.039 0.425 -1.019]; % tunh.cs1172=[-0.114 -0.301 -0.223 -0.521]; % % now plot some more % plot([tunh.cs1172(1) tunh.cs1172(3)],[tunh.cs1172(2) tunh.cs1172(4)],'b:'); % plot([tunh.cs132(1) tunh.cs132(3)],[tunh.cs132(2) tunh.cs132(4)],'b:'); % plot(tunh.pr(1), tunh.pr(2),'rd'); % plot(tunh.pp(1), tunh.pp(2),'md'); % plot(tunh.abss(1), tunh.abss(2),'c*'); % % plot([0 0],[-2 .8],'r') text(0.1,-1.8,'red is reference line') grid on hold off % to get range and bearing, do this: % r_ay=sqrt(tunh.advy(1)^2+tunh.advy(2)^2) % b_ay=atand(tunh.advy(2)/tunh.advy(1)) title('sonar tripod - UNH tank tests 12/2009') [adcp_th,adcp_rng]=cart2pol(tunh.adcp(3)-tunh.adcp(1),tunh.adcp(4)-tunh.adcp(2)); [fan_th,fan_rng]=cart2pol(tunh.fan(3)-tunh.fan(1),tunh.fan(4)-tunh.fan(2)); [pen_th,pen_rng]=cart2pol(tunh.pen(3)-tunh.pen(1),tunh.pen(4)-tunh.pen(2)); % [aqd_th,aqd_rng]=cart2pol(tunh.aqd(3)-tunh.aqd(1),tunh.aqd(4)-tunh.aqd(2)); figure h2=polar(pen_th, pen_rng,'ch'); set(h2,'MarkerFaceColor','c') hold on h1=polar(adcp_th, adcp_rng,'ks'); set(h1,'MarkerFaceColor','k') h3=polar(fan_th, fan_rng,'md'); set(h3,'MarkerFaceColor','r') % h3=polar(aqd_th, aqd_rng,'g^'); % set(h3,'MarkerFaceColor','g') xlabel('adcp=square, pencil= hexagram, fan=diamond') hold off title('sonar tripod - UNH tank tests 12/2009') end