-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestElements.m
51 lines (42 loc) · 1.11 KB
/
TestElements.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function TestElements()
% Clear previous work
close all;
clear;
clc;
% Configure file path
addpath Dependencies\intersections
addpath Scenario
addpath Sensors
addpath Vehicle
addpath Vehicle\Kinematics
addpath Vehicle\LowLevelControl
addpath World
% Create a temporary figure;
figure;
ax = gca;
% Create a world
world = PolygonWorld1();
%world = EmptyWorld();
world.plotWorld(ax);
axis equal;
% Create a range sensor
range = RangeSensor();
range.initializePlots(ax);
% Loop through and set random points
x = rand * 10;
y = rand * 10;
h_pnt = plot(ax, x, y, 'bo', 'linewidth', 4);
for k = 1:10
% Create the point of interest
x = rand * 10;
y = rand * 10;
th = rand * 2*pi;
set(h_pnt, 'xdata', x, 'ydata', y);
% Update the range data
q = [x; y];
[xo, yo, dist_o] = range.getObstacleDetections(q, th, world);
% Plot the measurements
range.plotMeasurements(q, xo, yo);
pause();
end
end