Code covered by the BSD License  

Highlights from
Automata Engineer 2010 NITK

image thumbnail

Automata Engineer 2010 NITK

by

 

29 Oct 2010 (Updated )

This code solves the problem statement of Automata Engineer 2010 NITK.

portout( path, mot, prop, lcen, scen )
function [ ] = portout( path, mot, prop, lcen, scen )
%returns the corrections made by the bot during real time processing
ii=1;
jj=1;
for ii=1:size(mot)
    %temp=mot(i);
    p3=prop(path(jj)).Centroid;
    p4=prop(path(jj+1)).Centroid;
    %p2=lcen;
    %p1=scen;
    cenbot=(lcen+scen)/2;
    ang1=angle2Points(p4,p3);
    ang2=angle2Points(lcen,scen);
    ang=abs((ang2-ang1)*180/pi);
    
    if mot(ii)=='L'
        while(~(ang<15 && ang>345))
            if(ang>15 && ang<180)
            disp('L');
            else disp('R');
            end
        end
    end
    
    
    if mot(ii)=='R'
        while(~(ang>345 && ang<15))
            if(ang<345 && ang>180)
            disp('R');
            else disp('L');
            end
        end
    end
    
    if mot(ii)=='F'
        jj=jj+1;
        while(abs(cenbot-p4)<15)
            disp('F');
            if(ang<345 && ang>180)
            disp('R');
            end
            if(ang>15 && ang<180)
            disp('L');
            end
        end
    end



%   Detailed explanation goes here




end

Contact us