-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathGetCuboidObstacles.m
38 lines (29 loc) · 1.03 KB
/
GetCuboidObstacles.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
% GetCuboidObstacles generates and and stores cuboid obstacles
% (obstacles only in xyz-space)
%
% Ross Allen, ASL, Stanford University
% Dec 10, 2014
%
% Notes:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mpinfo = GetCuboidObstacles(mpinfo)
% Unpack variables to accessed and modified
obstacles = mpinfo.obstacles;
% Unpack variables to be accessed (not modified)
% Remove existing cuboid field
if isfield(obstacles, 'cuboids')
obstacles = rmfield(obstacles, 'cuboids');
end
% Call Cuboid Generator Function
try
% Try old format of obstacles first and convert to new form
[LWH_F, YPR_F, CM_F] = obstacles.generationFunction(obstacles);
obstacles.cuboids.ulVerts = ...
ObstacleFormatConversion(LWH_F, YPR_F, CM_F);
catch
% If old format failed, generationFunction outputs axis aligned obs
obstacles.cuboids.ulVerts = obstacles.generationFunction(obstacles);
end
% Store Variables for return
mpinfo.obstacles = obstacles;
end