root / branches / 16299_s10 / matlab / visualizeRobots.m @ 1797
History | View | Annotate | Download (762 Bytes)
| 1 | function [mov] = visualizeRobots(f,n,Xs,Ys,Thetas,idx,color,makeMovie,mov,winsize) |
|---|---|
| 2 | |
| 3 | clf; |
| 4 | ax = [min(min(Xs))-1, max(max(Xs))+1, min(min(Ys))-1, max(max(Ys))+1]; |
| 5 | |
| 6 | if ax(1) > -10 |
| 7 | ax(1) = -10; |
| 8 | end |
| 9 | if ax(2) < 10 |
| 10 | ax(2) = 10; |
| 11 | end |
| 12 | if ax(3) > -10 |
| 13 | ax(3) = -10; |
| 14 | end |
| 15 | if ax(4) < 10 |
| 16 | ax(4) = 10; |
| 17 | end |
| 18 | |
| 19 | axis(ax); |
| 20 | |
| 21 | %axis([-10 10 -10 10]) |
| 22 | |
| 23 | axis manual |
| 24 | set( gca,'nextplot','add' ); |
| 25 | for j = 1:n |
| 26 | h = plot_arrow( Xs(j,idx),Ys(j,idx),Xs(j,idx)+cos(Thetas(j,idx)),Ys(j,idx)+sin(Thetas(j,idx)),... |
| 27 | 'color',color(j,:),'facecolor',color(j,:),'edgecolor',color(j,:) ); |
| 28 | set( h,'linewidth',2 ); |
| 29 | end |
| 30 | hold off; |
| 31 | |
| 32 | if makeMovie == true |
| 33 | if idx < 3 %so we don't see giant arrows |
| 34 | clf |
| 35 | end |
| 36 | mov(:,idx) = getframe(f,winsize); |
| 37 | else |
| 38 | mov = []; |
| 39 | end |
| 40 | |
| 41 | end |