% Create a Map
% 12 April 2006     MapBot Project    Stephanie Luft
% This program is the main module for the mapping algorithm.  
% It could be turned into a function, as shown.  Right now, to create the
% first map, the 'maparray=finalmap;' line must be commented out, and to
% create subsequent maps, the 'firstmap' line must be commented out.


%function [finalmap]=createmap(maparray)

runPTU
robotcolor
firstmap
%maparray=finalmap;
[ploti,plotj]=obstaclecoords(phi, distance, roboti, robotj);
figure,plot(ploti,plotj,'bo',roboti,robotj,'ro')    % plot the data points on a graph
[newmap,ii,jj]=growmap(ploti,plotj,roboti,robotj,maparray); 
[finalmap,roboti,robotj]=plotobstacle(ploti,plotj,newmap,roboti,robotj,ii,jj);
figure,imshow(finalmap),title('final map'),colormap(botcolor),axis on,colorbar
    % Plot the new map