-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestSimpleEnvironments.m
80 lines (63 loc) · 1.8 KB
/
testSimpleEnvironments.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
close all;
clear all;
addpath('./Visualization/');
addpath('./OnlinePlanner/resolveCollision');
addpath('./OnlinePlanner/');
% Funnel library
% load('../OnlinePlanning/FunnelLibrary/funnelLibrary_Apr7.mat');
load('../OnlinePlanning/FunnelLibrary/funnelLibrary_Apr24_symmetrized.mat');
% Hoop
%load('./PoissonForest/hoopObs.mat');
% Initial conditions
load('~/SBach/Logs/initConditions_all.mat');
% Positions of poles
pos = [3.0,3.0,1.0;-0.75,0.75,0.0;0.0,0.0,0.01]';
A = [eye(3);-eye(3)];
d = 0.025;
% Generate poles
for k = 1:size(pos,1)
b = [pos(k,1)+d;pos(k,2)+d;0;d-pos(k,1);d-pos(k,2);2];
P = polytope(A,b);
forest{k} = extreme(P)';
end
%for j = 1:length(hoop)
% hoop{j} = hoop{j} + repmat([3.3;-0.1;-1.3],1,size(hoop{j},2));
% forest{end+1} = hoop{j};
%end
% Specify current position of airplane and funnel number
x_current = x0s_xhat(:,1);
%%%% Call replan funnels with qcqp shifting %%%%%%%%%%%%%%%%%%%%%%%%%%%
options = struct();
options.shift_method = 'qcqp';
options.penetration_thresh = 0.3; % -10.0
options.failsafe_penetration = -10.0;
for k = 1:10
tic
[nextFunnel,x_execute_next,collFree,min_dist] = replanFunnels_mex(x_current,forest,funnelLibrary,options);
toc
end
min_dist
nextFunnel
% Plot stuff
figure
hold on
for k = 1:length(forest)
P = polytope(forest{k}');
plot(P);
end
% Plot funnel
funnel = funnelLibrary(nextFunnel);
V = funnel.V;
plotopts.num_samples = 200;
plotopts.ts = funnel.ts;
plotopts.x0 = funnel.xtraj;
plotopts.inclusion = 'projection';
plotopts.inflate_radius = 0.22;
plotShiftedFunnel(V,[x_execute_next;zeros(9,1)],plotopts);
hold on
% plotopts.inflate_radius = 0.0;
% plotShiftedFunnel(V,[x_execute_next;zeros(9,1)],plotopts);
% REVERSE DIRECTION OF PLOTTING (to match coordinate frame)
axis([-1 4 -3 3 -3 0]);
set(gca,'YDir','reverse')
set(gca,'ZDir','reverse')