forked from buntonj/CLF-CBF-QP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotting.m
More file actions
20 lines (19 loc) · 719 Bytes
/
plotting.m
File metadata and controls
20 lines (19 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[Q, q, r] = get_ellipse_parameters();
% PLOT ELLIPTICAL OBSTACLE
L = chol(Q);
ellipse_pts = linspace(0,2*pi,300);
z = [cos(ellipse_pts); sin(ellipse_pts)]*r; % creates circle of correct radius
R = rotation_matrix(pi/4);
ellipse = L^-1 * z + q'; % stretch and translate circle appropriately
clf;
% PLOT GENERATED TRAJECTORY and VECTOR FIELD
limits = [min(xrange) max(xrange) min(yrange) max(yrange)];
axis(limits)
hold on
plot(ellipse(1,:),ellipse(2,:),'black','LineWidth',3)
quiver(plotx,ploty,plotux,plotuy,'red')
for i = 1:numtrajectories
scatter(x(1,1,i),x(1,2,i),50,'blue','filled')
plot(x(:,1,i),x(:,2,i),'blue','LineWidth',2)
end
legend('Obstacle Boundary','Input Vector','Initial State','Trajectory')