1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Merge branch 'galileo-e6' into ssr

This commit is contained in:
Carles Fernandez 2021-11-20 04:09:24 +01:00
commit b35e65e0d3
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
10 changed files with 449 additions and 72 deletions

View File

@ -56,6 +56,10 @@ All notable changes to GNSS-SDR will be documented in this file.
### Improvements in Reliability: ### Improvements in Reliability:
- Fixed some potential buffer overflows. - Fixed some potential buffer overflows.
- Avoid source code lines longer than 512 characters. This was a warning raised
by Lintian (very-long-line-length-in-source-file). Long lines in source code
could be used to obfuscate the source code and to hide stuff like backdoors or
security problems.
### Improvements in Usability: ### Improvements in Usability:

View File

@ -183,7 +183,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data)
d_has_file << indent << indent << "Code Bias Flag: " << static_cast<float>(has_data->header.code_bias_flag) << '\n'; d_has_file << indent << indent << "Code Bias Flag: " << static_cast<float>(has_data->header.code_bias_flag) << '\n';
d_has_file << indent << indent << "Phase Bias Flag: " << static_cast<float>(has_data->header.phase_bias_flag) << '\n'; d_has_file << indent << indent << "Phase Bias Flag: " << static_cast<float>(has_data->header.phase_bias_flag) << '\n';
d_has_file << indent << indent << "Mask ID: " << static_cast<float>(has_data->header.mask_id) << '\n'; d_has_file << indent << indent << "Mask ID: " << static_cast<float>(has_data->header.mask_id) << '\n';
d_has_file << indent << indent << "IOD Set ID: " << static_cast<float>(has_data->header.iod_id) << "\n\n"; d_has_file << indent << indent << "IOD Set ID: " << static_cast<float>(has_data->header.iod_set_id) << "\n\n";
d_has_file << indent << "MT1 Body\n"; d_has_file << indent << "MT1 Body\n";
d_has_file << indent << "--------\n"; d_has_file << indent << "--------\n";
@ -240,7 +240,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data)
d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_orbit_corrections) << '\n'; d_has_file << indent << indent << "Validity interval: " << static_cast<float>(has_data->validity_interval_index_orbit_corrections) << '\n';
d_has_file << indent << indent << "GNSS IOD: " << print_vector(has_data->gnss_iod) << '\n'; d_has_file << indent << indent << "GNSS IOD: " << print_vector(has_data->gnss_iod) << '\n';
d_has_file << indent << indent << "Delta Radial [m]: " << print_vector(has_data->delta_radial, HAS_MSG_DELTA_RADIAL_SCALE_FACTOR) << '\n'; d_has_file << indent << indent << "Delta Radial [m]: " << print_vector(has_data->delta_radial, HAS_MSG_DELTA_RADIAL_SCALE_FACTOR) << '\n';
d_has_file << indent << indent << "Delta Along Track [m]: " << print_vector(has_data->delta_along_track, HAS_MSG_DELTA_ALONG_TRACK_SCALE_FACTOR) << '\n'; d_has_file << indent << indent << "Delta In-Track [m]: " << print_vector(has_data->delta_in_track, HAS_MSG_DELTA_IN_TRACK_SCALE_FACTOR) << '\n';
d_has_file << indent << indent << "Delta Cross Track [m]: " << print_vector(has_data->delta_cross_track, HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR) << '\n'; d_has_file << indent << indent << "Delta Cross Track [m]: " << print_vector(has_data->delta_cross_track, HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR) << '\n';
} }

View File

@ -59,6 +59,12 @@ Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(const std::string &device
shift_out_bits_band1 = shift_out_bits_default; shift_out_bits_band1 = shift_out_bits_default;
shift_out_bits_band2 = shift_out_bits_default; shift_out_bits_band2 = shift_out_bits_default;
// init bit selection corresopnding to frequency band 1
d_map_base1[0] = shift_out_bits_band1;
// init bit selection corresponding to frequency band 2
d_map_base2[0] = shift_out_bits_band2;
DLOG(INFO) << "Dynamic bit selection FPGA class created"; DLOG(INFO) << "Dynamic bit selection FPGA class created";
} }

View File

@ -103,6 +103,47 @@ void galileo_e6_has_msg_receiver::set_enable_navdata_monitor(bool enable)
} }
std::shared_ptr<Galileo_HAS_data> galileo_e6_has_msg_receiver::process_test_page(const pmt::pmt_t& msg)
{
try
{
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
if (msg_type_hash_code == typeid(std::shared_ptr<Galileo_HAS_page>).hash_code())
{
const auto HAS_data_page = wht::any_cast<std::shared_ptr<Galileo_HAS_page>>(pmt::any_ref(msg));
DLOG(INFO) << "New HAS page received: "
<< "Status: " << static_cast<float>(HAS_data_page->has_status) << ", "
<< "MT: " << static_cast<float>(HAS_data_page->message_type) << ", "
<< "MID: " << static_cast<float>(HAS_data_page->message_id) << ", "
<< "MS: " << static_cast<float>(HAS_data_page->message_size) << ", "
<< "PID: " << static_cast<float>(HAS_data_page->message_page_id);
d_current_has_status = HAS_data_page->has_status;
d_current_message_id = HAS_data_page->message_id;
process_HAS_page(*HAS_data_page.get());
}
else
{
LOG(WARNING) << "galileo_e6_has_msg_receiver received an unknown object type!";
}
}
catch (const wht::bad_any_cast& e)
{
LOG(WARNING) << "galileo_e6_has_msg_receiver Bad any_cast: " << e.what();
}
// Return the resulting decoded HAS data (if available)
if (d_new_message == true)
{
d_HAS_data.has_status = d_current_has_status;
d_HAS_data.message_id = d_current_message_id;
auto has_data_ptr = std::make_shared<Galileo_HAS_data>(d_HAS_data);
d_new_message = false;
return has_data_ptr;
}
return nullptr;
}
void galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has(const pmt::pmt_t& msg) void galileo_e6_has_msg_receiver::msg_handler_galileo_e6_has(const pmt::pmt_t& msg)
{ {
gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_galileo_e6_has function called by the scheduler gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_galileo_e6_has function called by the scheduler
@ -184,12 +225,12 @@ void galileo_e6_has_msg_receiver::process_HAS_page(const Galileo_HAS_page& has_p
if (res == 0) if (res == 0)
{ {
// Successful decoding, we have a valid HAS message stored at d_HAS_data // Successful decoding, we have a valid HAS message stored at d_HAS_data
std::cout << TEXT_MAGENTA << "New Galileo HAS message type " << std::to_string(has_page.message_id)
<< " received and successfully decoded" << TEXT_RESET << '\n';
if (d_nsat_in_mask_id[d_HAS_data.header.mask_id] != 0) if (d_nsat_in_mask_id[d_HAS_data.header.mask_id] != 0)
{ {
// if we have the mask for that message, it's ready to be sent to PVT // if we have the mask for that message, it's ready to be sent to PVT
d_new_message = true; d_new_message = true;
std::cout << TEXT_MAGENTA << "New Galileo HAS message ID " << std::to_string(has_page.message_id)
<< " received and successfully decoded" << TEXT_RESET << '\n';
} }
} }
} }
@ -338,36 +379,36 @@ int galileo_e6_has_msg_receiver::decode_message_type1(uint8_t message_id, uint8_
void galileo_e6_has_msg_receiver::read_MT1_header(const std::string& message_header) void galileo_e6_has_msg_receiver::read_MT1_header(const std::string& message_header)
{ {
// ICD v1.2 Table 6: MT1 Message Header // ICD v1.4 Table 7: MT1 Message Header
const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> has_mt1_header(message_header); const std::bitset<GALILEO_CNAV_MT1_HEADER_BITS> has_mt1_header(message_header);
d_HAS_data.header.toh = read_has_message_header_parameter_uint16(has_mt1_header, GALILEO_MT1_HEADER_TOH); d_HAS_data.header.toh = read_has_message_header_parameter_uint16(has_mt1_header, GALILEO_MT1_HEADER_TOH);
d_HAS_data.header.mask_id = read_has_message_header_parameter_uint8(has_mt1_header, GALILEO_MT1_HEADER_MASK_ID);
d_HAS_data.header.iod_id = read_has_message_header_parameter_uint8(has_mt1_header, GALILEO_MT1_HEADER_IOD_ID);
d_HAS_data.header.mask_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_MASK_FLAG); d_HAS_data.header.mask_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_MASK_FLAG);
d_HAS_data.header.orbit_correction_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_ORBIT_CORRECTION_FLAG); d_HAS_data.header.orbit_correction_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_ORBIT_CORRECTION_FLAG);
d_HAS_data.header.clock_fullset_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_CLOCK_FULLSET_FLAG); d_HAS_data.header.clock_fullset_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_CLOCK_FULLSET_FLAG);
d_HAS_data.header.clock_subset_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_CLOCK_SUBSET_FLAG); d_HAS_data.header.clock_subset_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_CLOCK_SUBSET_FLAG);
d_HAS_data.header.code_bias_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_CODE_BIAS_FLAG); d_HAS_data.header.code_bias_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_CODE_BIAS_FLAG);
d_HAS_data.header.phase_bias_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_PHASE_BIAS_FLAG); d_HAS_data.header.phase_bias_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_PHASE_BIAS_FLAG);
d_HAS_data.header.ura_flag = read_has_message_header_parameter_bool(has_mt1_header, GALILEO_MT1_HEADER_URA_FLAG); d_HAS_data.header.reserved = read_has_message_header_parameter_uint8(has_mt1_header, GALILEO_MT1_HEADER_RESERVED);
d_HAS_data.header.mask_id = read_has_message_header_parameter_uint8(has_mt1_header, GALILEO_MT1_HEADER_MASK_ID);
d_HAS_data.header.iod_set_id = read_has_message_header_parameter_uint8(has_mt1_header, GALILEO_MT1_HEADER_IOD_SET_ID);
DLOG(INFO) << "MT1 header " << message_header << ": " DLOG(INFO) << "MT1 header " << message_header << ": "
<< "TOH: " << static_cast<float>(d_HAS_data.header.toh) << ", " << "TOH: " << static_cast<float>(d_HAS_data.header.toh) << ", "
<< "mask ID: " << static_cast<float>(d_HAS_data.header.mask_id) << ", "
<< "iod ID: " << static_cast<float>(d_HAS_data.header.iod_id) << ", "
<< "mask_flag: " << static_cast<float>(d_HAS_data.header.mask_flag) << ", " << "mask_flag: " << static_cast<float>(d_HAS_data.header.mask_flag) << ", "
<< "orbit_correction_flag: " << static_cast<float>(d_HAS_data.header.orbit_correction_flag) << ", " << "orbit_correction_flag: " << static_cast<float>(d_HAS_data.header.orbit_correction_flag) << ", "
<< "clock_fullset_flag: " << static_cast<float>(d_HAS_data.header.clock_fullset_flag) << ", " << "clock_fullset_flag: " << static_cast<float>(d_HAS_data.header.clock_fullset_flag) << ", "
<< "clock_subset_flag: " << static_cast<float>(d_HAS_data.header.clock_subset_flag) << ", " << "clock_subset_flag: " << static_cast<float>(d_HAS_data.header.clock_subset_flag) << ", "
<< "code_bias_flag: " << static_cast<float>(d_HAS_data.header.code_bias_flag) << ", " << "code_bias_flag: " << static_cast<float>(d_HAS_data.header.code_bias_flag) << ", "
<< "phase_bias_flag: " << static_cast<float>(d_HAS_data.header.phase_bias_flag) << ", " << "phase_bias_flag: " << static_cast<float>(d_HAS_data.header.phase_bias_flag) << ", "
<< "ura_flag: " << static_cast<float>(d_HAS_data.header.ura_flag); << "reserved: " << static_cast<float>(d_HAS_data.header.reserved) << ", "
<< "mask ID: " << static_cast<float>(d_HAS_data.header.mask_id) << ", "
<< "iod ID: " << static_cast<float>(d_HAS_data.header.iod_set_id);
} }
void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body) void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
{ {
// ICD v1.2 Table 7: MT1 Message Body. // ICD v1.4 Table 8: MT1 Message Body.
auto message = std::string(message_body); auto message = std::string(message_body);
int Nsat = 0; int Nsat = 0;
bool have_mask = false; bool have_mask = false;
@ -489,7 +530,7 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
message = std::string(message.begin() + HAS_MSG_VALIDITY_INDEX_LENGTH, message.end()); message = std::string(message.begin() + HAS_MSG_VALIDITY_INDEX_LENGTH, message.end());
d_HAS_data.gnss_iod = std::vector<uint16_t>(Nsat); d_HAS_data.gnss_iod = std::vector<uint16_t>(Nsat);
d_HAS_data.delta_radial = std::vector<int16_t>(Nsat); d_HAS_data.delta_radial = std::vector<int16_t>(Nsat);
d_HAS_data.delta_along_track = std::vector<int16_t>(Nsat); d_HAS_data.delta_in_track = std::vector<int16_t>(Nsat);
d_HAS_data.delta_cross_track = std::vector<int16_t>(Nsat); d_HAS_data.delta_cross_track = std::vector<int16_t>(Nsat);
for (int i = 0; i < Nsat; i++) for (int i = 0; i < Nsat; i++)
{ {
@ -520,8 +561,8 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
d_HAS_data.delta_radial[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_RADIAL_LENGTH)); d_HAS_data.delta_radial[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_RADIAL_LENGTH));
message = std::string(message.begin() + HAS_MSG_DELTA_RADIAL_LENGTH, message.end()); message = std::string(message.begin() + HAS_MSG_DELTA_RADIAL_LENGTH, message.end());
d_HAS_data.delta_along_track[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_ALONG_TRACK_LENGTH)); d_HAS_data.delta_in_track[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_IN_TRACK_LENGTH));
message = std::string(message.begin() + HAS_MSG_DELTA_ALONG_TRACK_LENGTH, message.end()); message = std::string(message.begin() + HAS_MSG_DELTA_IN_TRACK_LENGTH, message.end());
d_HAS_data.delta_cross_track[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_CROSS_TRACK_LENGTH)); d_HAS_data.delta_cross_track[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_CROSS_TRACK_LENGTH));
message = std::string(message.begin() + HAS_MSG_DELTA_CROSS_TRACK_LENGTH, message.end()); message = std::string(message.begin() + HAS_MSG_DELTA_CROSS_TRACK_LENGTH, message.end());
@ -530,7 +571,7 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
DLOG(INFO) << debug_print_vector("gnss_iod", d_HAS_data.gnss_iod); DLOG(INFO) << debug_print_vector("gnss_iod", d_HAS_data.gnss_iod);
DLOG(INFO) << debug_print_vector("delta_radial", d_HAS_data.delta_radial); DLOG(INFO) << debug_print_vector("delta_radial", d_HAS_data.delta_radial);
DLOG(INFO) << debug_print_vector("delta_along_track", d_HAS_data.delta_along_track); DLOG(INFO) << debug_print_vector("delta_in_track", d_HAS_data.delta_in_track);
DLOG(INFO) << debug_print_vector("delta_cross_track", d_HAS_data.delta_cross_track); DLOG(INFO) << debug_print_vector("delta_cross_track", d_HAS_data.delta_cross_track);
} }
@ -547,12 +588,9 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
message = std::string(message.begin() + HAS_MSG_DELTA_CLOCK_C0_MULTIPLIER_LENGTH, message.end()); message = std::string(message.begin() + HAS_MSG_DELTA_CLOCK_C0_MULTIPLIER_LENGTH, message.end());
} }
d_HAS_data.iod_change_flag = std::vector<bool>(Nsat);
d_HAS_data.delta_clock_c0 = std::vector<int16_t>(Nsat); d_HAS_data.delta_clock_c0 = std::vector<int16_t>(Nsat);
for (int i = 0; i < Nsat; i++) for (int i = 0; i < Nsat; i++)
{ {
d_HAS_data.iod_change_flag[i] = (message[0] == '1' ? true : false);
message = std::string(message.begin() + 1, message.end());
d_HAS_data.delta_clock_c0[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_CLOCK_C0_LENGTH)); d_HAS_data.delta_clock_c0[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_CLOCK_C0_LENGTH));
message = std::string(message.begin() + HAS_MSG_DELTA_CLOCK_C0_LENGTH, message.end()); message = std::string(message.begin() + HAS_MSG_DELTA_CLOCK_C0_LENGTH, message.end());
} }
@ -580,7 +618,6 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
d_HAS_data.gnss_id_clock_subset = std::vector<uint8_t>(d_HAS_data.Nsysprime); d_HAS_data.gnss_id_clock_subset = std::vector<uint8_t>(d_HAS_data.Nsysprime);
d_HAS_data.delta_clock_c0_multiplier_clock_subset = std::vector<uint8_t>(d_HAS_data.Nsysprime); d_HAS_data.delta_clock_c0_multiplier_clock_subset = std::vector<uint8_t>(d_HAS_data.Nsysprime);
d_HAS_data.satellite_submask = std::vector<uint64_t>(d_HAS_data.Nsysprime); d_HAS_data.satellite_submask = std::vector<uint64_t>(d_HAS_data.Nsysprime);
d_HAS_data.iod_change_flag_clock_subset = std::vector<std::vector<bool>>(d_HAS_data.Nsysprime, std::vector<bool>());
d_HAS_data.delta_clock_c0_clock_subset = std::vector<std::vector<int16_t>>(d_HAS_data.Nsysprime, std::vector<int16_t>()); d_HAS_data.delta_clock_c0_clock_subset = std::vector<std::vector<int16_t>>(d_HAS_data.Nsysprime, std::vector<int16_t>());
for (uint8_t i = 0; i < d_HAS_data.Nsysprime; i++) for (uint8_t i = 0; i < d_HAS_data.Nsysprime; i++)
@ -785,19 +822,6 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body)
DLOG(INFO) << debug_print_matrix("phase bias", d_HAS_data.phase_bias); DLOG(INFO) << debug_print_matrix("phase bias", d_HAS_data.phase_bias);
DLOG(INFO) << debug_print_matrix("phase discontinuity indicator", d_HAS_data.phase_discontinuity_indicator); DLOG(INFO) << debug_print_matrix("phase discontinuity indicator", d_HAS_data.phase_discontinuity_indicator);
} }
// if (d_HAS_data.header.ura_flag && have_mask)
// {
// // read URA
// d_HAS_data.validity_interval_index_ura_corrections = read_has_message_body_uint8(message.substr(0, HAS_MSG_VALIDITY_INDEX_LENGTH));
// message = std::string(message.begin() + HAS_MSG_VALIDITY_INDEX_LENGTH, message.end());
// d_HAS_data.ura = std::vector<uint8_t>(Nsat);
// for (int i = 0; i < Nsat; i++)
// {
// d_HAS_data.ura[i] = read_has_message_body_uint8(message.substr(0, HAS_MSG_URA_LENGTH));
// message = std::string(message.begin() + HAS_MSG_URA_LENGTH, message.end());
// }
// }
} }

View File

@ -57,6 +57,7 @@ class galileo_e6_has_msg_receiver : public gr::block
public: public:
~galileo_e6_has_msg_receiver() = default; //!< Default destructor ~galileo_e6_has_msg_receiver() = default; //!< Default destructor
void set_enable_navdata_monitor(bool enable); void set_enable_navdata_monitor(bool enable);
std::shared_ptr<Galileo_HAS_data> process_test_page(const pmt::pmt_t& msg); //!< For testing purposes only
private: private:
friend galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make(); friend galileo_e6_has_msg_receiver_sptr galileo_e6_has_msg_receiver_make();

View File

@ -1,9 +1,9 @@
/*! /*!
* \file Galileo_CNAV.h * \file Galileo_CNAV.h
* \brief Galileo CNAV mesage constants. Data from: * \brief Galileo CNAV mesage constants. Data from:
* Galileo High Accuracy Service E6-B Signal-In-Space Message Specification v1.2 * Galileo High Accuracy Service E6-B Signal-In-Space Message Specification v1.4
* (April 2020). * (February 2021).
* \author Carles Fernandez-Prades, 2020. cfernandez(at)cttc.es * \author Carles Fernandez-Prades, 2020-2021. cfernandez(at)cttc.es
* *
* *
* ----------------------------------------------------------------------------- * -----------------------------------------------------------------------------
@ -61,11 +61,11 @@ constexpr size_t HAS_MSG_MASK_RESERVED_LENGTH = 6;
constexpr size_t HAS_MSG_VALIDITY_INDEX_LENGTH = 4; constexpr size_t HAS_MSG_VALIDITY_INDEX_LENGTH = 4;
constexpr size_t HAS_MSG_IOD_GPS_LENGTH = 8; constexpr size_t HAS_MSG_IOD_GPS_LENGTH = 8;
constexpr size_t HAS_MSG_IOD_GAL_LENGTH = 10; constexpr size_t HAS_MSG_IOD_GAL_LENGTH = 10;
constexpr size_t HAS_MSG_DELTA_RADIAL_LENGTH = 14; constexpr size_t HAS_MSG_DELTA_RADIAL_LENGTH = 13;
constexpr size_t HAS_MSG_DELTA_ALONG_TRACK_LENGTH = 12; constexpr size_t HAS_MSG_DELTA_IN_TRACK_LENGTH = 12;
constexpr size_t HAS_MSG_DELTA_CROSS_TRACK_LENGTH = 12; constexpr size_t HAS_MSG_DELTA_CROSS_TRACK_LENGTH = 12;
constexpr size_t HAS_MSG_DELTA_CLOCK_C0_MULTIPLIER_LENGTH = 2; constexpr size_t HAS_MSG_DELTA_CLOCK_C0_MULTIPLIER_LENGTH = 2;
constexpr size_t HAS_MSG_DELTA_CLOCK_C0_LENGTH = 14; constexpr size_t HAS_MSG_DELTA_CLOCK_C0_LENGTH = 13;
constexpr size_t HAS_MSG_NSYSPRIME_LENGTH = 4; constexpr size_t HAS_MSG_NSYSPRIME_LENGTH = 4;
constexpr size_t HAS_MSG_ID_CLOCK_SUBSET_LENGTH = 4; constexpr size_t HAS_MSG_ID_CLOCK_SUBSET_LENGTH = 4;
constexpr size_t HAS_MSG_DELTA_CLOCK_MULTIPLIER_SUBSET_LENGTH = 2; constexpr size_t HAS_MSG_DELTA_CLOCK_MULTIPLIER_SUBSET_LENGTH = 2;
@ -73,7 +73,6 @@ constexpr size_t HAS_MSG_DELTA_CLOCK_C0_SUBSET_LENGTH = 13;
constexpr size_t HAS_MSG_CODE_BIAS_LENGTH = 11; constexpr size_t HAS_MSG_CODE_BIAS_LENGTH = 11;
constexpr size_t HAS_MSG_PHASE_BIAS_LENGTH = 11; constexpr size_t HAS_MSG_PHASE_BIAS_LENGTH = 11;
constexpr size_t HAS_MSG_PHASE_DISCONTINUITY_INDICATOR_LENGTH = 2; constexpr size_t HAS_MSG_PHASE_DISCONTINUITY_INDICATOR_LENGTH = 2;
constexpr size_t HAS_MSG_URA_LENGTH = 2;
constexpr int32_t HAS_MSG_NUMBER_MASK_IDS = 32; constexpr int32_t HAS_MSG_NUMBER_MASK_IDS = 32;
constexpr int32_t HAS_MSG_NUMBER_GNSS_IDS = 16; constexpr int32_t HAS_MSG_NUMBER_GNSS_IDS = 16;
@ -82,7 +81,7 @@ constexpr int32_t HAS_MSG_NUMBER_SATELLITE_IDS = 40;
constexpr int32_t HAS_MSG_NUMBER_SIGNAL_MASKS = 16; constexpr int32_t HAS_MSG_NUMBER_SIGNAL_MASKS = 16;
constexpr float HAS_MSG_DELTA_RADIAL_SCALE_FACTOR = 0.0025; constexpr float HAS_MSG_DELTA_RADIAL_SCALE_FACTOR = 0.0025;
constexpr float HAS_MSG_DELTA_ALONG_TRACK_SCALE_FACTOR = 0.008; constexpr float HAS_MSG_DELTA_IN_TRACK_SCALE_FACTOR = 0.008;
constexpr float HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR = 0.008; constexpr float HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR = 0.008;
constexpr float HAS_MSG_DELTA_CLOCK_SCALE_FACTOR = 0.0025; constexpr float HAS_MSG_DELTA_CLOCK_SCALE_FACTOR = 0.0025;
constexpr float HAS_MSG_CODE_BIAS_SCALE_FACTOR = 0.02; constexpr float HAS_MSG_CODE_BIAS_SCALE_FACTOR = 0.02;
@ -90,8 +89,8 @@ constexpr float HAS_MSG_PHASE_BIAS_SCALE_FACTOR = 0.01;
constexpr uint16_t HAS_MSG_NUMBER_MAX_TOH = 3599; constexpr uint16_t HAS_MSG_NUMBER_MAX_TOH = 3599;
constexpr uint8_t HAS_MSG_GPS_SYSTEM = 0; // Table 8 ICD v1.2 constexpr uint8_t HAS_MSG_GPS_SYSTEM = 0; // Table 9 ICD v1.4
constexpr uint8_t HAS_MSG_GALILEO_SYSTEM = 2; // Table 8 ICD v1.2 constexpr uint8_t HAS_MSG_GALILEO_SYSTEM = 2; // Table 9 ICD v1.4
constexpr uint8_t HAS_MSG_WRONG_SYSTEM = 255; constexpr uint8_t HAS_MSG_WRONG_SYSTEM = 255;
const std::pair<int32_t, int32_t> GALILEO_HAS_STATUS({1, 2}); const std::pair<int32_t, int32_t> GALILEO_HAS_STATUS({1, 2});
@ -108,9 +107,9 @@ const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_CLOCK_FULLSET_FLAG({15, 1})
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_CLOCK_SUBSET_FLAG({16, 1}); const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_CLOCK_SUBSET_FLAG({16, 1});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_CODE_BIAS_FLAG({17, 1}); const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_CODE_BIAS_FLAG({17, 1});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_PHASE_BIAS_FLAG({18, 1}); const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_PHASE_BIAS_FLAG({18, 1});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_URA_FLAG({19, 1}); const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_RESERVED({19, 4});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_MASK_ID({23, 5}); const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_MASK_ID({23, 5});
const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_IOD_ID({28, 5}); const std::pair<int32_t, int32_t> GALILEO_MT1_HEADER_IOD_SET_ID({28, 5});
/** \} */ /** \} */

View File

@ -503,28 +503,28 @@ std::vector<float> Galileo_HAS_data::get_delta_radial_m(uint8_t nsys) const
} }
std::vector<float> Galileo_HAS_data::get_delta_along_track_m() const std::vector<float> Galileo_HAS_data::get_delta_in_track_m() const
{ {
std::vector<float> delta_along_track_m; std::vector<float> delta_in_track_m;
delta_along_track_m.reserve(this->delta_along_track.size()); delta_in_track_m.reserve(this->delta_in_track.size());
for (const auto& d : this->delta_along_track) for (const auto& d : this->delta_in_track)
{ {
delta_along_track_m.push_back(static_cast<float>(d) * HAS_MSG_DELTA_ALONG_TRACK_SCALE_FACTOR); delta_in_track_m.push_back(static_cast<float>(d) * HAS_MSG_DELTA_IN_TRACK_SCALE_FACTOR);
} }
return delta_along_track_m; return delta_in_track_m;
} }
std::vector<float> Galileo_HAS_data::get_delta_along_track_m(uint8_t nsys) const std::vector<float> Galileo_HAS_data::get_delta_in_track_m(uint8_t nsys) const
{ {
std::vector<float> delta_along_track_m = this->get_delta_along_track_m(); std::vector<float> delta_in_track_m = this->get_delta_in_track_m();
if (nsys >= this->Nsys) if (nsys >= this->Nsys)
{ {
return delta_along_track_m; return delta_in_track_m;
} }
std::vector<float> delta_along_track_m_aux; std::vector<float> delta_in_track_m_aux;
uint8_t num_sats_in_this_system = this->get_num_satellites()[nsys]; uint8_t num_sats_in_this_system = this->get_num_satellites()[nsys];
delta_along_track_m_aux.reserve(num_sats_in_this_system); delta_in_track_m_aux.reserve(num_sats_in_this_system);
size_t index = 0; size_t index = 0;
for (uint8_t sys = 0; sys <= nsys; sys++) for (uint8_t sys = 0; sys <= nsys; sys++)
@ -538,12 +538,12 @@ std::vector<float> Galileo_HAS_data::get_delta_along_track_m(uint8_t nsys) const
{ {
for (uint8_t sat = 0; sat < num_sats_in_system; sat++) for (uint8_t sat = 0; sat < num_sats_in_system; sat++)
{ {
delta_along_track_m_aux.push_back(delta_along_track_m[index]); delta_in_track_m_aux.push_back(delta_in_track_m[index]);
index++; index++;
} }
} }
} }
return delta_along_track_m_aux; return delta_in_track_m_aux;
} }
@ -551,7 +551,7 @@ std::vector<float> Galileo_HAS_data::get_delta_cross_track_m() const
{ {
std::vector<float> delta_cross_track_m; std::vector<float> delta_cross_track_m;
delta_cross_track_m.reserve(this->delta_cross_track.size()); delta_cross_track_m.reserve(this->delta_cross_track.size());
for (const auto& d : this->delta_along_track) for (const auto& d : this->delta_cross_track)
{ {
delta_cross_track_m.push_back(static_cast<float>(d) * HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR); delta_cross_track_m.push_back(static_cast<float>(d) * HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR);
} }

View File

@ -31,14 +31,14 @@ struct mt1_header
{ {
uint16_t toh; uint16_t toh;
uint8_t mask_id; uint8_t mask_id;
uint8_t iod_id; uint8_t iod_set_id;
uint8_t reserved;
bool mask_flag; bool mask_flag;
bool orbit_correction_flag; bool orbit_correction_flag;
bool clock_fullset_flag; bool clock_fullset_flag;
bool clock_subset_flag; bool clock_subset_flag;
bool code_bias_flag; bool code_bias_flag;
bool phase_bias_flag; bool phase_bias_flag;
bool ura_flag;
}; };
/*! /*!
@ -57,10 +57,10 @@ public:
std::vector<std::vector<float>> get_phase_bias_cycle() const; //!< Get Nsat x Nphases phase biases in [cycles] std::vector<std::vector<float>> get_phase_bias_cycle() const; //!< Get Nsat x Nphases phase biases in [cycles]
std::vector<float> get_delta_radial_m() const; //!< Get Nsat delta radial corrections in [m] std::vector<float> get_delta_radial_m() const; //!< Get Nsat delta radial corrections in [m]
std::vector<float> get_delta_radial_m(uint8_t nsys) const; //!< Get delta radial corrections in [m] for system nsys, with 0 <= nsys < Nsys std::vector<float> get_delta_radial_m(uint8_t nsys) const; //!< Get delta radial corrections in [m] for system nsys, with 0 <= nsys < Nsys
std::vector<float> get_delta_along_track_m() const; //!< Get Nsat delta along_track corrections in [m] std::vector<float> get_delta_in_track_m() const; //!< Get Nsat delta in-track corrections in [m]
std::vector<float> get_delta_along_track_m(uint8_t nsys) const; //!< Get alog-track corrections in [m] for system nsys, with 0 <= nsys < Nsys std::vector<float> get_delta_in_track_m(uint8_t nsys) const; //!< Get delta in-track corrections in [m] for system nsys, with 0 <= nsys < Nsys
std::vector<float> get_delta_cross_track_m() const; //!< Get Nsat delta cross_track corrections in [m] std::vector<float> get_delta_cross_track_m() const; //!< Get Nsat delta cross-track corrections in [m]
std::vector<float> get_delta_cross_track_m(uint8_t nsys) const; //!< Get delta cross_track corrections in [m] for system nsys, with 0 <= nsys < Nsys std::vector<float> get_delta_cross_track_m(uint8_t nsys) const; //!< Get delta cross-track corrections in [m] for system nsys, with 0 <= nsys < Nsys
std::vector<float> get_delta_clock_c0_m() const; //!< Get Nsat delta clock C0 corrections in [m] std::vector<float> get_delta_clock_c0_m() const; //!< Get Nsat delta clock C0 corrections in [m]
std::vector<float> get_delta_clock_c0_m(uint8_t nsys) const; //!< Get delta clock C0 corrections in [m] for system nsys, with 0 <= nsys < Nsys std::vector<float> get_delta_clock_c0_m(uint8_t nsys) const; //!< Get delta clock C0 corrections in [m] for system nsys, with 0 <= nsys < Nsys
std::vector<int> get_PRNs_in_mask(uint8_t nsys) const; //!< Get PRNs in mask for system nsys, with 0 <= nsys < Nsys std::vector<int> get_PRNs_in_mask(uint8_t nsys) const; //!< Get PRNs in mask for system nsys, with 0 <= nsys < Nsys
@ -83,19 +83,17 @@ public:
// Orbit corrections // Orbit corrections
std::vector<uint16_t> gnss_iod; std::vector<uint16_t> gnss_iod;
std::vector<int16_t> delta_radial; std::vector<int16_t> delta_radial;
std::vector<int16_t> delta_along_track; std::vector<int16_t> delta_in_track;
std::vector<int16_t> delta_cross_track; std::vector<int16_t> delta_cross_track;
// Clock full-set corrections // Clock full-set corrections
std::vector<uint8_t> delta_clock_c0_multiplier; std::vector<uint8_t> delta_clock_c0_multiplier;
std::vector<bool> iod_change_flag;
std::vector<int16_t> delta_clock_c0; std::vector<int16_t> delta_clock_c0;
// Clock subset corrections // Clock subset corrections
std::vector<uint8_t> gnss_id_clock_subset; std::vector<uint8_t> gnss_id_clock_subset;
std::vector<uint8_t> delta_clock_c0_multiplier_clock_subset; std::vector<uint8_t> delta_clock_c0_multiplier_clock_subset;
std::vector<uint64_t> satellite_submask; std::vector<uint64_t> satellite_submask;
std::vector<std::vector<bool>> iod_change_flag_clock_subset;
std::vector<std::vector<int16_t>> delta_clock_c0_clock_subset; std::vector<std::vector<int16_t>> delta_clock_c0_clock_subset;
// Code bias // Code bias
@ -105,9 +103,6 @@ public:
std::vector<std::vector<int16_t>> phase_bias; std::vector<std::vector<int16_t>> phase_bias;
std::vector<std::vector<uint8_t>> phase_discontinuity_indicator; std::vector<std::vector<uint8_t>> phase_discontinuity_indicator;
// URA
std::vector<uint8_t> ura;
mt1_header header; mt1_header header;
uint8_t has_status; uint8_t has_status;
uint8_t message_id; uint8_t message_id;
@ -119,7 +114,6 @@ public:
uint8_t Nsysprime; // in Clock subset corrections uint8_t Nsysprime; // in Clock subset corrections
uint8_t validity_interval_index_code_bias_corrections; // in Code bias uint8_t validity_interval_index_code_bias_corrections; // in Code bias
uint8_t validity_interval_index_phase_bias_corrections; // in Phase bias uint8_t validity_interval_index_phase_bias_corrections; // in Phase bias
uint8_t validity_interval_index_ura_corrections; // in URA
}; };

View File

@ -131,6 +131,7 @@ DECLARE_string(log_dir);
#include "unit-tests/system-parameters/glonass_gnav_crc_test.cc" #include "unit-tests/system-parameters/glonass_gnav_crc_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" #include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc"
#include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" #include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc"
#include "unit-tests/system-parameters/has_decoding_test.cc"
#if EXTRA_TESTS #if EXTRA_TESTS
#include "unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc" #include "unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc"

View File

@ -0,0 +1,348 @@
/*!
* \file has_decoding_test.cc
* \brief Tests for HAS message decoder
* \author Carles Fernandez-Prades, 2021. cfernandez(at)cttc.es
*
*
* -----------------------------------------------------------------------------
*
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/
#include "galileo_e6_has_msg_receiver.h"
#include "galileo_has_data.h"
#include "galileo_has_page.h"
#include "gnss_sdr_make_unique.h"
#include "has_simple_printer.h"
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#include <bitset>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <limits>
#include <sstream>
#include <string>
#include <vector>
DEFINE_string(has_data_test_file, std::string(""), "File containing encoded HAS pages (format: [time sat_id HAS_page_in_hex] in each line)");
#if PMT_USES_BOOST_ANY
namespace wht = boost;
#else
namespace wht = std;
#endif
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
class HasDecoderTester;
using HasDecoderTester_sptr = gnss_shared_ptr<HasDecoderTester>;
HasDecoderTester_sptr HasDecoderTester_make();
class HasDecoderTester : public gr::block
{
private:
friend HasDecoderTester_sptr HasDecoderTester_make();
HasDecoderTester();
public:
std::shared_ptr<Galileo_HAS_page> generate_has_page(const std::string& page);
~HasDecoderTester(); //!< Default destructor
};
HasDecoderTester_sptr HasDecoderTester_make()
{
return HasDecoderTester_sptr(new HasDecoderTester());
}
std::shared_ptr<Galileo_HAS_page> HasDecoderTester::generate_has_page(const std::string& page)
{
auto gh = std::make_shared<Galileo_HAS_page>();
std::string bits;
for (size_t i = 0; i < page.size(); i++)
{
std::string s = page.substr(i, 1);
std::stringstream ss;
ss << std::hex << s;
unsigned n;
ss >> n;
std::bitset<4> b(n);
bits += b.to_string();
}
if (page.substr(0, 6) != "AF3BC3") // if not dummy
{
gh->has_message_string = bits.substr(24, 424);
}
std::bitset<2> b_has_status(bits.substr(0, 2));
gh->has_status = b_has_status.to_ulong();
std::bitset<2> b_has_reserved(bits.substr(2, 2));
gh->reserved = b_has_reserved.to_ulong();
std::bitset<2> b_message_type(bits.substr(4, 2));
gh->message_type = b_message_type.to_ulong();
std::bitset<5> b_message_id(bits.substr(6, 5));
gh->message_id = b_message_id.to_ulong();
std::bitset<5> b_message_size(bits.substr(11, 5));
gh->message_size = b_message_size.to_ulong() + 1;
std::bitset<8> b_message_page_id(bits.substr(16, 8));
gh->message_page_id = b_message_page_id.to_ulong();
return gh;
}
HasDecoderTester::HasDecoderTester() : gr::block("HasDecoderTester", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{
}
HasDecoderTester::~HasDecoderTester() = default;
// ###########################################################
class Read_Encoded_Pages
{
public:
Read_Encoded_Pages() = default;
std::vector<std::string> get_pages() const
{
return page;
};
std::vector<std::string> get_sats() const
{
return sat;
};
std::vector<int> get_time() const
{
return rx_time;
};
size_t get_number_pages()
{
return page.size();
};
bool is_known_data()
{
return known_test_data;
};
inline bool read_data(const std::string& input_filename)
{
if (input_filename.empty())
{
page = {
"07AC6195E44FBA30126D3291D1D973CF3A2C066B77C0816068769E6232772D8086B652DEA8DFC9470B7E12891F27458B84EE1A3D391E20EE",
"07AC746F1DA0B7DE403789910C247DCC8CB7AACBA0A395086EEF44091385FF7625FF276A0DF4131195F28794D812A987C53186CE332C2417",
"07AC877DCF08B51A8CDB5B1D98790DED6E2365123139CFAD31BC6A84D1D9F0FEB70BC74064DD533D069EEF4D3850B500A7CDAAB1B8F56AA4",
"07AC9AAD3485E17627D3697D8537A1DD44BC9923088078182A808E99DE334BEEFF560152B986035325EFDC7D0A43913D926C71C3B12AB757",
"07ACAD94E50D544B7130F3840FCEFD4D2AA5A5A66876ECBFFCB0869C5127401B125F3021E70012ECECC4CF6AC1CE65737585095885067A92",
"07AC263E0B467BD3AB999E76A9A8D05B18E6B818307C81EEF6DD14722388B72D5651E78F04D1D52E131494D624518F6358B19F508F3C7950",
"07AC39CC3470C0F3EEA678A635BA8D7D3FAD16BB0879549DB6835C2DBA92D53A06C919E702C0242F523CCCD5F88FC45AF21DA0519F28E506",
"07AC4C87FB8058D90D518A035849C341E421F0DD280A77FC57FE5823B9AD68A6D8EE7D7EC0FD6208DD969F4FAC3E4D7B4214FF808E2EDC7B",
"07AC5FD3E1D40A6E958E9C139DF60252A67F6DA37B7E416557058E6D979EC4DEB9802EDE9AD49E47B522A133A05FABFAF1212BF3219AED56",
"07AC72FEB3494D685DA492DA72E415A1255BE7DC08AD4EB1617428636CC30EAAB6A9948E03ED69887717D81F2324E48D717847FF29CEE115",
"07AC8553C81674CA989EE3B762BFE9F7113F9458A5FD2749D0B685A4F49012532088C872254C881194C7641762A7B9495A02BCD6686CE17F",
"07AC987E7D3A9854AA56BCCD7170CB6939966DA4F2199A0C6C5F9CAB5B24539786CCB299DA69DE4EEE9698EEDD2D7BD409565C27674B4268",
"07ACAB286D5CA9F01FEC5F5105132F0A41EFCFB5E970C06395B3FE72C3D3B476BADF27DC9CA50ED9EC997AB8BED648DF1424EE56FFAD35B1"};
known_test_data = true;
return true;
}
known_test_data = false;
indata.open(input_filename);
if (!indata)
{ // file couldn't be opened
std::cerr << "Error: file could not be opened\n";
return false;
}
while (!indata.eof())
{
indata >> time_instant;
indata >> sat_id;
indata >> page_content;
rx_time.push_back(time_instant);
sat.push_back(sat_id);
page.push_back(page_content);
}
return true;
}
private:
std::vector<int> rx_time;
std::vector<std::string> sat;
std::vector<std::string> page;
std::ifstream indata;
std::string sat_id;
std::string page_content;
int time_instant;
bool known_test_data;
};
TEST(HAS_Test, Decoder)
{
Read_Encoded_Pages read_pages{};
EXPECT_TRUE(read_pages.read_data(FLAGS_has_data_test_file));
galileo_e6_has_msg_receiver_sptr gal_e6_has_rx_;
gal_e6_has_rx_ = galileo_e6_has_msg_receiver_make();
HasDecoderTester_sptr has_tester;
has_tester = HasDecoderTester_make();
std::unique_ptr<Has_Simple_Printer> has_simple_printer;
auto pages = read_pages.get_pages();
bool known_data = read_pages.is_known_data();
if (!known_data)
{
has_simple_printer = std::make_unique<Has_Simple_Printer>();
}
for (size_t p = 0; p < read_pages.get_number_pages(); p++)
{
auto has_page = has_tester->generate_has_page(pages[p]);
if (!has_page->has_message_string.empty()) // if not dummy
{
auto has_message = gal_e6_has_rx_->process_test_page(pmt::make_any(has_page));
if (has_message != nullptr)
{
if (known_data)
{
EXPECT_EQ(has_message->header.toh, 0);
EXPECT_EQ(has_message->header.mask_flag, true);
EXPECT_EQ(has_message->header.orbit_correction_flag, true);
EXPECT_EQ(has_message->header.clock_fullset_flag, false);
EXPECT_EQ(has_message->header.clock_subset_flag, false);
EXPECT_EQ(has_message->header.code_bias_flag, true);
EXPECT_EQ(has_message->header.phase_bias_flag, true);
EXPECT_EQ(has_message->header.reserved, 0);
EXPECT_EQ(has_message->header.mask_id, 1);
EXPECT_EQ(has_message->header.iod_set_id, 4);
EXPECT_EQ(has_message->Nsys, 2);
EXPECT_EQ(has_message->gnss_id_mask[0], 0);
std::vector<int> prns = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
EXPECT_EQ(has_message->get_PRNs_in_mask(0), prns);
EXPECT_EQ(has_message->get_signals_in_mask(0)[0], "L1 C/A");
EXPECT_EQ(has_message->cell_mask_availability_flag[0], false);
EXPECT_EQ(has_message->nav_message[0], 0);
EXPECT_EQ(has_message->gnss_id_mask[1], 2);
prns = {1, 2, 3, 4, 5, 7, 8, 9, 11, 12, 13, 15, 19, 21, 24, 25, 26, 27, 30, 31, 33, 36};
EXPECT_EQ(has_message->get_PRNs_in_mask(1), prns);
EXPECT_EQ(has_message->get_signals_in_mask(1)[0], "E1-C");
EXPECT_EQ(has_message->get_signals_in_mask(1)[1], "E5a-Q");
EXPECT_EQ(has_message->get_signals_in_mask(1)[2], "E5b-Q");
EXPECT_EQ(has_message->get_signals_in_mask(1)[3], "E6-C");
EXPECT_EQ(has_message->cell_mask_availability_flag[1], false);
EXPECT_EQ(has_message->nav_message[1], 0);
EXPECT_EQ(has_message->validity_interval_index_orbit_corrections, 10);
std::vector<uint16_t> gnss_iod_expected = {17, 92, 1, 169, 13, 15, 67, 10, 84, 108, 34, 22, 203, 75, 91, 10, 60, 42, 35, 92, 48, 74, 81, 21, 19, 6, 0, 4,
86, 22, 78, 78, 74, 78, 76, 78, 78, 78, 78, 75, 78, 76, 74, 78, 78, 78, 78, 78, 78, 78, 78, 78, 77};
std::vector<float> delta_radial_expected = {-0.355, -0.0925, -0.3, -0.8675, 0.1, 0.075, -10.24, -0.0575, 0.0725, 0.22, -0.0825, 0.03, -0.95, -0.1125,
-0.045, -0.1725, -0.975, 0.0725, -0.045, -0.13, -0.335, -0.88, -0.0375, 0.2925, 0.2375, 0.1125, -10.24, 0.13, -0.08, -0.1125, -0.115};
std::vector<float> delta_in_track_expected = {1.552, -0.544, 0.16, -0.272, 0.048, -0.784, -16.384, -0.16, -0.728, -1.528, 0.656, -0.216, -0.552, 0.984,
-0.216, -0.712, 0.184, -0.984, 0.376, 1.136, -0.072, -0.352, 0.488, -0.136, -0.456, 0.04, -16.384, 0.024, -1.616, 1.336, 0.472};
std::vector<float> delta_cross_track_expected = {0.832, 0.056, -0.024, -0.176, 0.04, -0.352, -16.384, -0.44, 0.016, 0.736, 0.104, 0.136, 0.696, 0.08,
-0.192, 0.32, -0.552, -0.304, 0.464, -0.184, 0.576, 0.864, 0.4, -0.896, -1.288, -0.808, -16.384, -0.304, 1.104, 0.576, 0.576};
EXPECT_EQ(has_message->gnss_iod, gnss_iod_expected);
EXPECT_EQ(has_message->get_delta_radial_m(0).size(), delta_radial_expected.size());
EXPECT_EQ(has_message->get_delta_in_track_m(0).size(), delta_in_track_expected.size());
EXPECT_EQ(has_message->get_delta_cross_track_m(0).size(), delta_cross_track_expected.size());
for (size_t i = 0; i < has_message->get_delta_radial_m(0).size(); i++)
{
EXPECT_FLOAT_EQ(has_message->get_delta_radial_m(0)[i], delta_radial_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_delta_in_track_m(0)[i], delta_in_track_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_delta_cross_track_m(0)[i], delta_cross_track_expected[i]);
}
delta_radial_expected = {-0.1325, -0.0025, -0.1325, 0.0675, -0.0525, -0.2675, -0.1475, 0.0475, 0.17, 0.185, -0.195, -0.01, -0.0925, -0.155, 0.0375,
0.2075, 0.08, -0.175, -0.1925, -0.0375, -0.0575, 0.0875};
delta_in_track_expected = {0.056, -0.072, 0.184, 0.064, 0.256, -0.088, 0.024, 0.344, -0.16, -0.056, 0.112, 0.176, 0.448, -0.104, 0.264, -0.072,
-0.248, -0.128, 0.456, 0.352, -0.0960, -0.1360};
delta_cross_track_expected = {0.104, 0.192, 0.312, 0.104, 0.024, 0.392, 0.352, -0.048, -0.12, -0.032, -0.152, -0.328, -0.088, 0.16, 0.464, 0.256,
-0.064, 0.104, -0.128, 0.28, -0.104, -0.288};
for (size_t i = 0; i < has_message->get_delta_radial_m(1).size(); i++)
{
EXPECT_FLOAT_EQ(has_message->get_delta_radial_m(1)[i], delta_radial_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_delta_in_track_m(1)[i], delta_in_track_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_delta_cross_track_m(1)[i], delta_cross_track_expected[i]);
}
std::vector<float> code_bias_gps_expected = {-3.76, 4.38, -2.82, -0.60, 1.28, -3.46, 1.48, -3.04, -2.04, -2.64, 1.82, 1.60, 0.36, 1.08, 2.04, 1.44,
0.42, 4.10, 1.92, 2.28, 4.86, 0.46, -2.94, -3.04, -3.76, -2.08, 2.20, 1.12, -2.58, 1.94, -2.44};
for (size_t i = 0; i < has_message->get_PRNs_in_mask(0).size(); i++)
{
EXPECT_FLOAT_EQ(has_message->get_code_bias_m()[i][0], code_bias_gps_expected[i]);
}
std::vector<float> code_bias_galileo_e1_expected = {-0.08, 0.56, -1.04, 1.04, -1.22, -1.68, 1.3, -0.54, 4.38, 3.04, -0.06, -2.14, 1.16, -0.74, 1.34,
-1.22, -2.02, -0.7, -0.58, -1.6, 1.12, -1.98};
std::vector<float> code_bias_galileo_e5a_expected = {-0.12, 0.8, -1.76, 1.80, -2.04, -2.9, 2.18, -0.94, 7.6, 5.64, -0.2, -3.7, 1.96, -1.28, 2.18,
-2.08, -3.44, -1.20, -1.04, -2.72, 1.92, -3.36};
std::vector<float> code_bias_galileo_e5b_expected = {-0.12, 0.94, -1.76, 1.78, -2.06, -2.88, 2.22, -0.92, 7.46, 5.20, -0.12, -3.64, 1.96, -1.26, 2.28,
-2.06, -3.46, -1.20, -0.98, -2.7, 1.9, -3.38};
std::vector<float> code_bias_galileo_e6c_expected = {-1.04, -0.16, -0.94, 0.96, -0.28, -1.42, -0.58, -0.86, 7.18, 5.72, -1.26, -2.48, 1.4, -2.00, 1.10,
-0.66, -2.72, -2.0, -0.22, -0.58, 0.58, -2.26};
for (size_t i = 0; i < has_message->get_PRNs_in_mask(1).size(); i++)
{
EXPECT_FLOAT_EQ(has_message->get_code_bias_m()[has_message->get_PRNs_in_mask(0).size() + i][0], code_bias_galileo_e1_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_code_bias_m()[has_message->get_PRNs_in_mask(0).size() + i][1], code_bias_galileo_e5a_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_code_bias_m()[has_message->get_PRNs_in_mask(0).size() + i][2], code_bias_galileo_e5b_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_code_bias_m()[has_message->get_PRNs_in_mask(0).size() + i][3], code_bias_galileo_e6c_expected[i]);
}
std::vector<float> phase_bias_gps_expected(has_message->get_PRNs_in_mask(0).size(), -10.24);
std::vector<float> phase_bias_galileo_e1_expected(has_message->get_PRNs_in_mask(1).size(), -10.24);
std::vector<float> phase_bias_galileo_e5a_expected(has_message->get_PRNs_in_mask(1).size(), -10.24);
std::vector<float> phase_bias_galileo_e5b_expected(has_message->get_PRNs_in_mask(1).size(), -10.24);
std::vector<float> phase_bias_galileo_e6c_expected(has_message->get_PRNs_in_mask(1).size(), -10.24);
std::vector<uint8_t> phase_discontinuity_indicator_expected_gps(has_message->get_PRNs_in_mask(0).size(), 0);
std::vector<uint8_t> phase_discontinuity_indicator_expected_gal(has_message->get_PRNs_in_mask(1).size(), 0);
for (size_t i = 0; i < has_message->get_PRNs_in_mask(0).size(); i++)
{
EXPECT_FLOAT_EQ(has_message->get_phase_bias_cycle()[i][0], phase_bias_gps_expected[i]);
EXPECT_EQ(has_message->phase_discontinuity_indicator[i][0], phase_discontinuity_indicator_expected_gps[i]);
}
for (size_t i = 0; i < has_message->get_PRNs_in_mask(1).size(); i++)
{
EXPECT_FLOAT_EQ(has_message->get_phase_bias_cycle()[has_message->get_PRNs_in_mask(0).size() + i][0], phase_bias_galileo_e1_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_phase_bias_cycle()[has_message->get_PRNs_in_mask(0).size() + i][1], phase_bias_galileo_e5a_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_phase_bias_cycle()[has_message->get_PRNs_in_mask(0).size() + i][2], phase_bias_galileo_e5b_expected[i]);
EXPECT_FLOAT_EQ(has_message->get_phase_bias_cycle()[has_message->get_PRNs_in_mask(0).size() + i][3], phase_bias_galileo_e6c_expected[i]);
EXPECT_EQ(has_message->phase_discontinuity_indicator[has_message->get_PRNs_in_mask(0).size() + i][0], phase_discontinuity_indicator_expected_gal[i]);
EXPECT_EQ(has_message->phase_discontinuity_indicator[has_message->get_PRNs_in_mask(0).size() + i][1], phase_discontinuity_indicator_expected_gal[i]);
EXPECT_EQ(has_message->phase_discontinuity_indicator[has_message->get_PRNs_in_mask(0).size() + i][2], phase_discontinuity_indicator_expected_gal[i]);
EXPECT_EQ(has_message->phase_discontinuity_indicator[has_message->get_PRNs_in_mask(0).size() + i][3], phase_discontinuity_indicator_expected_gal[i]);
}
}
else
{
has_simple_printer->print_message(has_message.get());
}
}
}
}
}