-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleTest.m
32 lines (26 loc) · 872 Bytes
/
simpleTest.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
clc; clear; close all;
startPt = [0,0,0];
target = [10,10,10];
obstacles= [[8,8,7.9]];
obsDrones = [];
drone = Drone(1,startPt,[0,0,0],[0,0,0]);
for i = 1:size(obstacles)
obsDrones = [obsDrones,Drone(i+1,obstacles(i,:),[0,0,0],[0,0,0])];
end
apf = APF(obsDrones,startPt,target);
waypoints = [0,0,0];
steps = 0;
while steps < 100
%while ~all(abs(drone.position(:)-target(:))<=[0.00001,0.00001,0.00001])
a = abs(drone.position(:)-target(:));
[drone.position, drone.velocity] = apf.getNextStep(drone);
waypoints = [waypoints; drone.position];
steps = steps + 1;
%disp(steps);
end
plot3([0,10],[0,10],[0,10],'r.','MarkerSize',30);
hold on;
plot3(obstacles(:,1),obstacles(:,2),obstacles(:,3),'g.','MarkerSize',30);
hold on;
plot3(waypoints(:,1),waypoints(:,2),waypoints(:,3),'b.','MarkerSize',10);
disp(waypoints);