1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-30 10:54:50 +00:00

Improving GPS L1 CA telemetry decoder

This commit is contained in:
Javier Arribas 2019-04-23 12:27:18 +02:00
parent 8ab202b666
commit 547559c0b8

View File

@ -218,8 +218,6 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
uint32_t GPS_frame_4bytes = 0; uint32_t GPS_frame_4bytes = 0;
float symbol_accumulator = 0; float symbol_accumulator = 0;
bool subframe_synchro_confirmation = false; bool subframe_synchro_confirmation = false;
bool CRC_ok = true;
for (float subframe_symbol : d_symbol_history) for (float subframe_symbol : d_symbol_history)
{ {
// ******* SYMBOL TO BIT ******* // ******* SYMBOL TO BIT *******
@ -269,11 +267,6 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
{ {
subframe_synchro_confirmation = true; subframe_synchro_confirmation = true;
} }
else
{
// std::cout << "word invalid sat " << this->d_satellite << std::endl;
CRC_ok = false;
}
// add word to subframe // add word to subframe
// insert the word in the correct position of the subframe // insert the word in the correct position of the subframe
std::memcpy(&subframe[word_index * GPS_WORD_LENGTH], &GPS_frame_4bytes, sizeof(uint32_t)); std::memcpy(&subframe[word_index * GPS_WORD_LENGTH], &GPS_frame_4bytes, sizeof(uint32_t));
@ -290,7 +283,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
// decode subframe // decode subframe
// NEW GPS SUBFRAME HAS ARRIVED! // NEW GPS SUBFRAME HAS ARRIVED!
if (CRC_ok) if (subframe_synchro_confirmation)
{ {
int32_t subframe_ID = d_nav.subframe_decoder(subframe); //decode the subframe int32_t subframe_ID = d_nav.subframe_decoder(subframe); //decode the subframe
if (subframe_ID > 0 and subframe_ID < 6) if (subframe_ID > 0 and subframe_ID < 6)
@ -329,21 +322,24 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
default: default:
break; break;
} }
return true;
} }
else else
{ {
return false; return false;
} }
} }
return subframe_synchro_confirmation;
} }
void gps_l1_ca_telemetry_decoder_gs::reset() void gps_l1_ca_telemetry_decoder_gs::reset()
{ {
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
d_last_valid_preamble = d_sample_counter; d_last_valid_preamble = d_sample_counter;
d_sent_tlm_failed_msg = false; d_sent_tlm_failed_msg = false;
flag_TOW_set = false;
d_symbol_history.clear();
d_stat = 0;
DLOG(INFO) << "Telemetry decoder reset for satellite " << d_satellite; DLOG(INFO) << "Telemetry decoder reset for satellite " << d_satellite;
} }
@ -400,6 +396,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
DLOG(INFO) << "Preamble detection for GPS L1 satellite " << this->d_satellite; DLOG(INFO) << "Preamble detection for GPS L1 satellite " << this->d_satellite;
d_stat = 1; // enter into frame pre-detection status d_stat = 1; // enter into frame pre-detection status
} }
flag_TOW_set = false;
break; break;
} }
case 1: // possible preamble lock case 1: // possible preamble lock
@ -438,6 +435,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
if (preamble_diff > d_preamble_period_symbols) if (preamble_diff > d_preamble_period_symbols)
{ {
d_stat = 0; // start again d_stat = 0; // start again
flag_TOW_set = false;
} }
} }
} }
@ -485,11 +483,18 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
// 2. Add the telemetry decoder information // 2. Add the telemetry decoder information
if (d_flag_preamble == true) if (d_flag_preamble == true)
{
if (!d_nav.d_TOW == 0)
{ {
d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0); d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0); d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
flag_TOW_set = true; flag_TOW_set = true;
} }
else
{
DLOG(INFO) << "Received GPS L1 TOW equal to zero at sat " << d_nav.i_satellite_PRN;
}
}
else else
{ {
if (flag_TOW_set == true) if (flag_TOW_set == true)