1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-31 23:26:22 +00:00

Fix shadowed variables

See MISRA C++:2008, 2-10-2 - Identifiers declared in an inner scope shall not hide an identifier declared in an outer scope
and https://rules.sonarsource.com/cpp/RSPEC-1117\?search\=shadow
This commit is contained in:
Carles Fernandez 2020-02-26 22:40:00 +01:00
parent 538c1e6182
commit c470d43432
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
18 changed files with 124 additions and 134 deletions

View File

@ -45,6 +45,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
- Rewriting of acquisition and tracking adapters, thus avoiding a lot of code duplication. - Rewriting of acquisition and tracking adapters, thus avoiding a lot of code duplication.
- New CMake option ENABLE_ARMA_NO_DEBUG defines the macro ARMA_NO_DEBUG, which disables all run-time checks, such as bounds checking, in the Armadillo library. This will result in faster code. This option is disabled by default during development, but automatically set to ON if the option ENABLE_PACKAGING is set to ON. - New CMake option ENABLE_ARMA_NO_DEBUG defines the macro ARMA_NO_DEBUG, which disables all run-time checks, such as bounds checking, in the Armadillo library. This will result in faster code. This option is disabled by default during development, but automatically set to ON if the option ENABLE_PACKAGING is set to ON.
- All shadowed variables detected by passing -Wshadow to the compiler have been fixed (see https://rules.sonarsource.com/cpp/RSPEC-1117?search=shadow).
- Apply more clang-tidy checks related to readability: readability-avoid-const-params-in-decls, readability-braces-around-statements, readability-isolate-declaration, readability-redundant-control-flow, readability-uppercase-literal-suffix. Fixed raised warnings. - Apply more clang-tidy checks related to readability: readability-avoid-const-params-in-decls, readability-braces-around-statements, readability-isolate-declaration, readability-redundant-control-flow, readability-uppercase-literal-suffix. Fixed raised warnings.
- Fixed a number of defects detected by cpplint.py. Filters applied: +build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/include_what_you_use,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line. - Fixed a number of defects detected by cpplint.py. Filters applied: +build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,+build/include_what_you_use,+build/printf_format,+build/storage_class,+readability/constructors,+readability/namespace,+readability/newline,+readability/utf8,+runtime/casting,+runtime/explicit,+runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,+runtime/member_string_references,+runtime/memset,+runtime/operator,+runtime/printf,+runtime/printf_format,+whitespace/blank_line.
- clang-format can now be applied to the whole code tree without breaking compilation. - clang-format can now be applied to the whole code tree without breaking compilation.

View File

@ -3769,7 +3769,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
std::string decimal = std::string("0"); std::string decimal = std::string("0");
if (timestring.size() > 16) if (timestring.size() > 16)
{ {
std::string decimal(timestring, 16, 1); decimal = std::string(timestring, 16, 1);
} }
line += decimal; line += decimal;
line += std::string(1, ' '); line += std::string(1, ' ');
@ -4184,8 +4184,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gps
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_OMEGA, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_OMEGA, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
const double OMEGA_DOT_REF = -2.6e-9; // semicircles / s, see IS-GPS-200K pp. 164 const double OMEGA_DOT_REF = -2.6e-9; // semicircles / s, see IS-GPS-200K pp. 164
double OMEGA_DOT = OMEGA_DOT_REF + gps_ephemeris_iter->second.d_DELTA_OMEGA_DOT; double OMEGA_DOT_aux = OMEGA_DOT_REF + gps_ephemeris_iter->second.d_DELTA_OMEGA_DOT;
line += Rinex_Printer::doub2for(OMEGA_DOT, 18, 2); line += Rinex_Printer::doub2for(OMEGA_DOT_aux, 18, 2);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
@ -4528,7 +4528,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Glo
std::string decimal = std::string("0"); std::string decimal = std::string("0");
if (timestring.size() > 16) if (timestring.size() > 16)
{ {
std::string decimal(timestring, 16, 1); decimal = std::string(timestring, 16, 1);
} }
line += decimal; line += decimal;
line += std::string(1, ' '); line += std::string(1, ' ');

View File

@ -3388,15 +3388,15 @@ std::map<std::string, int> Rtcm::galileo_signal_map = [] {
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const
{ {
const double gps_t = obs_time; const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week)) * 1000)); // NOLINT(google-runtime-int) boost::posix_time::time_duration t_duration = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week)) * 1000)); // NOLINT(google-runtime-int)
if (eph.i_GPS_week < 512) if (eph.i_GPS_week < 512)
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t_duration);
return p_time; return p_time;
} }
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t_duration);
return p_time; return p_time;
} }
@ -3404,8 +3404,8 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const
{ {
const double gps_t = obs_time; const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week)) * 1000)); // NOLINT(google-runtime-int) boost::posix_time::time_duration t_duration = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t_duration);
return p_time; return p_time;
} }
@ -3413,8 +3413,8 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d
boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const
{ {
double galileo_t = obs_time; double galileo_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000)); // NOLINT(google-runtime-int) boost::posix_time::time_duration t_duration = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t_duration);
return p_time; return p_time;
} }
@ -4206,16 +4206,16 @@ int32_t Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro)
int32_t Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) int32_t Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
{ {
const double gps_t = obs_time; const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week)) * 1000)); boost::posix_time::time_duration t_duration = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week)) * 1000));
std::string now_ptime; std::string now_ptime;
if (gps_eph.i_GPS_week < 512) if (gps_eph.i_GPS_week < 512)
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t_duration);
now_ptime = to_iso_string(p_time); now_ptime = to_iso_string(p_time);
} }
else else
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t_duration);
now_ptime = to_iso_string(p_time); now_ptime = to_iso_string(p_time);
} }
std::string today_ptime = now_ptime.substr(0, 8); std::string today_ptime = now_ptime.substr(0, 8);
@ -4229,16 +4229,16 @@ int32_t Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time)
int32_t Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time) int32_t Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time)
{ {
const double gps_t = obs_time; const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week)) * 1000)); boost::posix_time::time_duration t_duration = boost::posix_time::milliseconds(static_cast<int64_t>((gps_t + 604800 * static_cast<double>(gps_eph.i_GPS_week)) * 1000));
std::string now_ptime; std::string now_ptime;
if (gps_eph.i_GPS_week < 512) if (gps_eph.i_GPS_week < 512)
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t_duration);
now_ptime = to_iso_string(p_time); now_ptime = to_iso_string(p_time);
} }
else else
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t_duration);
now_ptime = to_iso_string(p_time); now_ptime = to_iso_string(p_time);
} }
std::string hours = now_ptime.substr(9, 2); std::string hours = now_ptime.substr(9, 2);
@ -4649,8 +4649,8 @@ int32_t Rtcm::set_DF119(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
int32_t Rtcm::set_DF120(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF120(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{ {
uint32_t P3 = static_cast<int32_t>(std::round(glonass_gnav_eph.d_P_3)); auto P3_aux = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P_3));
DF120 = std::bitset<1>(P3); DF120 = std::bitset<1>(P3_aux);
return 0; return 0;
} }
@ -4668,8 +4668,8 @@ int32_t Rtcm::set_DF121(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
int32_t Rtcm::set_DF122(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF122(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{ {
auto P = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P)); auto P_aux = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P));
DF122 = std::bitset<2>(P); DF122 = std::bitset<2>(P_aux);
return 0; return 0;
} }
@ -4714,8 +4714,8 @@ int32_t Rtcm::set_DF126(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
int32_t Rtcm::set_DF127(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF127(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{ {
auto P4 = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P_4)); auto P4_aux = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_P_4));
DF127 = std::bitset<1>(P4); DF127 = std::bitset<1>(P4_aux);
return 0; return 0;
} }
@ -4738,8 +4738,8 @@ int32_t Rtcm::set_DF129(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
int32_t Rtcm::set_DF130(const Glonass_Gnav_Ephemeris& glonass_gnav_eph) int32_t Rtcm::set_DF130(const Glonass_Gnav_Ephemeris& glonass_gnav_eph)
{ {
auto M = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_M)); auto M_aux = static_cast<uint32_t>(std::round(glonass_gnav_eph.d_M));
DF130 = std::bitset<2>(M); DF130 = std::bitset<2>(M_aux);
return 0; return 0;
} }
@ -4754,8 +4754,8 @@ int32_t Rtcm::set_DF131(uint32_t fifth_str_additional_data_ind)
int32_t Rtcm::set_DF132(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) int32_t Rtcm::set_DF132(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model)
{ {
auto N_A = static_cast<uint32_t>(std::round(glonass_gnav_utc_model.d_N_A)); auto N_A_aux = static_cast<uint32_t>(std::round(glonass_gnav_utc_model.d_N_A));
DF132 = std::bitset<11>(N_A); DF132 = std::bitset<11>(N_A_aux);
return 0; return 0;
} }
@ -4770,8 +4770,8 @@ int32_t Rtcm::set_DF133(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model)
int32_t Rtcm::set_DF134(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model) int32_t Rtcm::set_DF134(const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model)
{ {
auto N_4 = static_cast<uint32_t>(std::round(glonass_gnav_utc_model.d_N_4)); auto N_4_aux = static_cast<uint32_t>(std::round(glonass_gnav_utc_model.d_N_4));
DF134 = std::bitset<5>(N_4); DF134 = std::bitset<5>(N_4_aux);
return 0; return 0;
} }

View File

@ -224,10 +224,10 @@ void read_results(std::vector<volk_gnsssdr_test_results_t> *results, std::string
found = 127; found = 127;
} }
str_size = config_str.size(); str_size = config_str.size();
char buffer[128] = {'\0'}; char buffer_aux[128] = {'\0'};
config_str.copy(buffer, found + 1, 0); config_str.copy(buffer_aux, found + 1, 0);
buffer[found] = '\0'; buffer_aux[found] = '\0';
single_kernel_result.push_back(std::string(buffer)); single_kernel_result.push_back(std::string(buffer_aux));
config_str.erase(0, found + 1); config_str.erase(0, found + 1);
} }

View File

@ -359,17 +359,17 @@ static inline void volk_gnsssdr_8i_max_s8i_a_sse2(char* target, const char* src0
{ {
_mm_store_si128((__m128i*)&currentValuesBuffer, currentValues); _mm_store_si128((__m128i*)&currentValuesBuffer, currentValues);
mask = ~mask; mask = ~mask;
int i = 0; int i32 = 0;
while (mask > 0) while (mask > 0)
{ {
if ((mask & 1) == 1) if ((mask & 1) == 1)
{ {
if (currentValuesBuffer[i] > max) if (currentValuesBuffer[i32] > max)
{ {
max = currentValuesBuffer[i]; max = currentValuesBuffer[i32];
} }
} }
i++; i32++;
mask >>= 1; mask >>= 1;
} }
maxValues = _mm_set1_epi8(max); maxValues = _mm_set1_epi8(max);

View File

@ -23,9 +23,9 @@
#include <gnuradio/io_signature.h> #include <gnuradio/io_signature.h>
#include <cmath> #include <cmath>
unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(unsigned int adc_nbit) unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(unsigned int adc_nbit_)
{ {
return unpack_spir_gss6450_samples_sptr(new unpack_spir_gss6450_samples(adc_nbit)); return unpack_spir_gss6450_samples_sptr(new unpack_spir_gss6450_samples(adc_nbit_));
} }
@ -38,12 +38,12 @@ unpack_spir_gss6450_samples::unpack_spir_gss6450_samples(unsigned int adc_nbit)
} }
void unpack_spir_gss6450_samples::decode_4bits_word(uint32_t input_uint32, gr_complex* out, int adc_bits) void unpack_spir_gss6450_samples::decode_4bits_word(uint32_t input_uint32, gr_complex* out, int adc_bits_)
{ {
int8_t tmp_char; int8_t tmp_char;
float Q; float Q;
float I; float I;
switch (adc_bits) switch (adc_bits_)
{ {
case 2: case 2:
// four bits per complex sample (2 I + 2 Q), 8 samples per int32[s0,s1,s2,s3,s4,s5,s6,s7] // four bits per complex sample (2 I + 2 Q), 8 samples per int32[s0,s1,s2,s3,s4,s5,s6,s7]

View File

@ -27,7 +27,7 @@ class unpack_spir_gss6450_samples;
using unpack_spir_gss6450_samples_sptr = boost::shared_ptr<unpack_spir_gss6450_samples>; using unpack_spir_gss6450_samples_sptr = boost::shared_ptr<unpack_spir_gss6450_samples>;
unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(unsigned int adc_nbit); unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples(unsigned int adc_nbit_);
class unpack_spir_gss6450_samples : public gr::sync_interpolator class unpack_spir_gss6450_samples : public gr::sync_interpolator
@ -36,7 +36,7 @@ public:
int work(int noutput_items, int work(int noutput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
friend unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples_sptr(unsigned int adc_nbit); friend unpack_spir_gss6450_samples_sptr make_unpack_spir_gss6450_samples_sptr(unsigned int adc_nbit);
void decode_4bits_word(uint32_t input_uint32, gr_complex *out, int adc_bits); void decode_4bits_word(uint32_t input_uint32, gr_complex *out, int adc_bits_);
explicit unpack_spir_gss6450_samples(unsigned int adc_nbit); explicit unpack_spir_gss6450_samples(unsigned int adc_nbit);
~unpack_spir_gss6450_samples() = default; ~unpack_spir_gss6450_samples() = default;

View File

@ -1061,7 +1061,9 @@ bool load_fir_filter(
std::string line(buf); std::string line(buf);
if (line.find(',') == std::string::npos) if (line.find(',') == std::string::npos)
throw std::runtime_error("Incompatible filter file"); {
throw std::runtime_error("Incompatible filter file");
}
} }
ifs.seekg(0, ifs.end); ifs.seekg(0, ifs.end);

View File

@ -432,8 +432,8 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::save_matfile()
auto carr_error_hz = std::vector<float>(num_epoch); auto carr_error_hz = std::vector<float>(num_epoch);
auto carr_noise_sigma2 = std::vector<float>(num_epoch); auto carr_noise_sigma2 = std::vector<float>(num_epoch);
auto carr_error_filt_hz = std::vector<float>(num_epoch); auto carr_error_filt_hz = std::vector<float>(num_epoch);
auto code_error_chips = std::vector<float>(num_epoch); auto code_error_chips_aux = std::vector<float>(num_epoch);
auto code_error_filt_chips = std::vector<float>(num_epoch); auto code_error_filt_chips_aux = std::vector<float>(num_epoch);
auto CN0_SNV_dB_Hz = std::vector<float>(num_epoch); auto CN0_SNV_dB_Hz = std::vector<float>(num_epoch);
auto carrier_lock_test = std::vector<float>(num_epoch); auto carrier_lock_test = std::vector<float>(num_epoch);
auto aux1 = std::vector<float>(num_epoch); auto aux1 = std::vector<float>(num_epoch);
@ -461,8 +461,8 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carr_error_hz[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&carr_error_hz[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&carr_noise_sigma2[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&carr_noise_sigma2[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&carr_error_filt_hz[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&carr_error_filt_hz[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&code_error_chips[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&code_error_chips_aux[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&code_error_filt_chips[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&code_error_filt_chips_aux[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&CN0_SNV_dB_Hz[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&CN0_SNV_dB_Hz[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(float));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(float)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(float));
@ -548,11 +548,11 @@ int32_t Gps_L1_Ca_Kf_Tracking_cc::save_matfile()
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_chips.data(), 0); matvar = Mat_VarCreate("code_error_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_chips_aux.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_filt_chips.data(), 0); matvar = Mat_VarCreate("code_error_filt_chips", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims.data(), code_error_filt_chips_aux.data(), 0);
Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE
Mat_VarFree(matvar); Mat_VarFree(matvar);
@ -619,8 +619,8 @@ int Gps_L1_Ca_Kf_Tracking_cc::general_work(int noutput_items __attribute__((unus
{ {
// process vars // process vars
d_carr_phase_error_rad = 0.0; d_carr_phase_error_rad = 0.0;
double code_error_chips = 0.0; code_error_chips = 0.0;
double code_error_filt_chips = 0.0; code_error_filt_chips = 0.0;
// Block input data and block output stream pointers // Block input data and block output stream pointers
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]); const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);

View File

@ -802,16 +802,16 @@ bool Gnss_Sdr_Supl_Client::load_gps_almanac_xml(const std::string& file_name)
} }
bool Gnss_Sdr_Supl_Client::save_gps_almanac_xml(const std::string& file_name, std::map<int, Gps_Almanac> gps_almanac_map) bool Gnss_Sdr_Supl_Client::save_gps_almanac_xml(const std::string& file_name, std::map<int, Gps_Almanac> gps_almanac_map_to_save)
{ {
if (gps_almanac_map.empty() == false) if (gps_almanac_map_to_save.empty() == false)
{ {
std::ofstream ofs; std::ofstream ofs;
try try
{ {
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_gps_almanac_map", gps_almanac_map); xml << boost::serialization::make_nvp("GNSS-SDR_gps_almanac_map", gps_almanac_map_to_save);
LOG(INFO) << "Saved GPS almanac data"; LOG(INFO) << "Saved GPS almanac data";
} }
catch (std::exception& e) catch (std::exception& e)
@ -899,16 +899,16 @@ bool Gnss_Sdr_Supl_Client::read_gal_almanac_from_gsa(const std::string& file_nam
} }
bool Gnss_Sdr_Supl_Client::save_gal_almanac_xml(const std::string& file_name, std::map<int, Galileo_Almanac> gal_almanac_map) bool Gnss_Sdr_Supl_Client::save_gal_almanac_xml(const std::string& file_name, std::map<int, Galileo_Almanac> galileo_almanac_map_to_save)
{ {
if (gal_almanac_map.empty() == false) if (galileo_almanac_map_to_save.empty() == false)
{ {
std::ofstream ofs; std::ofstream ofs;
try try
{ {
ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out); ofs.open(file_name.c_str(), std::ofstream::trunc | std::ofstream::out);
boost::archive::xml_oarchive xml(ofs); boost::archive::xml_oarchive xml(ofs);
xml << boost::serialization::make_nvp("GNSS-SDR_gal_almanac_map", gal_almanac_map); xml << boost::serialization::make_nvp("GNSS-SDR_gal_almanac_map", galileo_almanac_map_to_save);
LOG(INFO) << "Saved Galileo almanac data"; LOG(INFO) << "Saved Galileo almanac data";
} }
catch (std::exception& e) catch (std::exception& e)

View File

@ -182,7 +182,7 @@ public:
/*! /*!
* \brief Save Galileo almanac map to XML file * \brief Save Galileo almanac map to XML file
*/ */
bool save_gal_almanac_xml(const std::string& file_name, std::map<int, Galileo_Almanac> gal_almanac); bool save_gal_almanac_xml(const std::string& file_name, std::map<int, Galileo_Almanac> galileo_almanac_map_to_save);
/*! /*!
* \brief Read GPS almanac map from XML file * \brief Read GPS almanac map from XML file
@ -192,7 +192,7 @@ public:
/*! /*!
* \brief Save GPS almanac map to XML file * \brief Save GPS almanac map to XML file
*/ */
bool save_gps_almanac_xml(const std::string& file_name, std::map<int, Gps_Almanac> gps_almanac_map); bool save_gps_almanac_xml(const std::string& file_name, std::map<int, Gps_Almanac> gps_almanac_map_to_save);
/*! /*!
* \brief Read iono from XML file * \brief Read iono from XML file

View File

@ -27,7 +27,6 @@
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
#include "string_converter.h" #include "string_converter.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <string>
#include <utility> #include <utility>
@ -45,12 +44,6 @@ FileConfiguration::FileConfiguration()
} }
FileConfiguration::~FileConfiguration()
{
LOG(INFO) << "Destructor called";
}
std::string FileConfiguration::property(std::string property_name, std::string default_value) std::string FileConfiguration::property(std::string property_name, std::string default_value)
{ {
if (overrided_->is_present(property_name)) if (overrided_->is_present(property_name))
@ -168,7 +161,7 @@ void FileConfiguration::set_property(std::string property_name, std::string valu
void FileConfiguration::init() void FileConfiguration::init()
{ {
std::unique_ptr<StringConverter> converter_(new StringConverter); converter_ = std::make_shared<StringConverter>();
overrided_ = std::make_shared<InMemoryConfiguration>(); overrided_ = std::make_shared<InMemoryConfiguration>();
ini_reader_ = std::make_shared<INIReader>(filename_); ini_reader_ = std::make_shared<INIReader>(filename_);
error_ = ini_reader_->ParseError(); error_ = ini_reader_->ParseError();

View File

@ -48,8 +48,7 @@ class FileConfiguration : public ConfigurationInterface
public: public:
explicit FileConfiguration(std::string filename); explicit FileConfiguration(std::string filename);
FileConfiguration(); FileConfiguration();
//! Virtual destructor ~FileConfiguration() = default;
~FileConfiguration();
std::string property(std::string property_name, std::string default_value); std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value); bool property(std::string property_name, bool default_value);
int64_t property(std::string property_name, int64_t default_value); int64_t property(std::string property_name, int64_t default_value);
@ -67,7 +66,7 @@ private:
std::string filename_; std::string filename_;
std::shared_ptr<INIReader> ini_reader_; std::shared_ptr<INIReader> ini_reader_;
std::shared_ptr<InMemoryConfiguration> overrided_; std::shared_ptr<InMemoryConfiguration> overrided_;
std::unique_ptr<StringConverter> converter_; std::shared_ptr<StringConverter> converter_;
int error_{}; int error_{};
}; };

View File

@ -21,13 +21,13 @@
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
#include "string_converter.h" #include "string_converter.h"
#include <memory>
#include <utility> #include <utility>
InMemoryConfiguration::InMemoryConfiguration() InMemoryConfiguration::InMemoryConfiguration()
{ {
std::unique_ptr<StringConverter> converter_(new StringConverter); std::unique_ptr<StringConverter> converter_aux(new StringConverter);
converter_ = std::move(converter_aux);
} }

View File

@ -43,7 +43,7 @@ class InMemoryConfiguration : public ConfigurationInterface
{ {
public: public:
InMemoryConfiguration(); InMemoryConfiguration();
virtual ~InMemoryConfiguration(); ~InMemoryConfiguration();
std::string property(std::string property_name, std::string default_value); std::string property(std::string property_name, std::string default_value);
bool property(std::string property_name, bool default_value); bool property(std::string property_name, bool default_value);
int64_t property(std::string property_name, int64_t default_value); int64_t property(std::string property_name, int64_t default_value);

View File

@ -284,7 +284,6 @@ public:
uint32_t smoother_length, uint32_t smoother_length,
bool high_dyn); bool high_dyn);
gr::top_block_sptr top_block;
std::shared_ptr<GNSSBlockFactory> factory; std::shared_ptr<GNSSBlockFactory> factory;
std::shared_ptr<InMemoryConfiguration> config; std::shared_ptr<InMemoryConfiguration> config;
Gnss_Synchro gnss_synchro_master; Gnss_Synchro gnss_synchro_master;
@ -342,8 +341,8 @@ int HybridObservablesTest::generate_signal()
bool HybridObservablesTest::acquire_signal() bool HybridObservablesTest::acquire_signal()
{ {
// 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m) // 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m)
gr::top_block_sptr top_block; gr::top_block_sptr top_block_acq;
top_block = gr::make_top_block("Acquisition test"); top_block_acq = gr::make_top_block("Acquisition test");
int SV_ID = 1; // initial sv id int SV_ID = 1; // initial sv id
// Satellite signal definition // Satellite signal definition
Gnss_Synchro tmp_gnss_synchro; Gnss_Synchro tmp_gnss_synchro;
@ -451,7 +450,7 @@ bool HybridObservablesTest::acquire_signal()
acquisition->init(); acquisition->init();
acquisition->set_local_code(); acquisition->set_local_code();
acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->set_state(1); // Ensure that acquisition starts at the first sample
acquisition->connect(top_block); acquisition->connect(top_block_acq);
gr::blocks::file_source::sptr file_source; gr::blocks::file_source::sptr file_source;
std::string file = FLAGS_signal_file; std::string file = FLAGS_signal_file;
@ -460,9 +459,9 @@ bool HybridObservablesTest::acquire_signal()
file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
// gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); // gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration);
// top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); // top_block_acq->connect(head_samples, 0, acquisition->get_left_block(), 0);
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block_acq->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
// Enable automatic resampler for the acquisition, if required // Enable automatic resampler for the acquisition, if required
if (FLAGS_use_acquisition_resampler == true) if (FLAGS_use_acquisition_resampler == true)
@ -521,25 +520,25 @@ bool HybridObservablesTest::acquire_signal()
std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl; std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl;
acquisition->set_resampler_latency((taps.size() - 1) / 2); acquisition->set_resampler_latency((taps.size() - 1) / 2);
gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps);
top_block->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0);
top_block->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0); top_block_acq->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0);
} }
else else
{ {
std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n";
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
} }
} }
else else
{ {
std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n";
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
} }
} }
else else
{ {
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
// top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); // top_block_acq->connect(head_samples, 0, acquisition->get_left_block(), 0);
} }
boost::shared_ptr<Acquisition_msg_rx> msg_rx; boost::shared_ptr<Acquisition_msg_rx> msg_rx;
@ -553,8 +552,8 @@ bool HybridObservablesTest::acquire_signal()
exit(0); exit(0);
} }
msg_rx->top_block = top_block; msg_rx->top_block = top_block_acq;
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block_acq->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
// 5. Run the flowgraph // 5. Run the flowgraph
// Get visible GPS satellites (positive acquisitions with Doppler measurements) // Get visible GPS satellites (positive acquisitions with Doppler measurements)
@ -588,7 +587,7 @@ bool HybridObservablesTest::acquire_signal()
acquisition->reset(); acquisition->reset();
acquisition->set_state(1); acquisition->set_state(1);
msg_rx->rx_message = 0; msg_rx->rx_message = 0;
top_block->run(); top_block_acq->run();
if (start_msg == true) if (start_msg == true)
{ {
std::cout << "Reading external signal file: " << FLAGS_signal_file << std::endl; std::cout << "Reading external signal file: " << FLAGS_signal_file << std::endl;
@ -609,7 +608,7 @@ bool HybridObservablesTest::acquire_signal()
{ {
std::cout << " . "; std::cout << " . ";
} }
top_block->stop(); top_block_acq->stop();
file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample
std::cout.flush(); std::cout.flush();
} }
@ -1797,7 +1796,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
}) << "Failure setting gnss_synchro."; }) << "Failure setting gnss_synchro.";
} }
top_block = gr::make_top_block("Telemetry_Decoder test"); auto top_block_tlm = gr::make_top_block("Telemetry_Decoder test");
boost::shared_ptr<HybridObservablesTest_msg_rx> dummy_msg_rx_trk = HybridObservablesTest_msg_rx_make(); boost::shared_ptr<HybridObservablesTest_msg_rx> dummy_msg_rx_trk = HybridObservablesTest_msg_rx_make();
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> dummy_tlm_msg_rx = HybridObservablesTest_tlm_msg_rx_make(); boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> dummy_tlm_msg_rx = HybridObservablesTest_tlm_msg_rx_make();
// Observables // Observables
@ -1806,7 +1805,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
for (auto& n : tracking_ch_vec) for (auto& n : tracking_ch_vec)
{ {
ASSERT_NO_THROW({ ASSERT_NO_THROW({
n->connect(top_block); n->connect(top_block_tlm);
}) << "Failure connecting tracking to the top_block."; }) << "Failure connecting tracking to the top_block.";
} }
@ -1825,19 +1824,19 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
int observable_interval_ms = 20; int observable_interval_ms = 20;
gnss_sdr_sample_counter_sptr samp_counter = gnss_sdr_make_sample_counter(static_cast<double>(baseband_sampling_freq), observable_interval_ms, sizeof(gr_complex)); gnss_sdr_sample_counter_sptr samp_counter = gnss_sdr_make_sample_counter(static_cast<double>(baseband_sampling_freq), observable_interval_ms, sizeof(gr_complex));
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block_tlm->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
top_block->connect(gr_interleaved_char_to_complex, 0, samp_counter, 0); top_block_tlm->connect(gr_interleaved_char_to_complex, 0, samp_counter, 0);
for (unsigned int n = 0; n < tracking_ch_vec.size(); n++) for (unsigned int n = 0; n < tracking_ch_vec.size(); n++)
{ {
top_block->connect(gr_interleaved_char_to_complex, 0, tracking_ch_vec.at(n)->get_left_block(), 0); top_block_tlm->connect(gr_interleaved_char_to_complex, 0, tracking_ch_vec.at(n)->get_left_block(), 0);
top_block->connect(tracking_ch_vec.at(n)->get_right_block(), 0, tlm_ch_vec.at(n)->get_left_block(), 0); top_block_tlm->connect(tracking_ch_vec.at(n)->get_right_block(), 0, tlm_ch_vec.at(n)->get_left_block(), 0);
top_block->connect(tlm_ch_vec.at(n)->get_right_block(), 0, observables->get_left_block(), n); top_block_tlm->connect(tlm_ch_vec.at(n)->get_right_block(), 0, observables->get_left_block(), n);
top_block->msg_connect(tracking_ch_vec.at(n)->get_right_block(), pmt::mp("events"), dummy_msg_rx_trk, pmt::mp("events")); top_block_tlm->msg_connect(tracking_ch_vec.at(n)->get_right_block(), pmt::mp("events"), dummy_msg_rx_trk, pmt::mp("events"));
top_block->connect(observables->get_right_block(), n, null_sink_vec.at(n), 0); top_block_tlm->connect(observables->get_right_block(), n, null_sink_vec.at(n), 0);
} }
// connect sample counter and timmer to the last channel in observables block (extra channel) // connect sample counter and timmer to the last channel in observables block (extra channel)
top_block->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size()); top_block_tlm->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size());
file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample
}) << "Failure connecting the blocks."; }) << "Failure connecting the blocks.";
@ -1849,7 +1848,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
EXPECT_NO_THROW({ EXPECT_NO_THROW({
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
top_block->run(); // Start threads and wait top_block_tlm->run(); // Start threads and wait
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
elapsed_seconds = end - start; elapsed_seconds = end - start;
}) << "Failure running the top_block."; }) << "Failure running the top_block.";

View File

@ -708,7 +708,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1); arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1);
arma::vec true_tow_s = arma::zeros(n_true_epochs, 1); arma::vec true_tow_s = arma::zeros(n_true_epochs, 1);
int64_t epoch_counter = 0; epoch_counter = 0;
while (true_obs_data.read_binary_obs()) while (true_obs_data.read_binary_obs())
{ {
true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s; true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s;

View File

@ -212,7 +212,7 @@ public:
int extend_correlation_symbols); int extend_correlation_symbols);
bool acquire_signal(int SV_ID); bool acquire_signal(int SV_ID);
gr::top_block_sptr top_block;
std::shared_ptr<GNSSBlockFactory> factory; std::shared_ptr<GNSSBlockFactory> factory;
std::shared_ptr<InMemoryConfiguration> config; std::shared_ptr<InMemoryConfiguration> config;
Gnss_Synchro gnss_synchro; Gnss_Synchro gnss_synchro;
@ -369,8 +369,8 @@ void TrackingPullInTest::configure_receiver(
bool TrackingPullInTest::acquire_signal(int SV_ID) bool TrackingPullInTest::acquire_signal(int SV_ID)
{ {
// 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m) // 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m)
gr::top_block_sptr top_block; gr::top_block_sptr top_block_acq;
top_block = gr::make_top_block("Acquisition test"); top_block_acq = gr::make_top_block("Acquisition test");
// Satellite signal definition // Satellite signal definition
Gnss_Synchro tmp_gnss_synchro; Gnss_Synchro tmp_gnss_synchro;
@ -479,7 +479,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
acquisition->init(); acquisition->init();
acquisition->set_local_code(); acquisition->set_local_code();
acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->set_state(1); // Ensure that acquisition starts at the first sample
acquisition->connect(top_block); acquisition->connect(top_block_acq);
gr::blocks::file_source::sptr file_source; gr::blocks::file_source::sptr file_source;
std::string file = FLAGS_signal_file; std::string file = FLAGS_signal_file;
@ -489,7 +489,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
// gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); // gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration);
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block_acq->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
// Enable automatic resampler for the acquisition, if required // Enable automatic resampler for the acquisition, if required
if (FLAGS_use_acquisition_resampler == true) if (FLAGS_use_acquisition_resampler == true)
@ -548,28 +548,27 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl; std::cout << "Enabled decimation low pass filter with " << taps.size() << " taps and decimation factor of " << decimation << std::endl;
acquisition->set_resampler_latency((taps.size() - 1) / 2); acquisition->set_resampler_latency((taps.size() - 1) / 2);
gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps); gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps);
top_block->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, fir_filter_ccf_, 0);
top_block->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0); top_block_acq->connect(fir_filter_ccf_, 0, acquisition->get_left_block(), 0);
} }
else else
{ {
std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n";
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
} }
} }
else else
{ {
std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n"; std::cout << "Disabled acquisition resampler because the input sampling frequency is too low\n";
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
} }
} }
else else
{ {
top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); top_block_acq->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0);
// top_block->connect(head_samples, 0, acquisition->get_left_block(), 0); // top_block_acq->connect(head_samples, 0, acquisition->get_left_block(), 0);
} }
boost::shared_ptr<Acquisition_msg_rx> msg_rx; boost::shared_ptr<Acquisition_msg_rx> msg_rx;
try try
{ {
@ -581,8 +580,8 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
exit(0); exit(0);
} }
msg_rx->top_block = top_block; msg_rx->top_block = top_block_acq;
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block_acq->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
// 5. Run the flowgraph // 5. Run the flowgraph
// Get visible GPS satellites (positive acquisitions with Doppler measurements) // Get visible GPS satellites (positive acquisitions with Doppler measurements)
@ -620,7 +619,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
acquisition->reset(); acquisition->reset();
acquisition->set_state(1); acquisition->set_state(1);
msg_rx->rx_message = 0; msg_rx->rx_message = 0;
top_block->run(); top_block_acq->run();
if (start_msg == true) if (start_msg == true)
{ {
std::cout << "Reading external signal file: " << FLAGS_signal_file << std::endl; std::cout << "Reading external signal file: " << FLAGS_signal_file << std::endl;
@ -643,7 +642,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
{ {
std::cout << " . "; std::cout << " . ";
} }
top_block->stop(); top_block_acq->stop();
file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); // skip head. ibyte, two bytes per complex sample file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); // skip head. ibyte, two bytes per complex sample
std::cout.flush(); std::cout.flush();
} }
@ -664,6 +663,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID)
return true; return true;
} }
TEST_F(TrackingPullInTest, ValidationOfResults) TEST_F(TrackingPullInTest, ValidationOfResults)
{ {
// ************************************************* // *************************************************
@ -685,7 +685,6 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
acq_delay_error_chips_values.push_back(tmp_vector); acq_delay_error_chips_values.push_back(tmp_vector);
} }
// *********************************************************** // ***********************************************************
// ***** STEP 2: Generate the input signal (if required) ***** // ***** STEP 2: Generate the input signal (if required) *****
// *********************************************************** // ***********************************************************
@ -735,7 +734,6 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
} }
} }
configure_receiver(FLAGS_PLL_bw_hz_start, configure_receiver(FLAGS_PLL_bw_hz_start,
FLAGS_DLL_bw_hz_start, FLAGS_DLL_bw_hz_start,
FLAGS_PLL_narrow_bw_hz, FLAGS_PLL_narrow_bw_hz,
@ -802,7 +800,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
gnss_synchro.Acq_delay_samples = true_acq_delay_samples + (acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx) / GPS_L1_CA_CODE_RATE_CPS) * static_cast<double>(baseband_sampling_freq); gnss_synchro.Acq_delay_samples = true_acq_delay_samples + (acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx) / GPS_L1_CA_CODE_RATE_CPS) * static_cast<double>(baseband_sampling_freq);
// create flowgraph // create flowgraph
top_block = gr::make_top_block("Tracking test"); auto top_block_trk = gr::make_top_block("Tracking test");
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1); std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", config->property("Tracking.implementation", std::string("undefined")), 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
boost::shared_ptr<TrackingPullInTest_msg_rx> msg_rx = TrackingPullInTest_msg_rx_make(); boost::shared_ptr<TrackingPullInTest_msg_rx> msg_rx = TrackingPullInTest_msg_rx_make();
@ -816,7 +814,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
}) << "Failure setting gnss_synchro."; }) << "Failure setting gnss_synchro.";
ASSERT_NO_THROW({ ASSERT_NO_THROW({
tracking->connect(top_block); tracking->connect(top_block_trk);
}) << "Failure connecting tracking to the top_block."; }) << "Failure connecting tracking to the top_block.";
std::string file; std::string file;
@ -834,23 +832,22 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration);
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block_trk->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
top_block->connect(gr_interleaved_char_to_complex, 0, head_samples, 0); top_block_trk->connect(gr_interleaved_char_to_complex, 0, head_samples, 0);
if (acq_to_trk_delay_samples > 0) if (acq_to_trk_delay_samples > 0)
{ {
top_block->connect(head_samples, 0, resetable_valve_, 0); top_block_trk->connect(head_samples, 0, resetable_valve_, 0);
top_block->connect(resetable_valve_, 0, tracking->get_left_block(), 0); top_block_trk->connect(resetable_valve_, 0, tracking->get_left_block(), 0);
} }
else else
{ {
top_block->connect(head_samples, 0, tracking->get_left_block(), 0); top_block_trk->connect(head_samples, 0, tracking->get_left_block(), 0);
} }
top_block->connect(tracking->get_right_block(), 0, sink, 0); top_block_trk->connect(tracking->get_right_block(), 0, sink, 0);
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block_trk->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample
}) << "Failure connecting the blocks of tracking test."; }) << "Failure connecting the blocks of tracking test.";
// ******************************************************************** // ********************************************************************
// ***** STEP 5: Perform the signal tracking and read the results ***** // ***** STEP 5: Perform the signal tracking and read the results *****
// ******************************************************************** // ********************************************************************
@ -861,7 +858,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
EXPECT_NO_THROW({ EXPECT_NO_THROW({
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
std::cout << "--- SIMULATING A PULL-IN DELAY OF " << FLAGS_acq_to_trk_delay_s << " SECONDS ---\n"; std::cout << "--- SIMULATING A PULL-IN DELAY OF " << FLAGS_acq_to_trk_delay_s << " SECONDS ---\n";
top_block->start(); top_block_trk->start();
std::cout << " Waiting for valve...\n"; std::cout << " Waiting for valve...\n";
// wait the valve message indicating the circulation of the amount of samples of the delay // wait the valve message indicating the circulation of the amount of samples of the delay
pmt::pmt_t msg; pmt::pmt_t msg;
@ -870,17 +867,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults)
tracking->start_tracking(); tracking->start_tracking();
resetable_valve_->open_valve(); resetable_valve_->open_valve();
std::cout << " Waiting flowgraph..\n"; std::cout << " Waiting flowgraph..\n";
top_block->wait(); top_block_trk->wait();
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
}) << "Failure running the top_block."; }) << "Failure running the top_block.";
} }
else else
{ {
tracking->start_tracking(); tracking->start_tracking();
std::chrono::time_point<std::chrono::system_clock> start, end;
EXPECT_NO_THROW({ EXPECT_NO_THROW({
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
top_block->run(); // Start threads and wait top_block_trk->run(); // Start threads and wait
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
}) << "Failure running the top_block."; }) << "Failure running the top_block.";
} }