From 526d414789485e1081681bd3b1ce2a383dde68b7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 11 Nov 2023 00:14:32 +0100 Subject: [PATCH 1/6] Update local version of matio to 1.5.25 and Protocol Buffers to 25.0 --- CMakeLists.txt | 4 ++-- cmake/Modules/BuildProtobuf.cmake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86373d868..f7af13ad1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,8 +338,8 @@ set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.6.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.24") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "24.4") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.25") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") diff --git a/cmake/Modules/BuildProtobuf.cmake b/cmake/Modules/BuildProtobuf.cmake index 48418d608..5590943db 100644 --- a/cmake/Modules/BuildProtobuf.cmake +++ b/cmake/Modules/BuildProtobuf.cmake @@ -13,7 +13,7 @@ if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION) - set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "24.4") + set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") endif() if(NOT GNSSSDR_BINARY_DIR) From 8f13192aa6d7d8dbf5dbc80030ba17cab2916cd8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 13 Nov 2023 08:04:42 +0100 Subject: [PATCH 2/6] Update local version of matio to 1.5.26 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7af13ad1..5a297f0ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,7 +338,7 @@ set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.6.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.25") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.26") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0") From 7132ee720ad727f9a7db09048803f6f59a85d729 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 14 Nov 2023 13:42:44 +0100 Subject: [PATCH 3/6] Remove useless casts --- src/algorithms/PVT/libs/an_packet_printer.cc | 16 +++++----- src/algorithms/PVT/libs/rtcm.cc | 16 +++++----- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 20 ++++++------- .../gnuradio_blocks/pcps_acquisition.cc | 2 +- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 6 ++-- .../adapters/file_source_base.cc | 2 +- .../four_bit_cpx_file_signal_source.cc | 2 +- .../adapters/nsr_file_signal_source.cc | 2 +- .../two_bit_cpx_file_signal_source.cc | 2 +- .../two_bit_packed_file_signal_source.cc | 2 +- .../adapters/zmq_signal_source.cc | 2 +- .../galileo_telemetry_decoder_gs.cc | 22 +++++++------- .../tracking/libs/tracking_discriminators.cc | 4 +-- .../beidou_dnav_navigation_message.cc | 2 +- .../system_parameters/galileo_fnav_message.cc | 2 +- .../system_parameters/galileo_inav_message.cc | 14 ++++----- .../glonass_gnav_navigation_message.cc | 30 +++++++++---------- .../gps_cnav_navigation_message.cc | 6 ++-- 18 files changed, 76 insertions(+), 76 deletions(-) diff --git a/src/algorithms/PVT/libs/an_packet_printer.cc b/src/algorithms/PVT/libs/an_packet_printer.cc index 72e7e8a9f..6618d6982 100644 --- a/src/algorithms/PVT/libs/an_packet_printer.cc +++ b/src/algorithms/PVT/libs/an_packet_printer.cc @@ -171,9 +171,9 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const _packet->gps_satellites = num_gps_sats; _packet->galileo_satellites = num_gal_sats; _packet->microseconds = static_cast(elapsed_seconds.count() * 1.0e6); - _packet->latitude = static_cast(pvt->get_latitude()) * (M_PI / 180.0); - _packet->longitude = static_cast(pvt->get_longitude()) * (M_PI / 180.0); - _packet->height = static_cast(pvt->get_height()); + _packet->latitude = pvt->get_latitude() * (M_PI / 180.0); + _packet->longitude = pvt->get_longitude() * (M_PI / 180.0); + _packet->height = pvt->get_height(); _packet->velocity[0] = static_cast(pvt->get_rx_vel()[1]); _packet->velocity[1] = static_cast(pvt->get_rx_vel()[0]); _packet->velocity[2] = static_cast(-pvt->get_rx_vel()[2]); @@ -196,11 +196,11 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packet, an_packet_t* _packet) const { uint8_t offset = 0; - LSB_bytes_to_array(reinterpret_cast(&sdr_gnss_packet->nsvfix), offset, _packet->data, sizeof(sdr_gnss_packet->nsvfix)); + LSB_bytes_to_array(&sdr_gnss_packet->nsvfix, offset, _packet->data, sizeof(sdr_gnss_packet->nsvfix)); offset += sizeof(sdr_gnss_packet->nsvfix); - LSB_bytes_to_array(reinterpret_cast(&sdr_gnss_packet->gps_satellites), offset, _packet->data, sizeof(sdr_gnss_packet->gps_satellites)); + LSB_bytes_to_array(&sdr_gnss_packet->gps_satellites, offset, _packet->data, sizeof(sdr_gnss_packet->gps_satellites)); offset += sizeof(sdr_gnss_packet->gps_satellites); - LSB_bytes_to_array(reinterpret_cast(&sdr_gnss_packet->galileo_satellites), offset, _packet->data, sizeof(sdr_gnss_packet->galileo_satellites)); + LSB_bytes_to_array(&sdr_gnss_packet->galileo_satellites, offset, _packet->data, sizeof(sdr_gnss_packet->galileo_satellites)); offset += sizeof(sdr_gnss_packet->galileo_satellites); LSB_bytes_to_array(reinterpret_cast(&sdr_gnss_packet->microseconds), offset, _packet->data, sizeof(sdr_gnss_packet->microseconds)); offset += sizeof(sdr_gnss_packet->microseconds); @@ -218,9 +218,9 @@ void An_Packet_Printer::encode_sdr_gnss_packet(sdr_gnss_packet_t* sdr_gnss_packe offset += sizeof(sdr_gnss_packet->velocity[2]); for (auto& sat : sdr_gnss_packet->sats) { - LSB_bytes_to_array(reinterpret_cast(&sat.prn), offset, _packet->data, sizeof(sat.prn)); + LSB_bytes_to_array(&sat.prn, offset, _packet->data, sizeof(sat.prn)); offset += sizeof(sat.prn); - LSB_bytes_to_array(reinterpret_cast(&sat.snr), offset, _packet->data, sizeof(sat.snr)); + LSB_bytes_to_array(&sat.snr, offset, _packet->data, sizeof(sat.snr)); offset += sizeof(sat.snr); LSB_bytes_to_array(reinterpret_cast(&sat.doppler), offset, _packet->data, sizeof(sat.doppler)); offset += sizeof(sat.doppler); diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 7f962d4f7..5854b4eb8 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -929,7 +929,7 @@ int32_t Rtcm::read_MT1005(const std::string& message, uint32_t& ref_id, double& const uint32_t reserved_field_length = 6; uint32_t index = preamble_length + reserved_field_length; - uint32_t read_message_length = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 10))); + uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10)); index += 10; if (read_message_length != 19) { @@ -1601,7 +1601,7 @@ int32_t Rtcm::read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) co const uint32_t reserved_field_length = 6; uint32_t index = preamble_length + reserved_field_length; - const uint32_t read_message_length = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 10))); + const uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10)); index += 10; if (read_message_length != 61) @@ -1621,7 +1621,7 @@ int32_t Rtcm::read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph) co } // Fill Gps Ephemeris with message data content - gps_eph.PRN = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 6))); + gps_eph.PRN = Rtcm::bin_to_uint(message_bin.substr(index, 6)); index += 6; gps_eph.WN = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 10))); @@ -1835,7 +1835,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl const uint32_t reserved_field_length = 6; uint32_t index = preamble_length + reserved_field_length; - const uint32_t read_message_length = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 10))); + const uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10)); index += 10; if (read_message_length != 45) // 360 bits = 45 bytes @@ -1855,7 +1855,7 @@ int32_t Rtcm::read_MT1020(const std::string& message, Glonass_Gnav_Ephemeris& gl } // Fill Gps Ephemeris with message data content - glonass_gnav_eph.i_satellite_slot_number = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 6))); + glonass_gnav_eph.i_satellite_slot_number = Rtcm::bin_to_uint(message_bin.substr(index, 6)); index += 6; glonass_gnav_eph.i_satellite_freq_channel = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 5)) - 7.0); @@ -2138,7 +2138,7 @@ int32_t Rtcm::read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph const uint32_t reserved_field_length = 6; uint32_t index = preamble_length + reserved_field_length; - const uint32_t read_message_length = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 10))); + const uint32_t read_message_length = Rtcm::bin_to_uint(message_bin.substr(index, 10)); index += 10; if (read_message_length != 62) @@ -2158,7 +2158,7 @@ int32_t Rtcm::read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph } // Fill Galileo Ephemeris with message data content - gal_eph.PRN = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 6))); + gal_eph.PRN = Rtcm::bin_to_uint(message_bin.substr(index, 6)); index += 6; gal_eph.WN = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 12))); @@ -2233,7 +2233,7 @@ int32_t Rtcm::read_MT1045(const std::string& message, Galileo_Ephemeris& gal_eph gal_eph.BGD_E1E5a = static_cast(Rtcm::bin_to_int(message_bin.substr(index, 10))); index += 10; - gal_eph.E5a_HS = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 2))); + gal_eph.E5a_HS = Rtcm::bin_to_uint(message_bin.substr(index, 2)); index += 2; gal_eph.E5a_DVS = static_cast(Rtcm::bin_to_uint(message_bin.substr(index, 1))); diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 69430cca8..1e0f945b5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -613,15 +613,15 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items { d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast((doppler_index - i))); } - d_CAF_vector[doppler_index] /= static_cast(1.0F + static_cast(CAF_bins_half + doppler_index) - weighting_factor * static_cast(CAF_bins_half) * ((static_cast(CAF_bins_half) + 1.0F) / 2.0F) - weighting_factor * static_cast(doppler_index) * (static_cast(doppler_index) + 1.0F) / 2.0F); // triangles = [n*(n+1)/2] + d_CAF_vector[doppler_index] /= 1.0F + static_cast(CAF_bins_half + doppler_index) - weighting_factor * static_cast(CAF_bins_half) * ((static_cast(CAF_bins_half) + 1.0F) / 2.0F) - weighting_factor * static_cast(doppler_index) * (static_cast(doppler_index) + 1.0F) / 2.0F; // triangles = [n*(n+1)/2] if (d_both_signal_components) { accum[0] = 0; for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++) { - accum[0] += static_cast(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast(abs(doppler_index - i)))); + accum[0] += d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast(abs(doppler_index - i))); } - accum[0] /= static_cast(1.0F + static_cast(CAF_bins_half + doppler_index) - weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1) / 2.0F - weighting_factor * static_cast(doppler_index) * static_cast(doppler_index + 1) / 2.0F); // triangles = [n*(n+1)/2] + accum[0] /= 1.0F + static_cast(CAF_bins_half + doppler_index) - weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1) / 2.0F - weighting_factor * static_cast(doppler_index) * static_cast(doppler_index + 1) / 2.0F; // triangles = [n*(n+1)/2] d_CAF_vector[doppler_index] += accum[0]; } } @@ -629,19 +629,19 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items for (int doppler_index = CAF_bins_half; doppler_index < d_num_doppler_bins - CAF_bins_half; doppler_index++) { d_CAF_vector[doppler_index] = 0; - for (int i = doppler_index - CAF_bins_half; i < static_cast(doppler_index + CAF_bins_half + 1); i++) + for (int i = doppler_index - CAF_bins_half; i < doppler_index + CAF_bins_half + 1; i++) { d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast((doppler_index - i))); } - d_CAF_vector[doppler_index] /= static_cast(1.0F + 2.0F * static_cast(CAF_bins_half) - 2.0F * weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1) / 2.0F); + d_CAF_vector[doppler_index] /= 1.0F + 2.0F * static_cast(CAF_bins_half) - 2.0F * weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1) / 2.0F; if (d_both_signal_components) { accum[0] = 0; - for (int i = doppler_index - CAF_bins_half; i < static_cast(doppler_index + CAF_bins_half + 1); i++) + for (int i = doppler_index - CAF_bins_half; i < doppler_index + CAF_bins_half + 1; i++) { - accum[0] += static_cast(d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast((doppler_index - i)))); + accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast((doppler_index - i))); } - accum[0] /= static_cast(1.0F + 2.0F * static_cast(CAF_bins_half) - 2.0F * weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1) / 2.0F); + accum[0] /= 1.0F + 2.0F * static_cast(CAF_bins_half) - 2.0F * weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1) / 2.0F; d_CAF_vector[doppler_index] += accum[0]; } } @@ -653,13 +653,13 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items { d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1.0F - weighting_factor * static_cast(abs(doppler_index - i))); } - d_CAF_vector[doppler_index] /= static_cast(1.0F + static_cast(CAF_bins_half) + static_cast(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast(CAF_bins_half) * (static_cast(CAF_bins_half) + 1.0F) / 2.0F - weighting_factor * static_cast(d_num_doppler_bins - doppler_index - 1) * static_cast(d_num_doppler_bins - doppler_index) / 2.0F); + d_CAF_vector[doppler_index] /= 1.0F + static_cast(CAF_bins_half) + static_cast(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast(CAF_bins_half) * (static_cast(CAF_bins_half) + 1.0F) / 2.0F - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * static_cast(d_num_doppler_bins - doppler_index) / 2.0F; if (d_both_signal_components) { accum[0] = 0; for (int i = doppler_index - CAF_bins_half; i < static_cast(d_num_doppler_bins); i++) { - accum[0] += static_cast(d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast(abs(doppler_index - i)))); + accum[0] += d_CAF_vector_Q[i] * (1.0F - weighting_factor * static_cast(abs(doppler_index - i))); } accum[0] /= static_cast(1.0F + static_cast(CAF_bins_half) + static_cast(d_num_doppler_bins - doppler_index - 1) - weighting_factor * static_cast(CAF_bins_half) * static_cast(CAF_bins_half + 1.0) / 2.0 - weighting_factor * static_cast(d_num_doppler_bins - doppler_index - 1) * static_cast(d_num_doppler_bins - doppler_index) / 2.0); d_CAF_vector[doppler_index] += accum[0]; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index ffafd28bf..4ac0fd221 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -258,7 +258,7 @@ void pcps_acquisition::init() d_mag = 0.0; d_input_power = 0.0; - d_num_doppler_bins = static_cast(std::ceil(static_cast(static_cast(d_acq_parameters.doppler_max) - static_cast(-d_acq_parameters.doppler_max)) / static_cast(d_doppler_step))); + d_num_doppler_bins = static_cast(std::ceil(static_cast(2 * d_acq_parameters.doppler_max) / static_cast(d_doppler_step))); // Create the carrier Doppler wipeoff signals if (d_grid_doppler_wipeoffs.empty()) diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index e21af5d08..9d194f7aa 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1584,11 +1584,11 @@ void time2epoch(gtime_t t, double *ep) break; } } - ep[0] = 1970 + static_cast(days / 1461) * 4 + static_cast(mon / 12); + ep[0] = 1970 + days / 1461 * 4 + mon / 12; ep[1] = mon % 12 + 1; ep[2] = day + 1; - ep[3] = static_cast(sec / 3600); - ep[4] = static_cast(sec % 3600 / 60); + ep[3] = sec / 3600; + ep[4] = sec % 3600 / 60; ep[5] = sec % 60 + t.sec; } diff --git a/src/algorithms/signal_source/adapters/file_source_base.cc b/src/algorithms/signal_source/adapters/file_source_base.cc index 55da2791c..974d4acac 100644 --- a/src/algorithms/signal_source/adapters/file_source_base.cc +++ b/src/algorithms/signal_source/adapters/file_source_base.cc @@ -383,7 +383,7 @@ size_t FileSourceBase::samplesToSkip() const size_t FileSourceBase::computeSamplesInFile() const { - auto n_samples = static_cast(samples()); + auto n_samples = samples(); // this could throw, but the existence of the file has been proven before we get here. const auto size = fs::file_size(filename()); diff --git a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc index cdc1dfc8b..7052f0a4c 100644 --- a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc @@ -69,7 +69,7 @@ FourBitCpxFileSignalSource::FourBitCpxFileSignalSource( std::tuple FourBitCpxFileSignalSource::itemTypeToSize() { auto is_complex = false; - auto item_size = size_t(sizeof(char)); // default + auto item_size = sizeof(char); // default if (item_type() == "byte") { diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index c2463fc54..c86c11e76 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -40,7 +40,7 @@ NsrFileSignalSource::NsrFileSignalSource(const ConfigurationInterface* configura std::tuple NsrFileSignalSource::itemTypeToSize() { auto is_complex = false; - auto item_size = size_t(sizeof(char)); // default + auto item_size = sizeof(char); // default if (item_type() == "byte") { diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc index 7bf1cb831..1350bded2 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc @@ -43,7 +43,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource( std::tuple TwoBitCpxFileSignalSource::itemTypeToSize() { auto is_complex = false; - auto item_size = size_t(sizeof(char)); // default + auto item_size = sizeof(char); // default if (item_type() == "byte") { diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc index ebcb95d96..57e6e7768 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc @@ -49,7 +49,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource( std::tuple TwoBitPackedFileSignalSource::itemTypeToSize() { auto is_complex_t = false; - auto item_size = size_t(sizeof(char)); // default + auto item_size = sizeof(char); // default if (item_type() == "byte") { diff --git a/src/algorithms/signal_source/adapters/zmq_signal_source.cc b/src/algorithms/signal_source/adapters/zmq_signal_source.cc index bc8616ccd..caa4a9b9c 100644 --- a/src/algorithms/signal_source/adapters/zmq_signal_source.cc +++ b/src/algorithms/signal_source/adapters/zmq_signal_source.cc @@ -43,7 +43,7 @@ ZmqSignalSource::ZmqSignalSource(const ConfigurationInterface* configuration, { LOG(INFO) << "Connecting to ZMQ pub at " << endpoint; // work around gnuradio interface const-deficiency - d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, const_cast(endpoint.data()), timeout_ms, pass_tags, hwm); + d_source_block = gr::zeromq::sub_source::make(d_item_size, vlen, endpoint.data(), timeout_ms, pass_tags, hwm); // work around another bug. GNU Radio passes tags through the ZMQ block // unconditionally if pass_tags is true, but that flag controls protocol more diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index 227bf8e05..e597555aa 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -1100,7 +1100,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { // 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(d_inav_nav.get_TOW5() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); + d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms; d_inav_nav.set_TOW5_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1111,7 +1111,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // timetag debug if (d_valid_timetag == true) { - int decoder_delay_ms = static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); + int decoder_delay_ms = GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms; int rx_tow_at_preamble = d_current_timetag.tow_ms - decoder_delay_ms; if (rx_tow_at_preamble < 0) { @@ -1126,7 +1126,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { // 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(d_inav_nav.get_TOW6() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); + d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms; d_inav_nav.set_TOW6_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1137,7 +1137,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // timetag debug if (d_valid_timetag == true) { - int decoder_delay_ms = static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); + int decoder_delay_ms = GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms; int rx_tow_at_preamble = d_current_timetag.tow_ms - decoder_delay_ms; if (rx_tow_at_preamble < 0) { @@ -1151,7 +1151,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { // TOW_0 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(d_inav_nav.get_TOW0() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); + d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms; d_inav_nav.set_TOW0_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1162,7 +1162,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( // timetag debug if (d_valid_timetag == true) { - int decoder_delay_ms = static_cast(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms); + int decoder_delay_ms = GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms; int rx_tow_at_preamble = d_current_timetag.tow_ms - decoder_delay_ms; if (rx_tow_at_preamble < 0) { @@ -1195,7 +1195,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( if (d_fnav_nav.is_TOW1_set() == true) { d_TOW_at_Preamble_ms = static_cast(d_fnav_nav.get_TOW1() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast((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 + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS; d_fnav_nav.set_TOW1_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1207,7 +1207,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( else if (d_fnav_nav.is_TOW2_set() == true) { d_TOW_at_Preamble_ms = static_cast(d_fnav_nav.get_TOW2() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast((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 + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS; d_fnav_nav.set_TOW2_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1219,7 +1219,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( else if (d_fnav_nav.is_TOW3_set() == true) { d_TOW_at_Preamble_ms = static_cast(d_fnav_nav.get_TOW3() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast((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 + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS; d_fnav_nav.set_TOW3_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1231,7 +1231,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( else if (d_fnav_nav.is_TOW4_set() == true) { d_TOW_at_Preamble_ms = static_cast(d_fnav_nav.get_TOW4() * 1000.0); - d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast((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 + (d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS; d_fnav_nav.set_TOW4_flag(false); if (d_there_are_e6_channels && !d_valid_timetag) { @@ -1262,7 +1262,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( int rx_tow_at_preamble = d_current_timetag.tow_ms; uint32_t predicted_tow_at_preamble_ms = 1000 * (rx_tow_at_preamble / 1000); // floor to integer number of seconds d_TOW_at_Preamble_ms = predicted_tow_at_preamble_ms; - d_TOW_at_current_symbol_ms = predicted_tow_at_preamble_ms + static_cast((d_required_symbols + 1) * d_PRN_code_period_ms); + d_TOW_at_current_symbol_ms = predicted_tow_at_preamble_ms + (d_required_symbols + 1) * d_PRN_code_period_ms; if (d_E6_TOW_set == false) { std::cout << " Sat PRN " << d_satellite.get_PRN() << " E6 TimeTag TOW at preamble: " << predicted_tow_at_preamble_ms diff --git a/src/algorithms/tracking/libs/tracking_discriminators.cc b/src/algorithms/tracking/libs/tracking_discriminators.cc index cc9a38c98..a596376a6 100644 --- a/src/algorithms/tracking/libs/tracking_discriminators.cc +++ b/src/algorithms/tracking/libs/tracking_discriminators.cc @@ -54,7 +54,7 @@ double fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2, double { const float dot = prompt_s1.real() * prompt_s2.real() + prompt_s1.imag() * prompt_s2.imag(); const float cross = prompt_s1.real() * prompt_s2.imag() - prompt_s2.real() * prompt_s1.imag(); - return static_cast(gr::fast_atan2f(cross, dot) / (t2 - t1)); + return gr::fast_atan2f(cross, dot) / (t2 - t1); } @@ -85,7 +85,7 @@ double fll_diff_atan(gr_complex prompt_s1, gr_complex prompt_s2, double t1, doub */ double pll_four_quadrant_atan(gr_complex prompt_s1) { - return static_cast(gr::fast_atan2f(prompt_s1.imag(), prompt_s1.real())); + return gr::fast_atan2f(prompt_s1.imag(), prompt_s1.real()); } diff --git a/src/core/system_parameters/beidou_dnav_navigation_message.cc b/src/core/system_parameters/beidou_dnav_navigation_message.cc index 78e9570dc..f1a0fc1b1 100644 --- a/src/core/system_parameters/beidou_dnav_navigation_message.cc +++ b/src/core/system_parameters/beidou_dnav_navigation_message.cc @@ -492,7 +492,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_eccentricity_msb = static_cast(read_navigation_unsigned(subframe_bits, D2_E_MSB)); d_eccentricity_msb_bits = (read_navigation_unsigned(subframe_bits, D2_E_MSB)); // Adjust for lsb in next page (shift number of lsb to the left) - d_eccentricity_msb = static_cast((static_cast(d_eccentricity_msb) << 22U)); + d_eccentricity_msb = static_cast(d_eccentricity_msb) << 22U; d_eccentricity_msb_bits = d_eccentricity_msb_bits << 22U; // Set system flags for message reception diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index e4fe4a50a..1d313ceed 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -60,7 +60,7 @@ bool Galileo_Fnav_Message::CRC_test(const std::bitset frame_bits(std::string(bits.to_string())); + boost::dynamic_bitset frame_bits(bits.to_string()); std::vector bytes; boost::to_block_range(frame_bits, std::back_inserter(bytes)); diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 3c946b487..850f2ffb9 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -54,7 +54,7 @@ bool Galileo_Inav_Message::CRC_test(const std::bitset& // using boost::dynamic_bitset. // ToDo: Use boost::dynamic_bitset for all the bitset operations in this class - boost::dynamic_bitset frame_bits(std::string(bits.to_string())); + boost::dynamic_bitset frame_bits(bits.to_string()); std::vector bytes; boost::to_block_range(frame_bits, std::back_inserter(bytes)); @@ -162,7 +162,7 @@ int64_t Galileo_Inav_Message::read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const { bool value; - if (static_cast(static_cast(bits[GALILEO_DATA_JK_BITS - parameter[0].first])) == 1) + if (static_cast(bits[GALILEO_DATA_JK_BITS - parameter[0].first]) == 1) { value = true; } @@ -989,15 +989,15 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) ai2_5 = ai2_5 * AI2_5_LSB; DLOG(INFO) << "ai2_5= " << ai2_5; // Ionospheric disturbance flag - Region1_flag_5 = static_cast(read_navigation_bool(data_jk_bits, REGION1_5_BIT)); + Region1_flag_5 = read_navigation_bool(data_jk_bits, REGION1_5_BIT); DLOG(INFO) << "Region1_flag_5= " << Region1_flag_5; - Region2_flag_5 = static_cast(read_navigation_bool(data_jk_bits, REGION2_5_BIT)); + Region2_flag_5 = read_navigation_bool(data_jk_bits, REGION2_5_BIT); DLOG(INFO) << "Region2_flag_5= " << Region2_flag_5; - Region3_flag_5 = static_cast(read_navigation_bool(data_jk_bits, REGION3_5_BIT)); + Region3_flag_5 = read_navigation_bool(data_jk_bits, REGION3_5_BIT); DLOG(INFO) << "Region3_flag_5= " << Region3_flag_5; - Region4_flag_5 = static_cast(read_navigation_bool(data_jk_bits, REGION4_5_BIT)); + Region4_flag_5 = read_navigation_bool(data_jk_bits, REGION4_5_BIT); DLOG(INFO) << "Region4_flag_5= " << Region4_flag_5; - Region5_flag_5 = static_cast(read_navigation_bool(data_jk_bits, REGION5_5_BIT)); + Region5_flag_5 = read_navigation_bool(data_jk_bits, REGION5_5_BIT); DLOG(INFO) << "Region5_flag_5= " << Region5_flag_5; BGD_E1E5a_5 = static_cast(read_navigation_signed(data_jk_bits, BGD_E1_E5A_5_BIT)); BGD_E1E5a_5 = BGD_E1E5a_5 * BGD_E1_E5A_5_LSB; diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 94ddd9073..586f795b2 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -292,7 +292,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame if (flag_ephemeris_str_1 == true) { gnav_ephemeris.d_B_n = static_cast(read_navigation_unsigned(string_bits, B_N)); - gnav_ephemeris.d_P_2 = static_cast(read_navigation_bool(string_bits, P2)); + gnav_ephemeris.d_P_2 = read_navigation_bool(string_bits, P2); gnav_ephemeris.d_t_b = static_cast(read_navigation_unsigned(string_bits, T_B)) * 15 * 60; gnav_ephemeris.d_VYn = static_cast(read_navigation_signed(string_bits, Y_N_DOT)) * TWO_N20; gnav_ephemeris.d_AYn = static_cast(read_navigation_signed(string_bits, Y_N_DOT_DOT)) * TWO_N30; @@ -308,10 +308,10 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame // --- It is string 3 ---------------------------------------------- if (flag_ephemeris_str_2 == true) { - gnav_ephemeris.d_P_3 = static_cast(read_navigation_bool(string_bits, P3)); + gnav_ephemeris.d_P_3 = read_navigation_bool(string_bits, P3); gnav_ephemeris.d_gamma_n = static_cast(read_navigation_signed(string_bits, GAMMA_N)) * TWO_N40; gnav_ephemeris.d_P = static_cast(read_navigation_unsigned(string_bits, P)); - gnav_ephemeris.d_l3rd_n = static_cast(read_navigation_bool(string_bits, EPH_L_N)); + gnav_ephemeris.d_l3rd_n = read_navigation_bool(string_bits, EPH_L_N); gnav_ephemeris.d_VZn = static_cast(read_navigation_signed(string_bits, Z_N_DOT)) * TWO_N20; gnav_ephemeris.d_AZn = static_cast(read_navigation_signed(string_bits, Z_N_DOT_DOT)) * TWO_N30; gnav_ephemeris.d_Zn = static_cast(read_navigation_signed(string_bits, Z_N)) * TWO_N11; @@ -328,7 +328,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_ephemeris.d_tau_n = static_cast(read_navigation_signed(string_bits, TAU_N)) * TWO_N30; gnav_ephemeris.d_Delta_tau_n = static_cast(read_navigation_signed(string_bits, DELTA_TAU_N)) * TWO_N30; gnav_ephemeris.d_E_n = static_cast(read_navigation_unsigned(string_bits, E_N)); - gnav_ephemeris.d_P_4 = static_cast(read_navigation_bool(string_bits, P4)); + gnav_ephemeris.d_P_4 = read_navigation_bool(string_bits, P4); gnav_ephemeris.d_F_T = static_cast(read_navigation_unsigned(string_bits, F_T)); gnav_ephemeris.d_N_T = static_cast(read_navigation_unsigned(string_bits, N_T)); gnav_ephemeris.d_n = static_cast(read_navigation_unsigned(string_bits, N)); @@ -352,7 +352,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_utc_model.d_tau_c = static_cast(read_navigation_signed(string_bits, TAU_C)) * TWO_N31; gnav_utc_model.d_N_4 = static_cast(read_navigation_unsigned(string_bits, N_4)); gnav_utc_model.d_tau_gps = static_cast(read_navigation_signed(string_bits, TAU_GPS)) * TWO_N30; - gnav_ephemeris.d_l5th_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); + gnav_ephemeris.d_l5th_n = read_navigation_bool(string_bits, ALM_L_N); flag_utc_model_str_5 = true; @@ -402,7 +402,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame return 0; } - gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -423,7 +423,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)); - gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N); // Set satellite information for redundancy purposes if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24) @@ -452,7 +452,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame return 0; } - gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -473,7 +473,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)); - gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N); // Set satellite information for redundancy purposes if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24) @@ -497,7 +497,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame return 0; } - gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -518,7 +518,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)); - gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N); // Set satellite information for redundancy purposes if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24) @@ -541,7 +541,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame { return 0; } - gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -562,7 +562,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)); - gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N); // Set satellite information for redundancy purposes if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24) @@ -592,7 +592,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame { return 0; } - gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = static_cast(read_navigation_bool(string_bits, C_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_C_n = read_navigation_bool(string_bits, C_N); gnav_almanac[i_alm_satellite_slot_number - 1].d_M_n_A = static_cast(read_navigation_unsigned(string_bits, M_N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_n_A = static_cast(read_navigation_unsigned(string_bits, N_A)); gnav_almanac[i_alm_satellite_slot_number - 1].d_tau_n_A = static_cast(read_navigation_unsigned(string_bits, TAU_N_A)) * TWO_N18; @@ -613,7 +613,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A = static_cast(read_navigation_signed(string_bits, DELTA_T_N_A)) * TWO_N9; gnav_almanac[i_alm_satellite_slot_number - 1].d_Delta_T_n_A_dot = static_cast(read_navigation_signed(string_bits, DELTA_T_DOT_N_A)) * TWO_N14; gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A = static_cast(read_navigation_unsigned(string_bits, H_N_A)); - gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = static_cast(read_navigation_bool(string_bits, ALM_L_N)); + gnav_almanac[i_alm_satellite_slot_number - 1].d_l_n = read_navigation_bool(string_bits, ALM_L_N); // Set satellite information for redundancy purposes if (gnav_almanac[i_alm_satellite_slot_number - 1].d_H_n_A > 24) diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index 62268fb18..a644f7f2a 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -113,7 +113,7 @@ void Gps_CNAV_Navigation_Message::decode_page(const std::bitset(read_navigation_bool(data_bits, CNAV_ALERT_FLAG)); + alert_flag = read_navigation_bool(data_bits, CNAV_ALERT_FLAG); ephemeris_record.alert_flag = alert_flag; page_type = static_cast(read_navigation_unsigned(data_bits, CNAV_MSG_TYPE)); @@ -145,8 +145,8 @@ void Gps_CNAV_Navigation_Message::decode_page(const std::bitset(read_navigation_signed(data_bits, CNAV_OMEGA)); ephemeris_record.omega *= CNAV_OMEGA_LSB; - ephemeris_record.integrity_status_flag = static_cast(read_navigation_bool(data_bits, CNAV_INTEGRITY_FLAG)); - ephemeris_record.l2c_phasing_flag = static_cast(read_navigation_bool(data_bits, CNAV_L2_PHASING_FLAG)); + ephemeris_record.integrity_status_flag = read_navigation_bool(data_bits, CNAV_INTEGRITY_FLAG); + ephemeris_record.l2c_phasing_flag = read_navigation_bool(data_bits, CNAV_L2_PHASING_FLAG); b_flag_ephemeris_1 = true; break; From f739eb698c740d55154fd3c7cbf1faa156b0abec Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 14 Nov 2023 13:44:41 +0100 Subject: [PATCH 4/6] Reset color when printing GPS CNAV messages in the terminal --- .../gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc index 2c0ab7083..f8ad72108 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc @@ -264,7 +264,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << current_synchro_data.CN0_dB_hz - << std::setprecision(default_precision) << " dB-Hz" << std::endl; + << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; } if (d_CNAV_Message.have_new_iono() == true) { From 7cfdcd3ae150998ce4c0930cbead014e333137a4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 14 Nov 2023 14:29:41 +0100 Subject: [PATCH 5/6] Fix compiler warning, avoid using std::strncat --- src/algorithms/PVT/libs/rtcm.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 2fe68299c..338c36a8d 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -587,16 +587,24 @@ private: inline bool decode_header() { - char header[header_length + 1] = ""; - std::strncat(header, data_.data(), header_length); + std::string header(data_.data(), header_length); if (header[0] != 'G' || header[1] != 'S') { return false; } - char header2_[header_length - 1] = ""; - std::strncat(header2_, data_.data() + 2, header_length - 2); - body_length_ = std::atoi(header2_); + auto header2 = header.substr(2); + try + { + body_length_ = std::stoi(header2); + } + catch (const std::exception& e) + { + // invalid stoi conversion + body_length_ = 0; + return false; + } + if (body_length_ == 0) { return false; @@ -612,11 +620,11 @@ private: inline void encode_header() { - char header[header_length + 1] = ""; std::stringstream ss; ss << "GS" << std::setw(4) << std::max(std::min(static_cast(body_length_), static_cast(max_body_length)), 0); - std::copy_n(ss.str().c_str(), header_length + 1, header); - std::copy_n(header, header_length, data_.data()); + std::string header = ss.str(); + header.resize(header_length, ' '); + std::copy(header.begin(), header.end(), data_.begin()); } private: From ce14845bbb73896944e923b676d718254dbefb4e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 14 Nov 2023 14:32:19 +0100 Subject: [PATCH 6/6] Fix validation of GPS navigation data (fix due to @tractoan). Closes: #737 --- docs/CHANGELOG.md | 1 + src/core/system_parameters/gps_navigation_message.cc | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 930a5c59c..b17d9b6f7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -65,6 +65,7 @@ All notable changes to GNSS-SDR will be documented in this file. signal). - The estimated CN0 value is now printed in the terminal when navigation data is succesfully decoded. +- Fixed GPS navigation message satellite validation. ## [GNSS-SDR v0.0.18](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.18) - 2023-04-06 diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index b9a007a3f..d65520720 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -514,9 +514,9 @@ bool Gps_Navigation_Message::satellite_validation() // First Step: // check Issue Of Ephemeris Data (IODE IODC..) to find a possible interrupted reception // and check if the data have been filled (!=0) - if (d_TOW_SF1 != 0.0 and d_TOW_SF2 != 0.0 and d_TOW_SF3 != 0.0) + if (d_TOW_SF1 != 0.0 && d_TOW_SF2 != 0.0 && d_TOW_SF3 != 0.0) { - if (d_IODE_SF2 == d_IODE_SF3 and d_IODC == d_IODE_SF2 and d_IODC != -1.0) + if (d_IODE_SF2 == d_IODE_SF3 && (d_IODC & 0xFF) == d_IODE_SF2 && d_IODE_SF2 != -1.0) { flag_data_valid = true; b_valid_ephemeris_set_flag = true;