Browse Source

Fixed index of zero in PlotPseudorangeRates.m, this allows code to work with legacy

files from Nexus 5x and Nexus 6p, where clock is always discontinuous.
pull/1/merge
Frank van Diggelen 8 years ago
parent
commit
fa29c79481
  1. 7
      opensource/PlotPseudorangeRates.m
  2. 9
      opensource/PlotPvt.m
  3. 2
      opensource/ProcessGnssMeasScript.m
  4. 21
      opensource/ReadGnssLogger.m
  5. 13
      opensource/SetDataFilter.m

7
opensource/PlotPseudorangeRates.m

@ -60,8 +60,11 @@ for i=1:M
else
colors(i,:) = get(h,'Color');
end
text(ti,y(iFi(end)-1),int2str(gnssMeas.Svid(i)),'Color',colors(i,:));
meanDprM = mean(y(isfinite(y)));%store for analysing delta prr dpr
iFi = find(isfinite(y));
if any(iFi)
text(ti,y(iFi(end)),int2str(gnssMeas.Svid(i)),'Color',colors(i,:));
end
meanDprM = mean(y(iFi));%store for analysing delta prr dpr
deltaMeanM(i) = meanPrrM - meanDprM;
end
end

9
opensource/PlotPvt.m

@ -25,17 +25,18 @@ iFi = isfinite(gpsPvt.allLlaDegDegM(:,1));%index into finite results
if ~any(iFi)
return
end
llaMed = median(gpsPvt.allLlaDegDegM(iFi,:));%use median position as reference
llaMed = median(gpsPvt.allLlaDegDegM(iFi,:));%median position
%print median lla so user can use it as reference position if they want:
fprintf('Median llaDegDegM = [%.7f %.7f %.2f]\n',llaMed)
if nargin < 3, llaTrueDegDegM = []; end
if nargin < 4. titleString = 'PVT solution'; end
if nargin < 4, titleString = 'PVT solution'; end
bGotLlaTrue = ~isempty(llaTrueDegDegM) && any(llaTrueDegDegM);
%not empty and not all zeros
if bGotLlaTrue
llaRef = llaTrueDegDegM;
else
llaRef = llaMed;
%print median lla so user can use it as reference position if they want
fprintf('Median llaDegDegM = [%.7f %.7f %.2f]\n',llaMed)
end
%% plot ne errors vs llaTrueDegDegM --------------------------------------------

2
opensource/ProcessGnssMeasScript.m

@ -28,7 +28,7 @@ param.llaTrueDegDegM = [37.422578, -122.081678, -28];%Charleston Park Test Site
%% Set the data filter and Read log file
dataFilter = SetDataFilter;
[gnssRaw,gnssAnalysis] = ReadGnssLogger(dirName,prFileName,dataFilter,param);
[gnssRaw,gnssAnalysis] = ReadGnssLogger(dirName,prFileName,dataFilter);
if isempty(gnssRaw), return, end
%% Get online ephemeris from Nasa ftp, first compute UTC Time from gnssRaw:

21
opensource/ReadGnssLogger.m

@ -1,5 +1,5 @@
function [gnssRaw,gnssAnalysis] = ReadGnssLogger(dirName,fileName,dataFilter,gnssAnalysis)
%% [gnssRaw,gnssAnalysis]=ReadGnssLogger(dirName,fileName,dataFilter,gnssAnalysis);
%% [gnssRaw,gnssAnalysis]=ReadGnssLogger(dirName,fileName,[dataFilter],[gnssAnalysis]);
% Read the log file created by Gnss Logger App in Android
% Compatible with Android release N
%
@ -7,12 +7,14 @@ function [gnssRaw,gnssAnalysis] = ReadGnssLogger(dirName,fileName,dataFilter,gns
% dirName = string with directory of fileName,
% e.g. '~/Documents/MATLAB/Pseudoranges/2016-03-28'
% fileName = string with filename
% dataFilter = nx2 cell array of pairs of strings,
% optional inputs:
% [dataFilter], nx2 cell array of pairs of strings,
% dataFilter{i,1} is a string with one of 'Raw' header values from the
% GnssLogger log file e.g. 'ConstellationType'
% dataFilter{i,2} is a string with a valid matlab expression, containing
% the header value, e.g. 'ConstellationType==1'
% See SetDataFilter.m for full rules and examples of dataFilter.
% See SetDataFilter.m for full rules and examples of dataFilter.
% [gnssAnalysis] structure containing analysis, incl list of missing fields
%
% Output:
% gnssRaw, all GnssClock and GnssMeasurement fields from log file, including:
@ -45,6 +47,7 @@ function [gnssRaw,gnssAnalysis] = ReadGnssLogger(dirName,fileName,dataFilter,gns
% ReportMissingFields()
%% Initialize outputs and inputs
gnssRaw = [];
gnssAnalysis.GnssClockErrors = 'GnssClock Errors.';
gnssAnalysis.GnssMeasurementErrors = 'GnssMeasurement Errors.';
gnssAnalysis.ApiPassFail = '';
@ -63,7 +66,8 @@ rawCsvFile = MakeCsv(dirName,fileName);
%% apply dataFilter
[bOk] = CheckDataFilter(dataFilter,header);
if ~bOk, return, end
C = FilterData(C,dataFilter,header);
[bOk,C] = FilterData(C,dataFilter,header);
if ~bOk, return, end
%% pack data into gnssRaw structure
[gnssRaw,missing] = PackGnssRaw(C,header);
@ -130,7 +134,9 @@ end
if isempty(strfind(sPlatform,'N'))
%add || strfind(platform,'O') and so on for future platforms
fprintf('\nThis version of ReadGnssLogger supports Android N\n')
error('Found "%s" in log file, expected "Platform: N"',line)
fprintf('WARNING: did not find "Platform" type in log file, expected "Platform: N"\n')
fprintf('Please Update GnssLogger\n')
sPlatform = 'N';%assume version N
end
v1 = [1;4;0;0];
@ -237,9 +243,10 @@ fclose(fid);
end% of function ReadRawCsv
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function C = FilterData(C,dataFilter,header)
function [bOk,C] = FilterData(C,dataFilter,header)
%% filter C based on contents of dataFilter
bOk = true;
iS = ones(size(C{1})); %initialize index into rows of C
for i=1:size(dataFilter,1)
j=find(strcmp(header,dataFilter{i,1}));%j = index into header
@ -262,6 +269,8 @@ end
if ~any(iS) %if all zeros
fprintf('\nAll measurements removed. Specify dataFilter less strictly than this:, ')
dataFilter(:,2)
bOk=false;
C=[];
return
end

13
opensource/SetDataFilter.m

@ -8,13 +8,9 @@ function dataFilter = SetDataFilter
%Author: Frank van Diggelen
%Open Source code for processing Android GNSS Measurements
%filter for fine time measurements only <=> uncertainty < 10 ms = 1e7 ns
dataFilter{1,1} = 'BiasUncertaintyNanos';
dataFilter{1,2} = 'BiasUncertaintyNanos < 1e7';
%filter out FullBiasNanos == 0
dataFilter{end+1,1} = 'FullBiasNanos';
dataFilter{end,2} = 'FullBiasNanos ~= 0';
dataFilter{1,1} = 'FullBiasNanos';
dataFilter{1,2} = 'FullBiasNanos ~= 0';
%you can create other filters in the same way ...
%for example, suppose you want to remove Svid 23:
@ -26,6 +22,11 @@ dataFilter{end,2} = 'FullBiasNanos ~= 0';
% NOTE: you *cannot* use 'any(Svid)==[2,5,10,17]' because Svid refers to a
% vector variable and you must compare it to a scalar.
%filter for fine time measurements only <=> uncertainty < 10 ms = 1e7 ns
%For Nexus 5x and 6p this field is not filled, so comment out these next 2 lines
% dataFilter{end+1,1} = 'BiasUncertaintyNanos';
% dataFilter{end,2} = 'BiasUncertaintyNanos < 1e7';
%keep only Svid 2
% dataFilter{end+1,1} = 'Svid';
% dataFilter{end,2} = 'Svid==2';

Loading…
Cancel
Save