14.11.2012 Views

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

Submitted version of the thesis - Airlab, the Artificial Intelligence ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

130 Appendix B. Documentation <strong>of</strong> <strong>the</strong> programming<br />

if (v L ˜= 0)<br />

line ([0 v2] ,[0 0] , ’Color ’ ,[1 0 0]);<br />

if (v L < 0)<br />

fill ([v2 v2+0.12∗p1 v2+0.12∗p1] ,[0 p1∗0.05 −p1∗0.05] , ’r ’)<br />

else<br />

fill ([v2 v2−0.12∗p1 v2−0.12∗p1] ,[0 p1∗0.05 −p1∗0.05] , ’r ’)<br />

end<br />

text(v2,0.1∗v2, ’v L ’ );<br />

end<br />

if (omega ˜= 0)<br />

if (omega > 0)<br />

<strong>the</strong>ta = linspace(−pi/3,pi/2 ,100);<br />

fill ([−0.12∗p1 0 0] ,[ R robot/6 R robot/6+p1∗0.05 R robot/6−p1<br />

∗0.05] , ’b’ );<br />

text(−0.14∗p1, R robot/6+p1∗0.05 , ’\omega ’)<br />

else<br />

<strong>the</strong>ta = linspace(pi/2,4∗pi/3 ,100);<br />

fill ([0.12∗p1 0 0] ,[ R robot/6 R robot/6+p1∗0.05 R robot/6−p1∗<br />

0.05] , ’b’ );<br />

text(0.12∗p1,R robot/6+p1∗0.05 , ’\omega ’ );<br />

end<br />

rho = ones(1 ,100)∗ R robot/6;<br />

[xr , yr] = pol2cart(<strong>the</strong>ta , rho );<br />

line(xr , yr );<br />

end<br />

% ruota 1<br />

if (vt(1) ˜= 0)<br />

line ([ R robot∗cosA , R robot∗cosA+vt(1)∗s1∗sinA ] ,[ R robot∗sinA , R robo<br />

∗sinA−vt(1)∗s1∗cosA] , ’Color ’ ,[0 1 0]);<br />

<strong>of</strong>fset1 = [ R robot∗cosA+vt(1)∗s1∗sinA; R robot∗sinA−vt(1)∗s1∗cosA ];<br />

if (vt(1)∗s1∗sinA < 0)<br />

M = m rot(alpha );<br />

else<br />

M = m rot(−pi + alpha );<br />

end<br />

m arr1 = M∗m arr + [ <strong>of</strong>fset1 <strong>of</strong>fset1 <strong>of</strong>fset1 ];<br />

v txt1 = M∗v txt + <strong>of</strong>fset1 ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!