mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 11:40:33 +00:00
Fixing bugs in telemetry decoder code
This commit is contained in:
parent
e5ffc2b46c
commit
6b8973efe2
@ -12,7 +12,7 @@ SignalSource.sampling_frequency=6625000
|
||||
;SignalSource.samples=66250000
|
||||
SignalSource.samples=0
|
||||
SignalSource.dump=false;
|
||||
SignalSource.dump_filename=./signal_glonass.bin
|
||||
SignalSource.dump_filename=/archive/signal_glonass.bin
|
||||
|
||||
;######### SIGNAL_CONDITIONER CONFIG ############
|
||||
SignalConditioner.implementation=Signal_Conditioner
|
||||
@ -33,8 +33,8 @@ Channel2.signal=1G
|
||||
Channel3.signal=1G
|
||||
Channel4.signal=1G
|
||||
|
||||
;Channel0.satellite=2
|
||||
;Channel1.satellite=21
|
||||
Channel0.satellite=11
|
||||
Channel1.satellite=15
|
||||
;Channel2.satellite=12
|
||||
;Channel3.satellite=23
|
||||
; Possible list includes 2, 12, 21, 22
|
||||
@ -43,7 +43,7 @@ Channel4.signal=1G
|
||||
Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition
|
||||
Acquisition_1G.item_type=gr_complex
|
||||
Acquisition_1G.threshold=0.0
|
||||
Acquisition_1G.pfa=0.01
|
||||
Acquisition_1G.pfa=0.0001
|
||||
Acquisition_1G.if=0
|
||||
Acquisition_1G.doppler_max=10000
|
||||
Acquisition_1G.doppler_step=250
|
||||
@ -61,7 +61,7 @@ Tracking_1G.dump=true;
|
||||
Tracking_1G.dump_filename=/archive/glo_tracking_ch_
|
||||
|
||||
;######### TELEMETRY DECODER GPS CONFIG ############
|
||||
TelemetryDecoder_1G.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||
TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder
|
||||
|
||||
;######### OBSERVABLES CONFIG ############
|
||||
Observables.implementation=Hybrid_Observables
|
||||
|
@ -145,15 +145,19 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int
|
||||
chip_acc += frame_symbols[i];
|
||||
chip_acc_counter += 1;
|
||||
|
||||
if(chip_acc_counter == (GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT - 1))
|
||||
if(chip_acc_counter == (GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT))
|
||||
{
|
||||
if (chip_acc > 0)
|
||||
{
|
||||
bi_binary_code.push_back('1');
|
||||
chip_acc_counter = 0;
|
||||
chip_acc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bi_binary_code.push_back('0');
|
||||
chip_acc_counter = 0;
|
||||
chip_acc = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,18 +175,16 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols,int
|
||||
}
|
||||
|
||||
// 2. Call the GLONASS GNAV string decoder
|
||||
d_nav.string_decoder(relative_code.c_str());
|
||||
d_nav.string_decoder(relative_code);
|
||||
|
||||
// 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;
|
||||
std::cout << "GLONASS GNAV CRC correct on channel " << d_channel << " from satellite " << d_satellite << std::endl;
|
||||
LOG(INFO) << "GLONASS GNAV CRC correct on channel " << d_channel << " from satellite ";// << d_satellite;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "GLONASS GNAV CRC error on channel " << d_channel << " from satellite " << d_satellite << std::endl;
|
||||
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
|
||||
@ -225,7 +227,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
consume_each(1);
|
||||
|
||||
d_flag_preamble = false;
|
||||
unsigned int required_symbols=GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||
unsigned int required_symbols=GLONASS_GNAV_STRING_SYMBOLS;
|
||||
|
||||
if (d_symbol_history.size()>required_symbols)
|
||||
{
|
||||
@ -264,7 +266,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
||||
{
|
||||
//try to decode frame
|
||||
LOG(INFO) << "Starting page decoder for GLONASS L1 C/A SAT " << this->d_satellite;
|
||||
LOG(INFO) << "Starting string decoder for GLONASS L1 C/A SAT " << this->d_satellite;
|
||||
d_preamble_index = d_sample_counter; //record the preamble sample stamp
|
||||
d_stat = 2;
|
||||
}
|
||||
@ -274,17 +276,19 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attrib
|
||||
{
|
||||
d_stat = 0; // start again
|
||||
}
|
||||
DLOG(INFO) << "Failed string decoder for GLONASS L1 C/A SAT " << this->d_satellite;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (d_stat == 2)
|
||||
{
|
||||
if (d_sample_counter == d_preamble_index + GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS)
|
||||
// FIXME: The preamble index marks the first symbol of the string count. Here I just wait for another full string to be received before processing
|
||||
if (d_sample_counter == d_preamble_index + GLONASS_GNAV_STRING_SYMBOLS)
|
||||
{
|
||||
// NEW GLONASS string received
|
||||
// 0. fetch the symbols into an array
|
||||
int string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
double string_symbols[string_length];
|
||||
double string_symbols[string_length] = {0};
|
||||
|
||||
//******* SYMBOL TO BIT *******
|
||||
for (int i = 0; i < string_length; i++)
|
||||
|
@ -151,7 +151,7 @@ const int GLONASS_L1_CA_HISTORY_DEEP = 100;
|
||||
const double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.3;
|
||||
const int GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30;
|
||||
const int GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300;
|
||||
const int GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 1700;
|
||||
const int GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS = 2000;
|
||||
const int GLONASS_GNAV_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s]
|
||||
const int GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_BIT = 10;
|
||||
const int GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT = 10;
|
||||
|
@ -81,6 +81,10 @@ void Glonass_Gnav_Navigation_Message::reset()
|
||||
d_TOW_F4 = 0.0; //!< Time of GPS Week from HOW word of Subframe 4 [s]
|
||||
d_TOW_F5 = 0.0; //!< Time of GPS Week from HOW word of Subframe 5 [s]
|
||||
|
||||
flag_CRC_test = false;
|
||||
d_frame_ID = 0;
|
||||
d_string_ID = 0;
|
||||
|
||||
// Clock terms
|
||||
d_satClkCorr = 0.0;
|
||||
d_dtr = 0.0;
|
||||
@ -310,6 +314,7 @@ unsigned int Glonass_Gnav_Navigation_Message::get_frame_number(unsigned int sate
|
||||
return frame_ID;
|
||||
}
|
||||
|
||||
|
||||
double Glonass_Gnav_Navigation_Message::get_TOW()
|
||||
{
|
||||
double TOW = 0.0;
|
||||
@ -329,20 +334,21 @@ double Glonass_Gnav_Navigation_Message::get_TOW()
|
||||
return TOW;
|
||||
}
|
||||
|
||||
|
||||
int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
{
|
||||
int string_ID = 0;
|
||||
int J = 0;
|
||||
frame_ID = 0;
|
||||
d_string_ID = 0;
|
||||
d_frame_ID = 0;
|
||||
|
||||
// UNPACK BYTES TO BITS AND REMOVE THE CRC REDUNDANCE
|
||||
std::bitset<GLONASS_GNAV_STRING_BITS> string_bits = std::bitset<GLONASS_GNAV_STRING_BITS>((frame_string));
|
||||
string_ID = static_cast<int>(read_navigation_unsigned(string_bits, STRING_ID));
|
||||
d_string_ID = static_cast<unsigned int>(read_navigation_unsigned(string_bits, STRING_ID));
|
||||
|
||||
CRC_test(string_bits);
|
||||
flag_CRC_test = CRC_test(string_bits);
|
||||
|
||||
// Decode all 15 string messages
|
||||
switch (string_ID)
|
||||
switch (d_string_ID)
|
||||
{
|
||||
case 1:
|
||||
//--- It is string 1 -----------------------------------------------
|
||||
@ -454,7 +460,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));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
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));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
@ -499,7 +505,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
case 8:
|
||||
// --- It is string 8 ----------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
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));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
@ -538,7 +544,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
case 10:
|
||||
// --- It is string 10 ---------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
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));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
@ -577,7 +583,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
case 12:
|
||||
// --- It is string 12 ---------------------------------------------
|
||||
i_satellite_slot_number = static_cast<double>(read_navigation_unsigned(string_bits, n_A));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
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));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
@ -615,7 +621,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
break;
|
||||
case 14:
|
||||
// --- It is string 14 ---------------------------------------------
|
||||
if( frame_ID == 5)
|
||||
if( d_frame_ID == 5)
|
||||
{
|
||||
gnav_utc_model.d_B1 = static_cast<double>(read_navigation_unsigned(string_bits, B1));
|
||||
gnav_utc_model.d_B2 = static_cast<double>(read_navigation_unsigned(string_bits, B2));
|
||||
@ -623,7 +629,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));
|
||||
frame_ID = get_frame_number(i_satellite_slot_number);
|
||||
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));
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_M_n_A = static_cast<double>(read_navigation_unsigned(string_bits, M_N_A));
|
||||
@ -641,7 +647,7 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
|
||||
case 15:
|
||||
// --- It is string 9 ----------------------------------------------
|
||||
if (frame_ID != 5 and flag_almanac_str_14 == true )
|
||||
if (d_frame_ID != 5 and flag_almanac_str_14 == true )
|
||||
{
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_omega_n_A = static_cast<double>(read_navigation_signed(string_bits, OMEGA_N_A)) * TWO_N15;
|
||||
gnav_almanac[i_satellite_slot_number - 1].d_t_lambda_n_A = static_cast<double>(read_navigation_unsigned(string_bits, T_LAMBDA_N_A)) * TWO_N5;
|
||||
@ -662,10 +668,13 @@ int Glonass_Gnav_Navigation_Message::string_decoder(std::string frame_string)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // switch subframeID ...
|
||||
LOG(INFO) << "GLONASS GNAV: Invalid String ID of received. Received " << d_string_ID << ", but acceptable range is from 1-15";
|
||||
|
||||
return frame_ID;
|
||||
|
||||
break;
|
||||
} // switch string ID ...
|
||||
|
||||
return d_string_ID;
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +61,8 @@ private:
|
||||
|
||||
public:
|
||||
bool flag_CRC_test;
|
||||
unsigned int frame_ID;
|
||||
unsigned int d_frame_ID;
|
||||
unsigned int d_string_ID;
|
||||
|
||||
Glonass_Gnav_Ephemeris gnav_ephemeris; //!< Ephemeris information decoded
|
||||
Glonass_Gnav_Utc_Model gnav_utc_model; //!< UTC model information
|
||||
|
@ -356,7 +356,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, unsigned int
|
||||
}
|
||||
|
||||
|
||||
if (system_.compare("GLONASS") == 0)
|
||||
if (system_.compare("Glonass") == 0)
|
||||
{
|
||||
switch ( PRN_ )
|
||||
{
|
||||
|
@ -3960,7 +3960,7 @@ int Rtcm::set_DF041(const Gnss_Synchro & gnss_synchro)
|
||||
|
||||
int Rtcm::set_DF042(const Gnss_Synchro & gnss_synchro)
|
||||
{
|
||||
const double lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
|
||||
const double lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
|
||||
double ambiguity = std::floor( gnss_synchro.Pseudorange_m / 599584.92 );
|
||||
double glonass_L1_pseudorange = std::round(( gnss_synchro.Pseudorange_m - ambiguity * 599584.92) / 0.02 );
|
||||
double glonass_L1_pseudorange_c = glonass_L1_pseudorange * 0.02 + ambiguity * 299792.458;
|
||||
@ -5270,7 +5270,7 @@ int Rtcm::set_DF401(const Gnss_Synchro & gnss_synchro)
|
||||
}
|
||||
if ((sig.compare("1C") == 0) && (sys.compare("R") == 0 ))
|
||||
{
|
||||
lambda = GLONASS_C_m_s / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))));
|
||||
lambda = GLONASS_C_m_s / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))));
|
||||
}
|
||||
if ((sig.compare("2C") == 0) && (sys.compare("R") == 0 ))
|
||||
{
|
||||
@ -5379,7 +5379,7 @@ int Rtcm::set_DF404(const Gnss_Synchro & gnss_synchro)
|
||||
}
|
||||
if ((sig_.compare("1C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
|
||||
}
|
||||
if ((sig_.compare("2C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
@ -5467,7 +5467,7 @@ int Rtcm::set_DF406(const Gnss_Synchro & gnss_synchro)
|
||||
}
|
||||
if ((sig_.compare("1C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_FREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
|
||||
lambda = GLONASS_C_m_s / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)));
|
||||
}
|
||||
if ((sig_.compare("2C") == 0) && (sys_.compare("R") == 0 ))
|
||||
{
|
||||
|
@ -35,14 +35,14 @@ if ~exist('gps_l1_ca_dll_pll_read_tracking_dump.m','file')
|
||||
end
|
||||
|
||||
|
||||
samplingFreq = 2600000; %[Hz]
|
||||
channels = 2;
|
||||
samplingFreq = 6625000; %[Hz]
|
||||
channels = 5;
|
||||
first_channel = 0;
|
||||
|
||||
path = '/home/javier/git/gnss-sdr/build/'; %% CHANGE THIS PATH
|
||||
path = '/archive/'; %% CHANGE THIS PATH
|
||||
|
||||
for N=1:1:channels
|
||||
tracking_log_path = [path 'tracking_ch_' num2str(N+first_channel-1) '.dat']; %% CHANGE epl_tracking_ch_ BY YOUR dump_filename
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user