mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-18 21:23:02 +00:00
clang-tidy: apply modernize-loop-convert fix (see https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html)
This commit is contained in:
parent
b5c0cc04e5
commit
b994f466a7
@ -248,9 +248,9 @@ char Nmea_Printer::checkSum(std::string sentence)
|
||||
{
|
||||
char check = 0;
|
||||
// iterate over the string, XOR each byte with the total sum:
|
||||
for (unsigned int c = 0; c < sentence.length(); c++)
|
||||
for (char c : sentence)
|
||||
{
|
||||
check = char(check ^ sentence.at(c));
|
||||
check = char(check ^ c);
|
||||
}
|
||||
// return the result
|
||||
return check;
|
||||
|
@ -73,12 +73,12 @@ rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag
|
||||
count_valid_position = 0;
|
||||
this->set_averaging_flag(false);
|
||||
rtk_ = rtk;
|
||||
for (unsigned int i = 0; i < 4; i++) dop_[i] = 0.0;
|
||||
for (double & i : dop_) i = 0.0;
|
||||
pvt_sol = {{0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, '0', '0', '0', 0, 0, 0};
|
||||
ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{{0, 0}}, {{0, 0}}}, {{}, {}}};
|
||||
for (unsigned int i = 0; i < MAXSAT; i++)
|
||||
for (auto & i : pvt_ssat)
|
||||
{
|
||||
pvt_ssat[i] = ssat0;
|
||||
i = ssat0;
|
||||
}
|
||||
// ############# ENABLE DATA FILE LOG #################
|
||||
if (d_flag_dump_enabled == true)
|
||||
@ -775,11 +775,11 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
nav_data.n = valid_obs;
|
||||
nav_data.ng = glo_valid_obs;
|
||||
|
||||
for (int i = 0; i < MAXSAT; i++)
|
||||
for (auto & i : nav_data.lam)
|
||||
{
|
||||
nav_data.lam[i][0] = SPEED_OF_LIGHT / FREQ1; // L1/E1
|
||||
nav_data.lam[i][1] = SPEED_OF_LIGHT / FREQ2; // L2
|
||||
nav_data.lam[i][2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
|
||||
i[0] = SPEED_OF_LIGHT / FREQ1; // L1/E1
|
||||
i[1] = SPEED_OF_LIGHT / FREQ2; // L2
|
||||
i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5
|
||||
}
|
||||
|
||||
result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data);
|
||||
@ -809,12 +809,12 @@ bool rtklib_solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
std::vector<double> azel;
|
||||
azel.reserve(used_sats * 2);
|
||||
unsigned int index_aux = 0;
|
||||
for (unsigned int i = 0; i < MAXSAT; i++)
|
||||
for (auto & i : rtk_.ssat)
|
||||
{
|
||||
if (rtk_.ssat[i].vs == 1)
|
||||
if (i.vs == 1)
|
||||
{
|
||||
azel[2 * index_aux] = rtk_.ssat[i].azel[0];
|
||||
azel[2 * index_aux + 1] = rtk_.ssat[i].azel[1];
|
||||
azel[2 * index_aux] = i.azel[0];
|
||||
azel[2 * index_aux + 1] = i.azel[1];
|
||||
index_aux++;
|
||||
}
|
||||
}
|
||||
|
@ -399,8 +399,8 @@ void FirFilter::init()
|
||||
// those bands, and the weight given to the error in those bands.
|
||||
std::vector<double> taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
|
||||
taps_.reserve(taps_d.size());
|
||||
for (auto it = taps_d.begin(); it != taps_d.end(); it++)
|
||||
for (double & it : taps_d)
|
||||
{
|
||||
taps_.push_back(float(*it));
|
||||
taps_.push_back(float(it));
|
||||
}
|
||||
}
|
||||
|
@ -108,9 +108,9 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
|
||||
int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
|
||||
taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
|
||||
taps_.reserve(taps_d.size());
|
||||
for (auto it = taps_d.begin(); it != taps_d.end(); it++)
|
||||
for (double & it : taps_d)
|
||||
{
|
||||
taps_.push_back(static_cast<float>(*it));
|
||||
taps_.push_back(static_cast<float>(it));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -86,9 +86,9 @@ Notch::~Notch()
|
||||
|
||||
void Notch::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||
{
|
||||
for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++)
|
||||
for (int & aux : ninput_items_required)
|
||||
{
|
||||
ninput_items_required[aux] = length_;
|
||||
aux = length_;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,9 +89,9 @@ NotchLite::~NotchLite()
|
||||
|
||||
void NotchLite::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||
{
|
||||
for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++)
|
||||
for (int & aux : ninput_items_required)
|
||||
{
|
||||
ninput_items_required[aux] = length_;
|
||||
aux = length_;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,9 +79,9 @@ pulse_blanking_cc::~pulse_blanking_cc()
|
||||
|
||||
void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||
{
|
||||
for (uint32_t aux = 0; aux < ninput_items_required.size(); aux++)
|
||||
for (int & aux : ninput_items_required)
|
||||
{
|
||||
ninput_items_required[aux] = length_;
|
||||
aux = length_;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,17 +51,17 @@ void galileo_e1_code_gen_int(int* _dest, char _Signal[3], int32_t _prn)
|
||||
|
||||
if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2)
|
||||
{
|
||||
for (size_t i = 0; i < Galileo_E1_B_PRIMARY_CODE[prn].length(); i++)
|
||||
for (char i : Galileo_E1_B_PRIMARY_CODE[prn])
|
||||
{
|
||||
hex_to_binary_converter(&_dest[index], Galileo_E1_B_PRIMARY_CODE[prn].at(i));
|
||||
hex_to_binary_converter(&_dest[index], i);
|
||||
index += 4;
|
||||
}
|
||||
}
|
||||
else if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2)
|
||||
{
|
||||
for (size_t i = 0; i < Galileo_E1_C_PRIMARY_CODE[prn].length(); i++)
|
||||
for (char i : Galileo_E1_C_PRIMARY_CODE[prn])
|
||||
{
|
||||
hex_to_binary_converter(&_dest[index], Galileo_E1_C_PRIMARY_CODE[prn].at(i));
|
||||
hex_to_binary_converter(&_dest[index], i);
|
||||
index += 4;
|
||||
}
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
||||
// preamble bits to sampled symbols
|
||||
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
||||
int32_t n = 0;
|
||||
for (int32_t i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||
for (unsigned short d_preambles_bit : d_preambles_bits)
|
||||
{
|
||||
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||
{
|
||||
if (d_preambles_bits[i] == 1)
|
||||
if (d_preambles_bit == 1)
|
||||
{
|
||||
d_preambles_symbols[n] = 1;
|
||||
}
|
||||
|
@ -74,11 +74,11 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc(
|
||||
// preamble bits to sampled symbols
|
||||
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
||||
int32_t n = 0;
|
||||
for (int32_t i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||
for (unsigned short d_preambles_bit : d_preambles_bits)
|
||||
{
|
||||
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||
{
|
||||
if (d_preambles_bits[i] == 1)
|
||||
if (d_preambles_bit == 1)
|
||||
{
|
||||
d_preambles_symbols[n] = 1;
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
||||
// preamble bits to sampled symbols
|
||||
d_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||
int32_t n = 0;
|
||||
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
|
||||
for (unsigned short preambles_bit : preambles_bits)
|
||||
{
|
||||
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
||||
{
|
||||
if (preambles_bits[i] == 1)
|
||||
if (preambles_bit == 1)
|
||||
{
|
||||
d_preambles_symbols[n] = 1;
|
||||
}
|
||||
@ -193,11 +193,11 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
||||
bool subframe_synchro_confirmation = false;
|
||||
bool CRC_ok = true;
|
||||
|
||||
for (int32_t n = 0; n < GPS_SUBFRAME_MS; n++)
|
||||
for (float d_subframe_symbol : d_subframe_symbols)
|
||||
{
|
||||
// ******* SYMBOL TO BIT *******
|
||||
// extended correlation to bit period is enabled in tracking!
|
||||
symbol_accumulator += d_subframe_symbols[n]; // accumulate the input value in d_symbol_accumulator
|
||||
symbol_accumulator += d_subframe_symbol; // accumulate the input value in d_symbol_accumulator
|
||||
symbol_accumulator_counter++;
|
||||
if (symbol_accumulator_counter == 20)
|
||||
{
|
||||
|
@ -299,8 +299,8 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st
|
||||
if (inv_preamble_detected)
|
||||
{
|
||||
// invert bits
|
||||
for (auto candidate_bit_it = candidate.begin(); candidate_bit_it != candidate.end(); candidate_bit_it++)
|
||||
*candidate_bit_it = *candidate_bit_it == 0 ? 1 : 0;
|
||||
for (int & candidate_bit_it : candidate)
|
||||
candidate_bit_it = candidate_bit_it == 0 ? 1 : 0;
|
||||
}
|
||||
msg_candidates.push_back(std::pair<int32_t, std::vector<int32_t>>(relative_preamble_start, candidate));
|
||||
ss.str("");
|
||||
@ -460,17 +460,16 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
||||
// compute message sample stamp
|
||||
// and fill messages in SBAS raw message objects
|
||||
//std::vector<Sbas_Raw_Msg> sbas_raw_msgs;
|
||||
for (auto it = valid_msgs.cbegin();
|
||||
it != valid_msgs.cend(); ++it)
|
||||
for (const auto & valid_msg : valid_msgs)
|
||||
{
|
||||
int32_t message_sample_offset =
|
||||
(sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first;
|
||||
(sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * valid_msg.first;
|
||||
double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
|
||||
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
|
||||
<< " (sample_stamp=" << sample_stamp
|
||||
<< " sample_alignment=" << sample_alignment
|
||||
<< " symbol_alignment=" << symbol_alignment
|
||||
<< " relative_preamble_start=" << it->first
|
||||
<< " relative_preamble_start=" << valid_msg.first
|
||||
<< " message_sample_offset=" << message_sample_offset
|
||||
<< ")";
|
||||
//Sbas_Raw_Msg sbas_raw_msg(message_sample_stamp, this->d_satellite.get_PRN(), it->second);
|
||||
|
@ -133,11 +133,11 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
||||
// preamble bits to sampled symbols
|
||||
d_gps_l1ca_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||
int32_t n = 0;
|
||||
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
|
||||
for (unsigned short preambles_bit : preambles_bits)
|
||||
{
|
||||
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
||||
{
|
||||
if (preambles_bits[i] == 1)
|
||||
if (preambles_bit == 1)
|
||||
{
|
||||
d_gps_l1ca_preambles_symbols[n] = 1;
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ std::string INIReader::MakeKey(std::string section, std::string name)
|
||||
{
|
||||
std::string key = section + "." + name;
|
||||
// Convert to lower case to make lookups case-insensitive
|
||||
for (unsigned int i = 0; i < key.length(); i++)
|
||||
key[i] = tolower(key[i]);
|
||||
for (char & i : key)
|
||||
i = tolower(i);
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -83,8 +83,8 @@ void Glonass_Gnav_Navigation_Message::reset()
|
||||
|
||||
// Data update information
|
||||
d_previous_tb = 0.0;
|
||||
for (uint32_t i = 0; i < GLONASS_CA_NBR_SATS; i++)
|
||||
d_previous_Na[i] = 0.0;
|
||||
for (double & i : d_previous_Na)
|
||||
i = 0.0;
|
||||
|
||||
std::map<int, std::string> satelliteBlock; // Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
|
||||
|
||||
@ -126,66 +126,66 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_B
|
||||
|
||||
// Compute C1 term
|
||||
sum_bits = 0;
|
||||
for (int32_t i = 0; i < static_cast<int32_t>(GLONASS_GNAV_CRC_I_INDEX.size()); i++)
|
||||
for (int i : GLONASS_GNAV_CRC_I_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_I_INDEX[i] - 1];
|
||||
sum_bits += string_bits[i - 1];
|
||||
}
|
||||
C1 = string_bits[0] ^ (sum_bits % 2);
|
||||
|
||||
// Compute C2 term
|
||||
sum_bits = 0;
|
||||
for (int32_t j = 0; j < static_cast<int32_t>(GLONASS_GNAV_CRC_J_INDEX.size()); j++)
|
||||
for (int j : GLONASS_GNAV_CRC_J_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_J_INDEX[j] - 1];
|
||||
sum_bits += string_bits[j - 1];
|
||||
}
|
||||
C2 = (string_bits[1]) ^ (sum_bits % 2);
|
||||
|
||||
// Compute C3 term
|
||||
sum_bits = 0;
|
||||
for (int32_t k = 0; k < static_cast<int32_t>(GLONASS_GNAV_CRC_K_INDEX.size()); k++)
|
||||
for (int k : GLONASS_GNAV_CRC_K_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_K_INDEX[k] - 1];
|
||||
sum_bits += string_bits[k - 1];
|
||||
}
|
||||
C3 = string_bits[2] ^ (sum_bits % 2);
|
||||
|
||||
// Compute C4 term
|
||||
sum_bits = 0;
|
||||
for (int32_t l = 0; l < static_cast<int32_t>(GLONASS_GNAV_CRC_L_INDEX.size()); l++)
|
||||
for (int l : GLONASS_GNAV_CRC_L_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_L_INDEX[l] - 1];
|
||||
sum_bits += string_bits[l - 1];
|
||||
}
|
||||
C4 = string_bits[3] ^ (sum_bits % 2);
|
||||
|
||||
// Compute C5 term
|
||||
sum_bits = 0;
|
||||
for (int32_t m = 0; m < static_cast<int32_t>(GLONASS_GNAV_CRC_M_INDEX.size()); m++)
|
||||
for (int m : GLONASS_GNAV_CRC_M_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_M_INDEX[m] - 1];
|
||||
sum_bits += string_bits[m - 1];
|
||||
}
|
||||
C5 = string_bits[4] ^ (sum_bits % 2);
|
||||
|
||||
// Compute C6 term
|
||||
sum_bits = 0;
|
||||
for (int32_t n = 0; n < static_cast<int32_t>(GLONASS_GNAV_CRC_N_INDEX.size()); n++)
|
||||
for (int n : GLONASS_GNAV_CRC_N_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_N_INDEX[n] - 1];
|
||||
sum_bits += string_bits[n - 1];
|
||||
}
|
||||
C6 = string_bits[5] ^ (sum_bits % 2);
|
||||
|
||||
// Compute C7 term
|
||||
sum_bits = 0;
|
||||
for (int32_t p = 0; p < static_cast<int32_t>(GLONASS_GNAV_CRC_P_INDEX.size()); p++)
|
||||
for (int p : GLONASS_GNAV_CRC_P_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_P_INDEX[p] - 1];
|
||||
sum_bits += string_bits[p - 1];
|
||||
}
|
||||
C7 = string_bits[6] ^ (sum_bits % 2);
|
||||
|
||||
// Compute C_Sigma term
|
||||
sum_bits = 0;
|
||||
sum_hamming = 0;
|
||||
for (int32_t q = 0; q < static_cast<int32_t>(GLONASS_GNAV_CRC_Q_INDEX.size()); q++)
|
||||
for (int q : GLONASS_GNAV_CRC_Q_INDEX)
|
||||
{
|
||||
sum_bits += string_bits[GLONASS_GNAV_CRC_Q_INDEX[q] - 1];
|
||||
sum_bits += string_bits[q - 1];
|
||||
}
|
||||
for (int32_t q = 0; q < 8; q++)
|
||||
{
|
||||
|
@ -225,9 +225,9 @@ std::string Rtcm::binary_data_to_bin(const std::string& s) const
|
||||
std::string s_aux;
|
||||
std::stringstream ss;
|
||||
|
||||
for (uint32_t i = 0; i < s.length(); i++)
|
||||
for (char i : s)
|
||||
{
|
||||
auto val = static_cast<uint8_t>(s.at(i));
|
||||
auto val = static_cast<uint8_t>(i);
|
||||
std::bitset<8> bs(val);
|
||||
ss << bs;
|
||||
}
|
||||
|
@ -2158,8 +2158,8 @@ void Gnuplot::remove_tmpfiles()
|
||||
{
|
||||
if ((tmpfile_list).size() > 0)
|
||||
{
|
||||
for (unsigned int i = 0; i < tmpfile_list.size(); i++)
|
||||
if (remove(tmpfile_list[i].c_str()) != 0)
|
||||
for (auto & i : tmpfile_list)
|
||||
if (remove(i.c_str()) != 0)
|
||||
std::cout << "Problem closing files" << std::endl;
|
||||
|
||||
Gnuplot::tmpfile_num -= tmpfile_list.size();
|
||||
|
@ -91,10 +91,10 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
float x_real[size];
|
||||
float x_imag[size];
|
||||
unsigned int i = 0;
|
||||
for (auto it = x_v.cbegin(); it != x_v.cend(); it++)
|
||||
for (auto it : x_v)
|
||||
{
|
||||
x_real[i] = it->real();
|
||||
x_imag[i] = it->imag();
|
||||
x_real[i] = it.real();
|
||||
x_imag[i] = it.imag();
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -108,10 +108,10 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
float y_real[size_y];
|
||||
float y_imag[size_y];
|
||||
i = 0;
|
||||
for (auto it = x2.cbegin(); it != x2.cend(); it++)
|
||||
for (auto it : x2)
|
||||
{
|
||||
y_real[i] = it->real();
|
||||
y_imag[i] = it->imag();
|
||||
y_real[i] = it.real();
|
||||
y_imag[i] = it.imag();
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -92,9 +92,8 @@ int DataTypeAdapter::run_ishort_to_cshort_block()
|
||||
EXPECT_EQ(expected_implementation, ishort_to_cshort->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str(), std::ofstream::binary);
|
||||
for (auto i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i)
|
||||
for (short aux : input_data_shorts)
|
||||
{
|
||||
short aux = *i;
|
||||
ofs.write(reinterpret_cast<const char*>(&aux), sizeof(short));
|
||||
}
|
||||
ofs.close();
|
||||
@ -121,9 +120,8 @@ int DataTypeAdapter::run_ishort_to_complex_block()
|
||||
EXPECT_EQ(expected_implementation, ishort_to_complex->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str(), std::ofstream::binary);
|
||||
for (auto i = input_data_shorts.cbegin(); i != input_data_shorts.cend(); ++i)
|
||||
for (short aux : input_data_shorts)
|
||||
{
|
||||
short aux = *i;
|
||||
ofs.write(reinterpret_cast<const char*>(&aux), sizeof(short));
|
||||
}
|
||||
ofs.close();
|
||||
@ -150,9 +148,9 @@ int DataTypeAdapter::run_ibyte_to_cshort_block()
|
||||
EXPECT_EQ(expected_implementation, ibyte_to_cshort->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for (auto i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (signed char input_data_byte : input_data_bytes)
|
||||
{
|
||||
ofs << *i;
|
||||
ofs << input_data_byte;
|
||||
}
|
||||
ofs.close();
|
||||
|
||||
@ -178,9 +176,9 @@ int DataTypeAdapter::run_ibyte_to_complex_block()
|
||||
EXPECT_EQ(expected_implementation, ibyte_to_complex->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for (auto i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (signed char input_data_byte : input_data_bytes)
|
||||
{
|
||||
ofs << *i;
|
||||
ofs << input_data_byte;
|
||||
}
|
||||
ofs.close();
|
||||
|
||||
@ -206,9 +204,9 @@ int DataTypeAdapter::run_ibyte_to_cbyte_block()
|
||||
EXPECT_EQ(expected_implementation, ibyte_to_cbyte->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for (auto i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (signed char input_data_byte : input_data_bytes)
|
||||
{
|
||||
ofs << *i;
|
||||
ofs << input_data_byte;
|
||||
}
|
||||
ofs.close();
|
||||
|
||||
@ -234,9 +232,9 @@ int DataTypeAdapter::run_byte_to_short_block()
|
||||
EXPECT_EQ(expected_implementation, byte_to_short->implementation());
|
||||
|
||||
std::ofstream ofs(file_name_input.c_str());
|
||||
for (auto i = input_data_bytes.cbegin(); i != input_data_bytes.cend(); ++i)
|
||||
for (signed char input_data_byte : input_data_bytes)
|
||||
{
|
||||
ofs << *i;
|
||||
ofs << input_data_byte;
|
||||
}
|
||||
ofs.close();
|
||||
|
||||
|
@ -52,9 +52,9 @@ std::vector<uint8_t> packData(std::vector<int8_t> const &raw_data,
|
||||
int shift = (big_endian ? 6 : 0);
|
||||
unsigned int j = 0;
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
for (signed char i : raw_data)
|
||||
{
|
||||
auto val = static_cast<unsigned>((raw_data[i] - 1) / 2 & 0x03);
|
||||
auto val = static_cast<unsigned>((i - 1) / 2 & 0x03);
|
||||
|
||||
packed_data[j] |= val << shift;
|
||||
|
||||
|
@ -56,10 +56,10 @@ TEST(TrackingLoopFilterTest, FirstOrderLoop)
|
||||
float g1 = noise_bandwidth * 4.0;
|
||||
|
||||
float result = 0.0;
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
for (float i : sample_data)
|
||||
{
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_FLOAT_EQ(result, sample_data[i] * g1);
|
||||
result = theFilter.apply(i);
|
||||
EXPECT_FLOAT_EQ(result, i * g1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,9 +433,9 @@ int main(int argc, char** argv)
|
||||
{
|
||||
std::cout << " " << PRN << " ";
|
||||
double doppler_measurement_hz = 0;
|
||||
for (auto it = gnss_sync_vector.begin(); it != gnss_sync_vector.end(); ++it)
|
||||
for (auto & it : gnss_sync_vector)
|
||||
{
|
||||
doppler_measurement_hz += (*it).Acq_doppler_hz;
|
||||
doppler_measurement_hz += it.Acq_doppler_hz;
|
||||
}
|
||||
doppler_measurement_hz = doppler_measurement_hz / gnss_sync_vector.size();
|
||||
doppler_measurements_map.insert(std::pair<int, double>(PRN, doppler_measurement_hz));
|
||||
@ -540,21 +540,21 @@ int main(int argc, char** argv)
|
||||
|
||||
std::cout << "SV ID Measured [Hz] Predicted [Hz]" << std::endl;
|
||||
|
||||
for (auto it = doppler_measurements_map.begin(); it != doppler_measurements_map.end(); ++it)
|
||||
for (auto & it : doppler_measurements_map)
|
||||
{
|
||||
try
|
||||
{
|
||||
double doppler_estimated_hz;
|
||||
doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it->first, current_TOW, lat_deg, lon_deg, altitude_m);
|
||||
std::cout << " " << it->first << " " << it->second << " " << doppler_estimated_hz << std::endl;
|
||||
doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it.first, current_TOW, lat_deg, lon_deg, altitude_m);
|
||||
std::cout << " " << it.first << " " << it.second << " " << doppler_estimated_hz << std::endl;
|
||||
// 7. Compute front-end IF and sampling frequency estimation
|
||||
// Compare with the measurements and compute clock drift using FE model
|
||||
double estimated_fs_Hz, estimated_f_if_Hz, f_osc_err_ppm;
|
||||
front_end_cal.GPS_L1_front_end_model_E4000(doppler_estimated_hz, it->second, fs_in_, &estimated_fs_Hz, &estimated_f_if_Hz, &f_osc_err_ppm);
|
||||
front_end_cal.GPS_L1_front_end_model_E4000(doppler_estimated_hz, it.second, fs_in_, &estimated_fs_Hz, &estimated_f_if_Hz, &f_osc_err_ppm);
|
||||
|
||||
f_if_estimation_Hz_map.insert(std::pair<int, double>(it->first, estimated_f_if_Hz));
|
||||
f_fs_estimation_Hz_map.insert(std::pair<int, double>(it->first, estimated_fs_Hz));
|
||||
f_ppm_estimation_Hz_map.insert(std::pair<int, double>(it->first, f_osc_err_ppm));
|
||||
f_if_estimation_Hz_map.insert(std::pair<int, double>(it.first, estimated_f_if_Hz));
|
||||
f_fs_estimation_Hz_map.insert(std::pair<int, double>(it.first, estimated_fs_Hz));
|
||||
f_ppm_estimation_Hz_map.insert(std::pair<int, double>(it.first, f_osc_err_ppm));
|
||||
}
|
||||
catch (const std::logic_error& e)
|
||||
{
|
||||
@ -566,7 +566,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (int ex)
|
||||
{
|
||||
std::cout << " " << it->first << " " << it->second << " (Eph not found)" << std::endl;
|
||||
std::cout << " " << it.first << " " << it.second << " (Eph not found)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -576,11 +576,11 @@ int main(int argc, char** argv)
|
||||
double mean_osc_err_ppm = 0;
|
||||
int n_elements = f_if_estimation_Hz_map.size();
|
||||
|
||||
for (auto it = f_if_estimation_Hz_map.begin(); it != f_if_estimation_Hz_map.end(); ++it)
|
||||
for (auto & it : f_if_estimation_Hz_map)
|
||||
{
|
||||
mean_f_if_Hz += (*it).second;
|
||||
mean_fs_Hz += f_fs_estimation_Hz_map.find((*it).first)->second;
|
||||
mean_osc_err_ppm += f_ppm_estimation_Hz_map.find((*it).first)->second;
|
||||
mean_f_if_Hz += it.second;
|
||||
mean_fs_Hz += f_fs_estimation_Hz_map.find(it.first)->second;
|
||||
mean_osc_err_ppm += f_ppm_estimation_Hz_map.find(it.first)->second;
|
||||
}
|
||||
|
||||
mean_f_if_Hz /= n_elements;
|
||||
@ -597,13 +597,13 @@ int main(int argc, char** argv)
|
||||
<< "Corrected Doppler vs. Predicted" << std::endl;
|
||||
std::cout << "SV ID Corrected [Hz] Predicted [Hz]" << std::endl;
|
||||
|
||||
for (auto it = doppler_measurements_map.begin(); it != doppler_measurements_map.end(); ++it)
|
||||
for (auto & it : doppler_measurements_map)
|
||||
{
|
||||
try
|
||||
{
|
||||
double doppler_estimated_hz;
|
||||
doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it->first, current_TOW, lat_deg, lon_deg, altitude_m);
|
||||
std::cout << " " << it->first << " " << it->second - mean_f_if_Hz << " " << doppler_estimated_hz << std::endl;
|
||||
doppler_estimated_hz = front_end_cal.estimate_doppler_from_eph(it.first, current_TOW, lat_deg, lon_deg, altitude_m);
|
||||
std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " " << doppler_estimated_hz << std::endl;
|
||||
}
|
||||
catch (const std::logic_error& e)
|
||||
{
|
||||
@ -615,7 +615,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
catch (int ex)
|
||||
{
|
||||
std::cout << " " << it->first << " " << it->second - mean_f_if_Hz << " (Eph not found)" << std::endl;
|
||||
std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " (Eph not found)" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user