function DesenharRobo( P, q, q0, b )
global R

DIM = size(P,2);
for k=1:250:DIM,
   
    figure(8)  
   clf,hold on

  [X,Y,Z] = sphere; X= 0.03*X; Y= 0.03*Y; Z= 0.03*Z;
  surf(X,Y,Z), surf(X+P(1,k),Y+P(2,k), Z)
  Xc = R*cos(0:pi/9:2*pi);    
  Yc = R*sin(0:pi/9:2*pi);
  
  A=plot([0 P(1,k) P(3,k)],[0 P(2,k) P(4,k)],'k',...	%-- Elos mecânicos
    [P(1,k) P(1,k)-b(2,2)*cos(q(1,k)+q(2,k))],[P(2,k) P(2,k)-b(2,2)*sin(q(1,k)+q(2,k))],'k',...
    P(3,k),P(4,k),'ks', Xc,Yc,'k:',...						%-- Garra e roldana
    P(3,DIM),P(4,DIM),'k.',P(3,1:k),P(4,1:k),'k',...	%-- POnto final desejado e rasto
    [R*cos(q0(1)) b(1,1)*cos(q(1,k))],[R*sin(q0(1)) b(1,1)*sin(q(1,k))],'r',...% OFlexor
    [R*cos(q0(2)) b(1,2)*cos(q(1,k))],[R*sin(q0(2)) b(1,2)*sin(q(1,k))],'r',...% OExtensor
    [0 P(1,k)+b(2,1)*cos(q(1,k)+q(2,k))],[0 P(2,k)+b(2,1)*sin(q(1,k)+q(2,k))],'g',...%CFlexor
    [0 P(1,k)-b(2,2)*cos(q(1,k)+q(2,k))],[0 P(2,k)-b(2,2)*sin(q(1,k)+q(2,k))],'g');%CExtensor
 
  set(A(1), 'LineWidth', 2); set(A(2), 'LineWidth', 2);
  xlabel(' X (m) '), ylabel(' Y (m) '), title(' POSICIONAMENTO NO PONTO ')
  axis([-0.3 1.0 -.5 .5]), axis('equal'), pause(0.001)
     
end 