-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEXAMPLE5localise.m
More file actions
22 lines (17 loc) · 826 Bytes
/
EXAMPLE5localise.m
File metadata and controls
22 lines (17 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clf; %clears figures
clc; %clears console
clear; %clears workspace
axis equal; %keeps the x and y scale the same
map=[0,0;60,0;60,45;45,45;45,59;106,59;106,105;0,105]; %default map
% botSim = BotSim(map,[0.01,0.005,0]); %sets up a botSim object a map, and debug mode on.
botSim = BotSim(map,[0,0,0]); %sets up a botSim object a map, and debug mode on.
botSim.drawMap();
drawnow;
botSim.randomPose(10); %puts the robot in a random position at least 10cm away from a wall
target = botSim.getRndPtInMap(10); %gets random target.
tic %starts timer
%your localisation function is called here.
returnedBot = localise(botSim,map,target); %Where the magic happens
resultsTime = toc %stops timer
%calculated how far away your robot is from the target.
resultsDis = distance(target, returnedBot.getBotPos())