mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-04-25 00:01:25 +00:00
Improve headers, large data members first. Improve nav message interfaces
This commit is contained in:
@@ -226,7 +226,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
}
|
||||
|
||||
// 3. Check operation executed correctly
|
||||
if (d_nav.flag_crc_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
DLOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel
|
||||
<< " from satellite " << d_satellite;
|
||||
@@ -281,8 +281,8 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell
|
||||
|
||||
// Update satellite information for DNAV decoder
|
||||
sat_prn = d_satellite.get_PRN();
|
||||
d_nav.i_satellite_PRN = sat_prn;
|
||||
d_nav.i_signal_type = 1; // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
|
||||
d_nav.set_satellite_PRN(sat_prn);
|
||||
d_nav.set_signal_type(1); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
|
||||
|
||||
// Update tel dec parameters for D2 NAV Messages
|
||||
if (sat_prn > 0 and sat_prn < 6)
|
||||
@@ -448,7 +448,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
||||
// call the decoder
|
||||
decode_subframe(d_subframe_symbols.data());
|
||||
|
||||
if (d_nav.flag_crc_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -505,7 +505,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
||||
// call the decoder
|
||||
decode_subframe(d_subframe_symbols.data());
|
||||
|
||||
if (d_nav.flag_crc_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -532,17 +532,17 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
||||
}
|
||||
// UPDATE GNSS SYNCHRO DATA
|
||||
// 2. Add the telemetry decoder information
|
||||
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
|
||||
if (this->d_flag_preamble == true and d_nav.get_flag_new_SOW_available() == true)
|
||||
// update TOW at the preamble instant
|
||||
{
|
||||
// Reporting sow as gps time of week
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.get_SOW() + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||
// check TOW update consistency
|
||||
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
// compute new TOW
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
|
||||
flag_SOW_set = true;
|
||||
d_nav.flag_new_SOW_available = false;
|
||||
d_nav.set_flag_new_SOW_available(false);
|
||||
|
||||
if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(d_symbol_duration_ms))
|
||||
{
|
||||
|
||||
@@ -83,42 +83,45 @@ private:
|
||||
|
||||
// Preamble decoding
|
||||
std::array<int32_t, BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS> d_preamble_samples{};
|
||||
int32_t d_symbols_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
int32_t d_preamble_period_samples;
|
||||
|
||||
std::array<float, BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS> d_subframe_symbols{};
|
||||
uint32_t d_required_symbols;
|
||||
|
||||
// Storage for incoming data
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
bool flag_SOW_set; // Indicates when time of week is set
|
||||
|
||||
// Navigation Message variable
|
||||
Beidou_Dnav_Navigation_Message d_nav;
|
||||
|
||||
// Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
|
||||
int32_t d_channel;
|
||||
int32_t d_symbols_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
int32_t d_preamble_period_samples;
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
uint32_t d_required_symbols;
|
||||
uint32_t d_stat; // Status of decoder
|
||||
|
||||
// Values to populate gnss synchronization structure
|
||||
uint64_t d_last_valid_preamble;
|
||||
uint32_t d_symbol_duration_ms;
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
bool flag_SOW_set; // Indicates when time of week is set
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
|
||||
bool d_flag_valid_word;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool Flag_valid_word;
|
||||
|
||||
// Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
int32_t d_channel;
|
||||
bool d_dump;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_BEIDOU_B1I_TELEMETRY_DECODER_GS_H
|
||||
|
||||
@@ -227,7 +227,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
}
|
||||
|
||||
// 3. Check operation executed correctly
|
||||
if (d_nav.flag_crc_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
DLOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel
|
||||
<< " from satellite " << d_satellite;
|
||||
@@ -299,8 +299,8 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
|
||||
|
||||
// Update satellite information for DNAV decoder
|
||||
sat_prn = d_satellite.get_PRN();
|
||||
d_nav.i_satellite_PRN = sat_prn;
|
||||
d_nav.i_signal_type = 5; // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
|
||||
d_nav.set_satellite_PRN(sat_prn);
|
||||
d_nav.set_signal_type(5); // BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q)
|
||||
|
||||
// Update tel dec parameters for D2 NAV Messages
|
||||
if (sat_prn > 0 and sat_prn < 6)
|
||||
@@ -474,7 +474,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
||||
// call the decoder
|
||||
decode_subframe(d_subframe_symbols.data());
|
||||
|
||||
if (d_nav.flag_crc_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -534,7 +534,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
||||
// call the decoder
|
||||
decode_subframe(d_subframe_symbols.data());
|
||||
|
||||
if (d_nav.flag_crc_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -563,17 +563,17 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
||||
}
|
||||
// UPDATE GNSS SYNCHRO DATA
|
||||
// 2. Add the telemetry decoder information
|
||||
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
|
||||
if (this->d_flag_preamble == true and d_nav.get_flag_new_SOW_available() == true)
|
||||
// update TOW at the preamble instant
|
||||
{
|
||||
// Reporting sow as gps time of week
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.get_SOW() + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||
// check TOW update consistency
|
||||
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
// compute new TOW
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
|
||||
flag_SOW_set = true;
|
||||
d_nav.flag_new_SOW_available = false;
|
||||
d_nav.set_flag_new_SOW_available(false);
|
||||
|
||||
if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(d_symbol_duration_ms))
|
||||
{
|
||||
|
||||
@@ -81,42 +81,43 @@ private:
|
||||
|
||||
// Preamble decoding
|
||||
std::array<int32_t, BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS> d_preamble_samples{};
|
||||
int32_t d_symbols_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
int32_t d_preamble_period_samples;
|
||||
std::array<float, BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS> d_subframe_symbols{};
|
||||
uint32_t d_required_symbols;
|
||||
|
||||
// Storage for incoming data
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
bool flag_SOW_set; // Indicates when time of week is set
|
||||
|
||||
// Navigation Message variable
|
||||
Beidou_Dnav_Navigation_Message d_nav;
|
||||
|
||||
Gnss_Satellite d_satellite;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_required_symbols;
|
||||
uint32_t d_stat; // Status of decoder
|
||||
|
||||
int32_t d_channel;
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
int32_t d_symbols_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
int32_t d_preamble_period_samples;
|
||||
|
||||
// Values to populate gnss synchronization structure
|
||||
uint64_t d_last_valid_preamble;
|
||||
uint32_t d_symbol_duration_ms;
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
bool flag_SOW_set; // Indicates when time of week is set
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
bool d_flag_valid_word;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool Flag_valid_word;
|
||||
|
||||
// Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
int32_t d_channel;
|
||||
bool d_dump;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_BEIDOU_B3I_TELEMETRY_DECODER_GS_H
|
||||
|
||||
@@ -252,7 +252,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
|
||||
{
|
||||
// DECODE COMPLETE WORD (even + odd) and TEST CRC
|
||||
d_inav_nav.split_page(page_String, flag_even_word_arrived);
|
||||
if (d_inav_nav.flag_CRC_test == true)
|
||||
if (d_inav_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
DLOG(INFO) << "Galileo E1 CRC correct in channel " << d_channel << " from satellite " << d_satellite;
|
||||
}
|
||||
@@ -290,7 +290,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
|
||||
std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(d_inav_nav.get_utc_model());
|
||||
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << std::endl;
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
d_delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (fmod((d_inav_nav.WN_0 - tmp_obj->WN_0G_10), 64)));
|
||||
d_delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (std::fmod(static_cast<float>(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G_10), 64.0)));
|
||||
DLOG(INFO) << "delta_t=" << d_delta_t << "[s]";
|
||||
}
|
||||
if (d_inav_nav.have_new_almanac() == true)
|
||||
@@ -301,7 +301,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
|
||||
std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl;
|
||||
DLOG(INFO) << "Current parameters:";
|
||||
DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms;
|
||||
DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.WN_0;
|
||||
DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t
|
||||
|
||||
// DECODE COMPLETE WORD (even + odd) and TEST CRC
|
||||
d_fnav_nav.split_page(page_String);
|
||||
if (d_fnav_nav.flag_CRC_test == true)
|
||||
if (d_fnav_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
DLOG(INFO) << "Galileo E5a CRC correct in channel " << d_channel << " from satellite " << d_satellite;
|
||||
}
|
||||
@@ -595,7 +595,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
break;
|
||||
}
|
||||
d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P)
|
||||
if (d_inav_nav.flag_CRC_test == true or d_fnav_nav.flag_CRC_test == true)
|
||||
if (d_inav_nav.get_flag_CRC_test() == true or d_fnav_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -617,8 +617,8 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
d_stat = 0;
|
||||
d_TOW_at_current_symbol_ms = 0;
|
||||
d_TOW_at_Preamble_ms = 0;
|
||||
d_fnav_nav.flag_TOW_set = false;
|
||||
d_inav_nav.flag_TOW_set = false;
|
||||
d_fnav_nav.set_flag_TOW_set(false);
|
||||
d_inav_nav.set_flag_TOW_set(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -635,22 +635,22 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
{
|
||||
case 1: // INAV
|
||||
{
|
||||
if (d_inav_nav.flag_TOW_set == true)
|
||||
if (d_inav_nav.is_TOW_set() == true)
|
||||
{
|
||||
if (d_inav_nav.flag_TOW_5 == true) // page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
|
||||
if (d_inav_nav.is_TOW5_set() == true) // page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
|
||||
{
|
||||
// TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.TOW_5 * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW5() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS);
|
||||
d_inav_nav.flag_TOW_5 = false;
|
||||
d_inav_nav.set_TOW5_flag(false);
|
||||
}
|
||||
|
||||
else if (d_inav_nav.flag_TOW_6 == true) // page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
|
||||
else if (d_inav_nav.is_TOW5_set() == true) // page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
|
||||
{
|
||||
// TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.TOW_6 * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW6() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS);
|
||||
d_inav_nav.flag_TOW_6 = false;
|
||||
d_inav_nav.set_TOW6_flag(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -662,35 +662,35 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
}
|
||||
case 2: // FNAV
|
||||
{
|
||||
if (d_fnav_nav.flag_TOW_set == true)
|
||||
if (d_fnav_nav.is_TOW_set() == true)
|
||||
{
|
||||
if (d_fnav_nav.flag_TOW_1 == true)
|
||||
if (d_fnav_nav.is_TOW1_set() == true)
|
||||
{
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.FNAV_TOW_1 * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW1() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
|
||||
d_fnav_nav.flag_TOW_1 = false;
|
||||
d_fnav_nav.set_TOW1_flag(false);
|
||||
}
|
||||
else if (d_fnav_nav.flag_TOW_2 == true)
|
||||
else if (d_fnav_nav.is_TOW2_set() == true)
|
||||
{
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.FNAV_TOW_2 * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW2() * 1000.0);
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
d_fnav_nav.flag_TOW_2 = false;
|
||||
d_fnav_nav.set_TOW2_flag(false);
|
||||
}
|
||||
else if (d_fnav_nav.flag_TOW_3 == true)
|
||||
else if (d_fnav_nav.is_TOW3_set() == true)
|
||||
{
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.FNAV_TOW_3 * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW3() * 1000.0);
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
d_fnav_nav.flag_TOW_3 = false;
|
||||
d_fnav_nav.set_TOW3_flag(false);
|
||||
}
|
||||
else if (d_fnav_nav.flag_TOW_4 == true)
|
||||
else if (d_fnav_nav.is_TOW4_set() == true)
|
||||
{
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.FNAV_TOW_4 * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_fnav_nav.get_TOW4() * 1000.0);
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
d_fnav_nav.flag_TOW_4 = false;
|
||||
d_fnav_nav.set_TOW4_flag(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -707,7 +707,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
{
|
||||
case 1: // INAV
|
||||
{
|
||||
if (d_inav_nav.flag_TOW_set == true)
|
||||
if (d_inav_nav.is_TOW_set() == true)
|
||||
{
|
||||
d_TOW_at_current_symbol_ms += d_PRN_code_period_ms;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
}
|
||||
case 2: // FNAV
|
||||
{
|
||||
if (d_fnav_nav.flag_TOW_set == true)
|
||||
if (d_fnav_nav.is_TOW_set() == true)
|
||||
{
|
||||
d_TOW_at_current_symbol_ms += d_PRN_code_period_ms;
|
||||
}
|
||||
@@ -728,11 +728,11 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
{
|
||||
case 1: // INAV
|
||||
{
|
||||
if (d_inav_nav.flag_TOW_set)
|
||||
if (d_inav_nav.is_TOW_set())
|
||||
{
|
||||
if (d_inav_nav.flag_GGTO_1 == true and d_inav_nav.flag_GGTO_2 == true and d_inav_nav.flag_GGTO_3 == true and d_inav_nav.flag_GGTO_4 == true) // all GGTO parameters arrived
|
||||
if (d_inav_nav.get_flag_GGTO()) // all GGTO parameters arrived
|
||||
{
|
||||
d_delta_t = d_inav_nav.A_0G_10 + d_inav_nav.A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - d_inav_nav.t_0G_10 + 604800.0 * (fmod((d_inav_nav.WN_0 - d_inav_nav.WN_0G_10), 64.0)));
|
||||
d_delta_t = d_inav_nav.get_A0G() + d_inav_nav.get_A1G() * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - d_inav_nav.get_t0G() + 604800.0 * (std::fmod(static_cast<float>(d_inav_nav.get_Galileo_week() - d_inav_nav.get_WN0G()), 64.0)));
|
||||
}
|
||||
|
||||
current_symbol.Flag_valid_word = true;
|
||||
@@ -742,7 +742,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
|
||||
case 2: // FNAV
|
||||
{
|
||||
if (d_fnav_nav.flag_TOW_set)
|
||||
if (d_fnav_nav.is_TOW_set())
|
||||
{
|
||||
current_symbol.Flag_valid_word = true;
|
||||
}
|
||||
@@ -750,7 +750,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
}
|
||||
}
|
||||
|
||||
if (d_inav_nav.flag_TOW_set or d_fnav_nav.flag_TOW_set)
|
||||
if (d_inav_nav.is_TOW_set() or d_fnav_nav.is_TOW_set())
|
||||
{
|
||||
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
// todo: Galileo to GPS time conversion should be moved to observable block.
|
||||
|
||||
@@ -78,24 +78,42 @@ private:
|
||||
|
||||
galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, int frame_type, bool dump);
|
||||
|
||||
const int32_t d_nn = 2; // Coding rate 1/n
|
||||
const int32_t d_KK = 7; // Constraint Length
|
||||
|
||||
void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits);
|
||||
void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
|
||||
void decode_INAV_word(float *page_part_symbols, int32_t frame_length);
|
||||
void decode_FNAV_word(float *page_symbols, int32_t frame_length);
|
||||
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_flag_frame_sync;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_parity;
|
||||
bool d_flag_preamble;
|
||||
bool d_dump;
|
||||
// vars for Viterbi decoder
|
||||
std::vector<int32_t> d_preamble_samples;
|
||||
std::vector<float> d_page_part_symbols;
|
||||
std::vector<int32_t> d_out0;
|
||||
std::vector<int32_t> d_out1;
|
||||
std::vector<int32_t> d_state0;
|
||||
std::vector<int32_t> d_state1;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
Gnss_Satellite d_satellite;
|
||||
|
||||
// navigation message vars
|
||||
Galileo_Navigation_Message d_inav_nav;
|
||||
Galileo_Fnav_Message d_fnav_nav;
|
||||
|
||||
double d_delta_t; // GPS-GALILEO time offset
|
||||
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_preamble_index;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
const int32_t d_nn = 2; // Coding rate 1/n
|
||||
const int32_t d_KK = 7; // Constraint Length
|
||||
int32_t d_mm = d_KK - 1;
|
||||
int32_t d_codelength;
|
||||
int32_t d_datalength;
|
||||
|
||||
int32_t d_frame_type;
|
||||
int32_t d_bits_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
@@ -109,32 +127,14 @@ private:
|
||||
uint32_t d_stat;
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_preamble_index;
|
||||
uint64_t d_last_valid_preamble;
|
||||
uint32_t d_max_symbols_without_valid_frame;
|
||||
|
||||
double d_delta_t; // GPS-GALILEO time offset
|
||||
|
||||
// vars for Viterbi decoder
|
||||
std::vector<int32_t> d_out0;
|
||||
std::vector<int32_t> d_out1;
|
||||
std::vector<int32_t> d_state0;
|
||||
std::vector<int32_t> d_state1;
|
||||
|
||||
std::vector<int32_t> d_preamble_samples;
|
||||
std::vector<float> d_page_part_symbols;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
Gnss_Satellite d_satellite;
|
||||
|
||||
// navigation message vars
|
||||
Galileo_Navigation_Message d_inav_nav;
|
||||
Galileo_Fnav_Message d_fnav_nav;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_flag_frame_sync;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_parity;
|
||||
bool d_flag_preamble;
|
||||
bool d_dump;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GALILEO_TELEMETRY_DECODER_GS_H
|
||||
|
||||
@@ -165,7 +165,7 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
d_nav.string_decoder(data_bits);
|
||||
|
||||
// 3. Check operation executed correctly
|
||||
if (d_nav.flag_CRC_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
LOG(INFO) << "GLONASS GNAV CRC correct in channel " << d_channel << " from satellite " << d_satellite;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
if (d_nav.have_new_ephemeris() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
d_nav.gnav_ephemeris.i_satellite_freq_channel = d_satellite.get_rf_link();
|
||||
d_nav.set_rf_link(d_satellite.get_rf_link());
|
||||
std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
@@ -193,19 +193,20 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
}
|
||||
if (d_nav.have_new_almanac() == true)
|
||||
{
|
||||
uint32_t slot_nbr = d_nav.i_alm_satellite_slot_number;
|
||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||
uint32_t slot_nbr = d_nav.get_alm_satellite_slot_number();
|
||||
std::shared_ptr<Glonass_Gnav_Almanac>
|
||||
tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
||||
std::cout << "New GLONASS L1 GNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl;
|
||||
}
|
||||
// 5. Update satellite information on system
|
||||
if (d_nav.flag_update_slot_number == true)
|
||||
if (d_nav.get_flag_update_slot_number() == true)
|
||||
{
|
||||
LOG(INFO) << "GLONASS GNAV Slot Number Identified in channel " << d_channel;
|
||||
d_satellite.update_PRN(d_nav.gnav_ephemeris.d_n);
|
||||
d_satellite.what_block(d_satellite.get_system(), d_nav.gnav_ephemeris.d_n);
|
||||
d_nav.flag_update_slot_number = false;
|
||||
d_satellite.update_PRN(d_nav.get_ephemeris().d_n);
|
||||
d_satellite.what_block(d_satellite.get_system(), d_nav.get_ephemeris().d_n);
|
||||
d_nav.set_flag_update_slot_number(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +343,7 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
||||
|
||||
// call the decoder
|
||||
decode_string(string_symbols.data(), string_length);
|
||||
if (d_nav.flag_CRC_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -370,25 +371,25 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
||||
|
||||
// UPDATE GNSS SYNCHRO DATA
|
||||
// 2. Add the telemetry decoder information
|
||||
if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true)
|
||||
if (this->d_flag_preamble == true and d_nav.get_flag_TOW_new() == true)
|
||||
// update TOW at the preamble instant
|
||||
{
|
||||
d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S) * 1000) / 1000;
|
||||
d_nav.flag_TOW_new = false;
|
||||
d_TOW_at_current_symbol = floor((d_nav.get_ephemeris().d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S) * 1000) / 1000;
|
||||
d_nav.set_flag_TOW_new(false);
|
||||
}
|
||||
else // if there is not a new preamble, we define the TOW of the current symbol
|
||||
{
|
||||
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GLONASS_L1_CA_CODE_PERIOD_S;
|
||||
}
|
||||
|
||||
// if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true)
|
||||
// if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.get_flag_CRC_test() == true)
|
||||
|
||||
// if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) // all GGTO parameters arrived
|
||||
// {
|
||||
// delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64)));
|
||||
// }
|
||||
|
||||
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
|
||||
if (d_flag_frame_sync == true and d_nav.is_flag_TOW_set() == true)
|
||||
{
|
||||
current_symbol.Flag_valid_word = true;
|
||||
}
|
||||
|
||||
@@ -81,43 +81,46 @@ private:
|
||||
|
||||
glonass_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
|
||||
const std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> d_preambles_bits{GLONASS_GNAV_PREAMBLE};
|
||||
|
||||
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||
|
||||
void decode_string(const double *symbols, int32_t frame_length);
|
||||
|
||||
// Help with coherent tracking
|
||||
double d_preamble_time_samples;
|
||||
|
||||
// Preamble decoding
|
||||
const std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> d_preambles_bits{GLONASS_GNAV_PREAMBLE};
|
||||
std::array<int32_t, GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS> d_preambles_symbols{};
|
||||
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||
|
||||
// Storage for incoming data
|
||||
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
||||
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
bool flag_TOW_set; // Indicates when time of week is set
|
||||
double delta_t; // GPS-GLONASS time offset
|
||||
|
||||
// Navigation Message variable
|
||||
Glonass_Gnav_Navigation_Message d_nav;
|
||||
|
||||
// Values to populate gnss synchronization structure
|
||||
double d_TOW_at_current_symbol;
|
||||
bool Flag_valid_word;
|
||||
|
||||
// Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
int32_t d_channel;
|
||||
bool d_dump;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
double d_preamble_time_samples;
|
||||
double d_TOW_at_current_symbol;
|
||||
double delta_t; // GPS-GLONASS time offset
|
||||
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
|
||||
uint32_t d_stat; // Status of decoder
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
int32_t d_channel;
|
||||
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
bool flag_TOW_set; // Indicates when time of week is set
|
||||
bool Flag_valid_word;
|
||||
bool d_dump;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GLONASS_L1_CA_TELEMETRY_DECODER_GS_H
|
||||
|
||||
@@ -165,7 +165,7 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
d_nav.string_decoder(data_bits);
|
||||
|
||||
// 3. Check operation executed correctly
|
||||
if (d_nav.flag_CRC_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
LOG(INFO) << "GLONASS GNAV CRC correct in channel " << d_channel << " from satellite " << d_satellite;
|
||||
}
|
||||
@@ -177,7 +177,7 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
if (d_nav.have_new_ephemeris() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
d_nav.gnav_ephemeris.i_satellite_freq_channel = d_satellite.get_rf_link();
|
||||
d_nav.set_rf_link(d_satellite.get_rf_link());
|
||||
std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
@@ -193,19 +193,19 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
}
|
||||
if (d_nav.have_new_almanac() == true)
|
||||
{
|
||||
uint32_t slot_nbr = d_nav.i_alm_satellite_slot_number;
|
||||
uint32_t slot_nbr = d_nav.get_alm_satellite_slot_number();
|
||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
||||
std::cout << TEXT_CYAN << "New GLONASS L2 GNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << std::endl;
|
||||
}
|
||||
// 5. Update satellite information on system
|
||||
if (d_nav.flag_update_slot_number == true)
|
||||
if (d_nav.get_flag_update_slot_number() == true)
|
||||
{
|
||||
LOG(INFO) << "GLONASS GNAV Slot Number Identified in channel " << d_channel;
|
||||
d_satellite.update_PRN(d_nav.gnav_ephemeris.d_n);
|
||||
d_satellite.what_block(d_satellite.get_system(), d_nav.gnav_ephemeris.d_n);
|
||||
d_nav.flag_update_slot_number = false;
|
||||
d_satellite.update_PRN(d_nav.get_ephemeris().d_n);
|
||||
d_satellite.what_block(d_satellite.get_system(), d_nav.get_ephemeris().d_n);
|
||||
d_nav.set_flag_update_slot_number(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
||||
|
||||
// call the decoder
|
||||
decode_string(string_symbols.data(), string_length);
|
||||
if (d_nav.flag_CRC_test == true)
|
||||
if (d_nav.get_flag_CRC_test() == true)
|
||||
{
|
||||
d_CRC_error_counter = 0;
|
||||
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||
@@ -370,25 +370,25 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
||||
|
||||
// UPDATE GNSS SYNCHRO DATA
|
||||
// 2. Add the telemetry decoder information
|
||||
if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true)
|
||||
if (this->d_flag_preamble == true and d_nav.get_flag_TOW_new() == true)
|
||||
// update TOW at the preamble instant
|
||||
{
|
||||
d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S) * 1000) / 1000;
|
||||
d_nav.flag_TOW_new = false;
|
||||
d_TOW_at_current_symbol = floor((d_nav.get_ephemeris().d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S) * 1000) / 1000;
|
||||
d_nav.set_flag_TOW_new(false);
|
||||
}
|
||||
else // if there is not a new preamble, we define the TOW of the current symbol
|
||||
{
|
||||
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GLONASS_L2_CA_CODE_PERIOD_S;
|
||||
}
|
||||
|
||||
// if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true)
|
||||
// if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.get_flag_CRC_test() == true)
|
||||
|
||||
// if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) // all GGTO parameters arrived
|
||||
// {
|
||||
// delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64)));
|
||||
// }
|
||||
|
||||
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
|
||||
if (d_flag_frame_sync == true and d_nav.is_flag_TOW_set() == true)
|
||||
{
|
||||
current_symbol.Flag_valid_word = true;
|
||||
}
|
||||
|
||||
@@ -78,43 +78,42 @@ private:
|
||||
|
||||
glonass_l2_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
|
||||
void decode_string(const double *symbols, int32_t frame_length);
|
||||
|
||||
// Help with coherent tracking
|
||||
double d_preamble_time_samples;
|
||||
|
||||
// Preamble decoding
|
||||
const std::array<uint16_t, GLONASS_GNAV_PREAMBLE_LENGTH_BITS> d_preambles_bits{GLONASS_GNAV_PREAMBLE};
|
||||
std::array<int32_t, GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS> d_preambles_symbols{};
|
||||
|
||||
const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||
|
||||
void decode_string(const double *symbols, int32_t frame_length);
|
||||
|
||||
// Storage for incoming data
|
||||
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
||||
|
||||
// Variables for internal functionality
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
bool flag_TOW_set; // Indicates when time of week is set
|
||||
double delta_t; // GPS-GLONASS time offset
|
||||
std::array<int32_t, GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS> d_preambles_symbols{};
|
||||
|
||||
// Navigation Message variable
|
||||
Glonass_Gnav_Navigation_Message d_nav;
|
||||
|
||||
// Values to populate gnss synchronization structure
|
||||
double d_TOW_at_current_symbol;
|
||||
bool Flag_valid_word;
|
||||
|
||||
// Satellite Information and logging capacity
|
||||
Gnss_Satellite d_satellite;
|
||||
int32_t d_channel;
|
||||
bool d_dump;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
double d_preamble_time_samples;
|
||||
double delta_t; // GPS-GLONASS time offset
|
||||
double d_TOW_at_current_symbol;
|
||||
|
||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||
uint32_t d_stat; // Status of decoder
|
||||
|
||||
int32_t d_CRC_error_counter; // Number of failed CRC operations
|
||||
int32_t d_channel;
|
||||
|
||||
bool Flag_valid_word;
|
||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||
bool d_flag_parity; // Flag indicating when parity check was achieved (crc check)
|
||||
bool d_flag_preamble; // Flag indicating when preamble was found
|
||||
bool flag_TOW_set; // Indicates when time of week is set
|
||||
bool d_dump;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GLONASS_L2_CA_TELEMETRY_DECODER_GS_H
|
||||
|
||||
@@ -172,7 +172,7 @@ void gps_l1_ca_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satelli
|
||||
d_nav = Gps_Navigation_Message();
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||
d_nav.i_satellite_PRN = d_satellite.get_PRN();
|
||||
d_nav.set_satellite_PRN(d_satellite.get_PRN());
|
||||
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void gps_l1_ca_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satelli
|
||||
void gps_l1_ca_telemetry_decoder_gs::set_channel(int32_t channel)
|
||||
{
|
||||
d_channel = channel;
|
||||
d_nav.i_channel_ID = channel;
|
||||
d_nav.set_channel(channel);
|
||||
DLOG(INFO) << "Navigation channel set to " << channel;
|
||||
// ############# ENABLE DATA FILE LOG #################
|
||||
if (d_dump == true)
|
||||
@@ -274,7 +274,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "
|
||||
<< "subframe "
|
||||
<< subframe_ID << " from satellite "
|
||||
<< Gnss_Satellite(std::string("GPS"), d_nav.i_satellite_PRN) << std::endl;
|
||||
<< Gnss_Satellite(std::string("GPS"), d_nav.get_satellite_PRN()) << std::endl;
|
||||
|
||||
switch (subframe_ID)
|
||||
{
|
||||
@@ -287,12 +287,12 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
}
|
||||
break;
|
||||
case 4: // Possible IONOSPHERE and UTC model update (page 18)
|
||||
if (d_nav.flag_iono_valid == true)
|
||||
if (d_nav.get_flag_iono_valid() == true)
|
||||
{
|
||||
std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(d_nav.get_iono());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_nav.flag_utc_model_valid == true)
|
||||
if (d_nav.get_flag_utc_model_valid() == true)
|
||||
{
|
||||
std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(d_nav.get_utc_model());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
@@ -474,15 +474,15 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
// 2. Add the telemetry decoder information
|
||||
if (d_flag_preamble == true)
|
||||
{
|
||||
if (!(d_nav.d_TOW == 0))
|
||||
if (!(d_nav.get_TOW() == 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_current_symbol_ms = static_cast<uint32_t>(d_nav.get_TOW() * 1000.0);
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.get_TOW() * 1000.0);
|
||||
d_flag_TOW_set = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DLOG(INFO) << "Received GPS L1 TOW equal to zero at sat " << d_nav.i_satellite_PRN;
|
||||
DLOG(INFO) << "Received GPS L1 TOW equal to zero at sat " << d_nav.get_satellite_PRN();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -76,13 +76,19 @@ private:
|
||||
bool gps_word_parityCheck(uint32_t gpsword);
|
||||
bool decode_subframe();
|
||||
|
||||
bool d_flag_frame_sync;
|
||||
bool d_flag_parity;
|
||||
bool d_flag_preamble;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_TOW_set;
|
||||
bool d_dump;
|
||||
Gps_Navigation_Message d_nav;
|
||||
Gnss_Satellite d_satellite;
|
||||
|
||||
std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_preamble_index;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
int32_t d_bits_per_preamble;
|
||||
int32_t d_samples_per_preamble;
|
||||
@@ -98,19 +104,13 @@ private:
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_preamble_index;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
std::array<int32_t, GPS_CA_PREAMBLE_LENGTH_BITS> d_preamble_samples{};
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
boost::circular_buffer<float> d_symbol_history;
|
||||
|
||||
Gps_Navigation_Message d_nav;
|
||||
Gnss_Satellite d_satellite;
|
||||
bool d_flag_frame_sync;
|
||||
bool d_flag_parity;
|
||||
bool d_flag_preamble;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_TOW_set;
|
||||
bool d_dump;
|
||||
};
|
||||
|
||||
#endif // GNSS_SDR_GPS_L1_CA_TELEMETRY_DECODER_GS_H
|
||||
|
||||
@@ -75,31 +75,31 @@ private:
|
||||
|
||||
gps_l2c_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
|
||||
bool d_dump;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_valid_word;
|
||||
|
||||
int32_t d_channel;
|
||||
int32_t d_state;
|
||||
int32_t d_crc_error_count;
|
||||
|
||||
uint64_t d_sample_counter;
|
||||
|
||||
uint64_t d_last_valid_preamble;
|
||||
uint32_t d_max_symbols_without_valid_frame;
|
||||
|
||||
double d_TOW_at_current_symbol;
|
||||
double d_TOW_at_Preamble;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
Gnss_Satellite d_satellite;
|
||||
|
||||
cnav_msg_decoder_t d_cnav_decoder{};
|
||||
|
||||
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
double d_TOW_at_current_symbol;
|
||||
double d_TOW_at_Preamble;
|
||||
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
int32_t d_channel;
|
||||
int32_t d_state;
|
||||
int32_t d_crc_error_count;
|
||||
|
||||
uint32_t d_max_symbols_without_valid_frame;
|
||||
|
||||
bool d_dump;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_valid_word;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -74,27 +74,28 @@ private:
|
||||
|
||||
gps_l5_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||
|
||||
bool d_dump;
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_valid_word;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
|
||||
int32_t d_channel;
|
||||
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_last_valid_preamble;
|
||||
uint32_t d_max_symbols_without_valid_frame;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
cnav_msg_decoder_t d_cnav_decoder{};
|
||||
|
||||
Gnss_Satellite d_satellite;
|
||||
|
||||
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
uint64_t d_sample_counter;
|
||||
uint64_t d_last_valid_preamble;
|
||||
|
||||
int32_t d_channel;
|
||||
|
||||
uint32_t d_TOW_at_current_symbol_ms;
|
||||
uint32_t d_TOW_at_Preamble_ms;
|
||||
uint32_t d_max_symbols_without_valid_frame;
|
||||
|
||||
bool d_flag_PLL_180_deg_phase_locked;
|
||||
bool d_flag_valid_word;
|
||||
bool d_sent_tlm_failed_msg;
|
||||
bool d_dump;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user