Ok its not as cool as the title sounds. you can basically watch the progress of the pedestrian as they navigate through obstacles.
04.15.2015
Got an animation to play of the pedestrian pathfinding. A
bit of trial and error but now we can introduce behaviour of the pedestrian.
function [ ] = MainFunc( )
%Main function, all other
functions will be executed from here
% Detailed explanation goes here
%for testing get map here
MapGrid=testmap();
%set current position and
destination
StartPos=[2 1];
EndPos = [6,3];
%put the location of the
person on the grid
MapGrid(StartPos(1),StartPos(2))=2;
%now for the simulation
part
simMap=MapGrid;
currentPos=StartPos;
loopC=1;
%plot firt one with handle
%figure(1),clf
%axes('Position',[0,0.25,1,0.5]);
h=pcolor(simMap);
%colormap('cool')
%shading('interp')
%set(h,'EraseMode','xof')
while (loopC==1)
if (all(currentPos==EndPos))
loopC=0;
break;
end
%get next step
[nextPos
pathList]=a_star5(MapGrid,currentPos,EndPos);
%put the current Pos into the map
simMap(currentPos(1),currentPos(2))=2;
set(h,'CData',simMap);
drawnow
%now take out the currentPos
simMap(currentPos(1),currentPos(2))=0;
%assign the next step
currentPos=nextPos;
nextPos
for j=1:10000000,
x(j) = j*exp(pi);
end
end
end
the last for loop is just to slow down the animation, as its
close to the deadline of thi project. I will hold off on the behaviour aspect
and start writing up my report first. The details of the code will be on the report
No comments:
Post a Comment