mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-21 06:27:01 +00:00
Fixing bugs and adding plotting tool for GLONASS measurements
Adds tracking results plot for GLONASS processing following code for GPS. Also fix a couple of bugs in the code and address bugs from acq and trk modules
This commit is contained in:
parent
6b8973efe2
commit
a3d2c563c9
@ -180,11 +180,11 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int
|
||||
// 3. Check operation executed correctly
|
||||
if(d_nav.flag_CRC_test == true)
|
||||
{
|
||||
LOG(INFO) << "GLONASS GNAV CRC correct on channel " << d_channel << " from satellite ";// << d_satellite;
|
||||
LOG(INFO) << "GLONASS GNAV CRC correct on channel " << d_channel << " from satellite "<< d_satellite;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(INFO) << "GLONASS GNAV CRC error on channel " << d_channel << " from satellite " ;//<< d_satellite;
|
||||
LOG(INFO) << "GLONASS GNAV CRC error on channel " << d_channel << " from satellite " << d_satellite;
|
||||
}
|
||||
|
||||
// 4. Push the new navigation data to the queues
|
||||
@ -399,7 +399,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
void glonass_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
||||
{
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite "<< d_satellite;
|
||||
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
|
||||
case 6:
|
||||
// --- It is string 6 ----------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
i_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
|
||||
d_frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
|
||||
@ -504,7 +504,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
break;
|
||||
case 8:
|
||||
// --- It is string 8 ----------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
i_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
|
||||
d_frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
|
||||
@ -543,7 +543,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
break;
|
||||
case 10:
|
||||
// --- It is string 10 ---------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
i_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
|
||||
d_frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
|
||||
@ -582,7 +582,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
break;
|
||||
case 12:
|
||||
// --- It is string 12 ---------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
i_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
|
||||
d_frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
|
||||
@ -628,7 +628,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
}
|
||||
else
|
||||
{
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
i_satellite_slot_number = static_cast<unsigned int>(read_navigation_unsigned(string_bits, n_A));
|
||||
d_frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_C_n = static_cast<bool>(read_navigation_bool(string_bits, C_N));
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
*/
|
||||
int string_decoder(std::string frame_string);
|
||||
|
||||
/*
|
||||
/*!
|
||||
* \brief Gets the time of week in GPS Time
|
||||
* \details This converts from GLONASS Time to GPS Time of Week based on the
|
||||
* start of frame
|
||||
|
73
src/utils/matlab/glonass_l1_ca_dll_pll_plot_sample.m
Normal file
73
src/utils/matlab/glonass_l1_ca_dll_pll_plot_sample.m
Normal file
@ -0,0 +1,73 @@
|
||||
% /*!
|
||||
% * \file glonass_l1_ca_dll_pll_plot_sample.m
|
||||
% * \brief Read GNSS-SDR Tracking dump binary file using the provided
|
||||
% function and plot some internal variables
|
||||
% * \author Damian Miralles, 2017. dmiralles2009(at)gmail.com
|
||||
% * -------------------------------------------------------------------------
|
||||
% *
|
||||
% * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
% *
|
||||
% * GNSS-SDR is a software defined Global Navigation
|
||||
% * Satellite Systems receiver
|
||||
% *
|
||||
% * This file is part of GNSS-SDR.
|
||||
% *
|
||||
% * GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
% * it under the terms of the GNU General Public License as published by
|
||||
% * the Free Software Foundation, either version 3 of the License, or
|
||||
% * at your option) any later version.
|
||||
% *
|
||||
% * GNSS-SDR is distributed in the hope that it will be useful,
|
||||
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% * GNU General Public License for more details.
|
||||
% *
|
||||
% * You should have received a copy of the GNU General Public License
|
||||
% * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
% *
|
||||
% * -------------------------------------------------------------------------
|
||||
% */
|
||||
close all;
|
||||
clear all;
|
||||
|
||||
if ~exist('glonass_l1_ca_dll_pll_read_tracking_dump.m','file')
|
||||
addpath('./libs')
|
||||
end
|
||||
|
||||
|
||||
samplingFreq = 6625000; %[Hz]
|
||||
channels = 5;
|
||||
first_channel = 0;
|
||||
|
||||
path = '/archive/'; %% CHANGE THIS PATH
|
||||
|
||||
for N=1:1:channels
|
||||
tracking_log_path = [path 'glo_tracking_ch_' num2str(N+first_channel-1) '.dat']; %% CHANGE epl_tracking_ch_ BY YOUR dump_filename
|
||||
GNSS_tracking(N)= gps_l1_ca_dll_pll_read_tracking_dump(tracking_log_path);
|
||||
end
|
||||
|
||||
% GNSS-SDR format conversion to MATLAB GPS receiver
|
||||
|
||||
for N=1:1:channels
|
||||
trackResults(N).status = 'T'; %fake track
|
||||
trackResults(N).codeFreq = GNSS_tracking(N).code_freq_hz.';
|
||||
trackResults(N).carrFreq = GNSS_tracking(N).carrier_doppler_hz.';
|
||||
trackResults(N).dllDiscr = GNSS_tracking(N).code_error.';
|
||||
trackResults(N).dllDiscrFilt = GNSS_tracking(N).code_nco.';
|
||||
trackResults(N).pllDiscr = GNSS_tracking(N).carr_error.';
|
||||
trackResults(N).pllDiscrFilt = GNSS_tracking(N).carr_nco.';
|
||||
|
||||
trackResults(N).I_P = GNSS_tracking(N).prompt_I.';
|
||||
trackResults(N).Q_P = GNSS_tracking(N).prompt_Q.';
|
||||
|
||||
trackResults(N).I_E = GNSS_tracking(N).E.';
|
||||
trackResults(N).I_L = GNSS_tracking(N).L.';
|
||||
trackResults(N).Q_E = zeros(1,length(GNSS_tracking(N).E));
|
||||
trackResults(N).Q_L = zeros(1,length(GNSS_tracking(N).E));
|
||||
trackResults(N).PRN = ones(1,length(GNSS_tracking(N).E));
|
||||
|
||||
% Use original MATLAB tracking plot function
|
||||
settings.numberOfChannels = channels;
|
||||
settings.msToProcess = length(GNSS_tracking(N).E);
|
||||
plotTracking(N,trackResults,settings)
|
||||
end
|
193
src/utils/matlab/libs/glonass_l1_ca_dll_pll_read_tracking_dump.m
Normal file
193
src/utils/matlab/libs/glonass_l1_ca_dll_pll_read_tracking_dump.m
Normal file
@ -0,0 +1,193 @@
|
||||
% /*!
|
||||
% * \file glonass_l1_ca_dll_pll_read_tracking_dump.m
|
||||
% * \brief Read GNSS-SDR Tracking dump binary file into MATLAB.
|
||||
% * \author Damian Miralles, 2017. dmiralles2009(at)gmail.com
|
||||
% * -------------------------------------------------------------------------
|
||||
% *
|
||||
% * Copyright (C) 2010-2011 (see AUTHORS file for a list of contributors)
|
||||
% *
|
||||
% * GNSS-SDR is a software defined Global Navigation
|
||||
% * Satellite Systems receiver
|
||||
% *
|
||||
% * This file is part of GNSS-SDR.
|
||||
% *
|
||||
% * GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
% * it under the terms of the GNU General Public License as published by
|
||||
% * the Free Software Foundation, either version 3 of the License, or
|
||||
% * at your option) any later version.
|
||||
% *
|
||||
% * GNSS-SDR is distributed in the hope that it will be useful,
|
||||
% * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% * GNU General Public License for more details.
|
||||
% *
|
||||
% * You should have received a copy of the GNU General Public License
|
||||
% * along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
% *
|
||||
% * -------------------------------------------------------------------------
|
||||
% */
|
||||
function [GNSS_tracking] = glonass_l1_ca_dll_pll_read_tracking_dump (filename, count)
|
||||
|
||||
%% usage: glonass_l1_ca_dll_pll_read_tracking_dump_64bits (filename, [count])
|
||||
%%
|
||||
%% open GNSS-SDR tracking binary log file .dat and return the contents
|
||||
%%
|
||||
|
||||
m = nargchk (1,2,nargin);
|
||||
num_float_vars=5;
|
||||
num_unsigned_long_int_vars=1;
|
||||
num_double_vars=11;
|
||||
num_unsigned_int_vars=1;
|
||||
double_size_bytes=8;
|
||||
unsigned_long_int_size_bytes=8;
|
||||
float_size_bytes=4;
|
||||
long_int_size_bytes=4;
|
||||
|
||||
skip_bytes_each_read=float_size_bytes*num_float_vars+unsigned_long_int_size_bytes*num_unsigned_long_int_vars+double_size_bytes*num_double_vars+long_int_size_bytes*num_unsigned_int_vars;
|
||||
bytes_shift=0;
|
||||
if (m)
|
||||
usage (m);
|
||||
end
|
||||
|
||||
if (nargin < 2)
|
||||
%count = Inf;
|
||||
file_stats = dir(filename);
|
||||
%round num bytes to read to integer number of samples (to protect the script from binary
|
||||
%dump end file transitory)
|
||||
count = (file_stats.bytes - mod(file_stats.bytes,skip_bytes_each_read))/skip_bytes_each_read;
|
||||
end
|
||||
%loops_counter = fread (f, count, 'uint32',4*12);
|
||||
f = fopen (filename, 'rb');
|
||||
if (f < 0)
|
||||
else
|
||||
v1 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v2 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v3 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v4 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved float
|
||||
v5 = fread (f, count, 'float',skip_bytes_each_read-float_size_bytes);
|
||||
bytes_shift=bytes_shift+float_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved unsigned_long_int
|
||||
v6 = fread (f, count, 'uint64',skip_bytes_each_read-unsigned_long_int_size_bytes);
|
||||
bytes_shift=bytes_shift+unsigned_long_int_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v7 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v8 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v9 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v10 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v11 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v12 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v13 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v14 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v15 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v16 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v17 = fread (f, count, 'float64',skip_bytes_each_read-double_size_bytes);
|
||||
bytes_shift=bytes_shift+double_size_bytes;
|
||||
fseek(f,bytes_shift,'bof'); % move to next interleaved double
|
||||
v18 = fread (f, count, 'uint32',skip_bytes_each_read-double_size_bytes);
|
||||
fclose (f);
|
||||
|
||||
%%%%%%%% output vars %%%%%%%%
|
||||
|
||||
% // EPR
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
|
||||
% // PROMPT I and Q (to analyze navigation symbols)
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
|
||||
% // PRN start sample stamp
|
||||
% //tmp_float=(float)d_sample_counter;
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_sample_counter), sizeof(unsigned long int));
|
||||
% // accumulated carrier phase
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
|
||||
%
|
||||
% // carrier and code frequency
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
|
||||
%
|
||||
% //PLL commands
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&carr_phase_error_secs_Ti), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
|
||||
%
|
||||
% //DLL commands
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&code_error_chips_Ti), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
|
||||
%
|
||||
% // CN0 and carrier lock test
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
|
||||
%
|
||||
% // AUX vars (for debug purposes)
|
||||
% tmp_double = d_rem_code_phase_samples;
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
% tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||
% // PRN
|
||||
% unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
|
||||
% d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
|
||||
E=v1;
|
||||
P=v2;
|
||||
L=v3;
|
||||
prompt_I=v4;
|
||||
prompt_Q=v5;
|
||||
PRN_start_sample=v6;
|
||||
acc_carrier_phase_rad=v7;
|
||||
carrier_doppler_hz=v8;
|
||||
code_freq_hz=v9;
|
||||
carr_error=v10;
|
||||
carr_nco=v11;
|
||||
code_error=v12;
|
||||
code_nco=v13;
|
||||
CN0_SNV_dB_Hz=v14;
|
||||
carrier_lock_test=v15;
|
||||
var1=v16;
|
||||
var2=v17;
|
||||
PRN=v18;
|
||||
|
||||
GNSS_tracking.E=E;
|
||||
GNSS_tracking.P=P;
|
||||
GNSS_tracking.L=L;
|
||||
GNSS_tracking.prompt_I=prompt_I;
|
||||
GNSS_tracking.prompt_Q=prompt_Q;
|
||||
GNSS_tracking.PRN_start_sample=PRN_start_sample;
|
||||
GNSS_tracking.acc_carrier_phase_rad=acc_carrier_phase_rad;
|
||||
GNSS_tracking.carrier_doppler_hz=carrier_doppler_hz;
|
||||
GNSS_tracking.code_freq_hz=code_freq_hz;
|
||||
GNSS_tracking.carr_error=carr_error;
|
||||
GNSS_tracking.carr_nco=carr_nco;
|
||||
GNSS_tracking.code_error=code_error
|
||||
GNSS_tracking.code_nco=code_nco;
|
||||
GNSS_tracking.CN0_SNV_dB_Hz=CN0_SNV_dB_Hz;
|
||||
GNSS_tracking.carrier_lock_test=carrier_lock_test;
|
||||
GNSS_tracking.d_rem_code_phase_samples=var1;
|
||||
GNSS_tracking.var2=var2;
|
||||
GNSS_tracking.PRN=PRN;
|
||||
end
|
Loading…
Reference in New Issue
Block a user