-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplotGpsTourData.m
46 lines (38 loc) · 1.07 KB
/
plotGpsTourData.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
function [dataNed] = plotGpsTourData(geoCsvLogFilename, origin)
% PLOTGPSTOURDATA plots GPS data from a DTSP tour
% Waypoints are read as geodetic points in degrees * 1E7, and converted
% into local NED using the origin.
%
%% Parameters
if nargin < 1
error('No input arguments given!');
elseif nargin > 2
error('Too many arguments given!');
end
%if isempty(hAx)
% error('hAx not given!');
%end
if isempty(geoCsvLogFilename)
error('Log filename not given!');
end
if exist(geoCsvLogFilename) ~= 2
error('Failed to find log file: %s',geoCsvLogFilename);
end
if isempty(origin)
error('origin is empty!');
end
[mOrigin, nOrigin] = size(origin);
if mOrigin ~= 1 || nOrigin ~= 3
error('Expected origin as 3-dimensional row vector.');
end
%% Open the convert the data
[dataGeo, ~] = readCsvGps(geoCsvLogFilename);
[xNorth, yEast] = geodetic2ned(dataGeo(:,1),dataGeo(:,2),dataGeo(:,3),origin(1), origin(2),...
origin(3), wgs84Ellipsoid);
dataNed = [xNorth, yEast];
plot(yEast, xNorth, 'ko');
xlabel('North [m]');
ylabel('East [m]');
hold on;
plot(0,0,'ro');
end % function