%% Basic Planning app. clear all; close all; figure('MenuBar','none') %init axis([0 10 0 10]) c = uimenu('Label','Commands'); uimenu(c,'Label','Save','Callback','save'); pp = uimenu('Label','Path Planning'); tp = uimenu(pp, 'Label','Type of Path'); uimenu(tp,'Label','StupidPath','Callback','stupid_path(startloc,endloc)'); uimenu(tp,'Label','SmartPath','Enable','off'); hold on xy = []; startloc = [0,0]; endloc = [0,0]; n = 0; %define obstacle disp('Left-click to define obstacle (1 for now!)'); disp('Right-click to define last point'); % Loop, picking up the points. button = 1; while button == 1 [xi,yi,button] = ginput(1); plot(xi,yi,'r+') n = n+1; xy(:,n) = [xi;yi]; end %%%%%%Credit for click aquisition: Matlab Help Files%%%%%%% %xy(:,n+1) = [xy(1,1),xy(2,1)]; %line(xy(1,:),xy(2,:)) <--not needed, I found the fill() command fill(xy(1,:),xy(2,:),'b'); hold off %pick start and end hold on disp('Choose start location'); [startloc(1),startloc(2),button] = ginput(1); plot(startloc(1),startloc(2),'go') hold off hold on disp('Choose end location'); [endloc(1),endloc(2),button] = ginput(1); plot(endloc(1),endloc(2),'rx') hold off;