mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
Fix bugprone-too-small-loop-variable clang-tidy check warnings
This commit is contained in:
parent
d36e9e431c
commit
df05c7418e
@ -34,6 +34,7 @@
|
||||
#include "geofunctions.h"
|
||||
#include <glog/logging.h>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
Pvt_Solution::Pvt_Solution()
|
||||
@ -271,7 +272,7 @@ void Pvt_Solution::perform_pos_averaging()
|
||||
d_avg_latitude_d = 0.0;
|
||||
d_avg_longitude_d = 0.0;
|
||||
d_avg_height_m = 0.0;
|
||||
for (unsigned int i = 0; i < d_hist_longitude_d.size(); i++)
|
||||
for (size_t i = 0; i < d_hist_longitude_d.size(); i++)
|
||||
{
|
||||
d_avg_latitude_d = d_avg_latitude_d + d_hist_latitude_d.at(i);
|
||||
d_avg_longitude_d = d_avg_longitude_d + d_hist_longitude_d.at(i);
|
||||
|
@ -439,7 +439,7 @@ std::string Rinex_Printer::getLocalTime()
|
||||
line += std::string(12, ' ');
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -2398,7 +2398,7 @@ void Rinex_Printer::rinex_sbs_header(std::fstream& out)
|
||||
line += Rinex_Printer::leftJustify("GNSS-SDR", 20);
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -4842,7 +4842,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephem
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -5168,7 +5168,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -5523,7 +5523,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -5832,7 +5832,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -6155,7 +6155,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -6412,7 +6412,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -6663,7 +6663,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -6944,7 +6944,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -7290,7 +7290,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_CNAV_Ephemeris
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -7608,7 +7608,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Galileo_Ephemeris&
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -7875,7 +7875,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& gps
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
@ -8157,7 +8157,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Beidou_Dnav_Epheme
|
||||
line.clear();
|
||||
std::string username;
|
||||
std::array<char, 20> c_username{};
|
||||
int32_t nGet = getlogin_r(c_username.data(), sizeof(c_username) - 1);
|
||||
int32_t nGet = getlogin_r(c_username.data(), c_username.size() - 1);
|
||||
if (nGet == 0)
|
||||
{
|
||||
username = c_username.data();
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <boost/exception/diagnostic_information.hpp>
|
||||
#include <algorithm> // for std::reverse
|
||||
#include <chrono> // std::chrono::seconds
|
||||
#include <cmath> // for std::fmod
|
||||
#include <cmath> // for std::fmod, std::lround
|
||||
#include <cstdlib> // for strtol
|
||||
#include <iostream> // for cout
|
||||
#include <sstream> // for std::stringstream
|
||||
@ -201,8 +201,8 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const
|
||||
k++;
|
||||
}
|
||||
|
||||
uint32_t start = std::max(remainder, 0);
|
||||
for (uint32_t i = start; i < s.length() - 1; i = i + 8)
|
||||
std::size_t start = std::max(remainder, 0);
|
||||
for (std::size_t i = start; i < s.length() - 1; i = i + 8)
|
||||
{
|
||||
s_aux.assign(s, i, 4);
|
||||
std::bitset<4> bs(s_aux);
|
||||
@ -250,8 +250,8 @@ std::string Rtcm::bin_to_hex(const std::string& s) const
|
||||
ss << std::hex << n;
|
||||
}
|
||||
|
||||
uint32_t start = std::max(remainder, 0);
|
||||
for (uint32_t i = start; i < s.length() - 1; i = i + 4)
|
||||
std::size_t start = std::max(remainder, 0);
|
||||
for (std::size_t i = start; i < s.length() - 1; i = i + 4)
|
||||
{
|
||||
s_aux.assign(s, i, 4);
|
||||
std::bitset<4> bs(s_aux);
|
||||
@ -269,7 +269,7 @@ std::string Rtcm::hex_to_bin(const std::string& s) const
|
||||
std::stringstream ss;
|
||||
ss << s;
|
||||
std::string s_lower = boost::to_upper_copy(ss.str());
|
||||
for (uint32_t i = 0; i < s.length(); i++)
|
||||
for (size_t i = 0; i < s.length(); i++)
|
||||
{
|
||||
uint64_t n;
|
||||
std::istringstream(s_lower.substr(i, 1)) >> std::hex >> n;
|
||||
@ -5312,7 +5312,7 @@ int32_t Rtcm::set_DF397(const Gnss_Synchro& gnss_synchro)
|
||||
}
|
||||
else
|
||||
{
|
||||
int_ms = static_cast<uint32_t>(std::floor(rough_range_s / meters_to_miliseconds / TWO_N10) + 0.5) >> 10;
|
||||
int_ms = static_cast<uint32_t>(std::lround(rough_range_s / meters_to_miliseconds / TWO_N10)) >> 10;
|
||||
}
|
||||
|
||||
DF397 = std::bitset<8>(int_ms);
|
||||
@ -5331,7 +5331,7 @@ int32_t Rtcm::set_DF398(const Gnss_Synchro& gnss_synchro)
|
||||
}
|
||||
else
|
||||
{
|
||||
rr_mod_ms = static_cast<uint32_t>(std::floor(rough_range_m / meters_to_miliseconds / TWO_N10) + 0.5) & 0x3FFU;
|
||||
rr_mod_ms = static_cast<uint32_t>(std::lround(rough_range_m / meters_to_miliseconds / TWO_N10)) & 0x3FFU;
|
||||
}
|
||||
DF398 = std::bitset<10>(rr_mod_ms);
|
||||
return 0;
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "beamformer.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
beamformer_sptr make_beamformer_sptr()
|
||||
@ -67,7 +68,7 @@ int beamformer::work(int noutput_items, gr_vector_const_void_star &input_items,
|
||||
for (int n = 0; n < noutput_items; n++)
|
||||
{
|
||||
sum = gr_complex(0, 0);
|
||||
for (unsigned int i = 0; i < weight_vector.size(); i++)
|
||||
for (size_t i = 0; i < weight_vector.size(); i++)
|
||||
{
|
||||
sum = sum + (reinterpret_cast<const gr_complex *>(input_items[i]))[n] * weight_vector[i];
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ void beidou_b1i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, u
|
||||
const int32_t _codeLength = 2046;
|
||||
|
||||
// --- Find number of samples per spreading code ---------------------------
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
// --- Find time constants -------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
|
@ -220,7 +220,7 @@ void beidou_b3i_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, u
|
||||
const int32_t _codeLength = 10230;
|
||||
|
||||
// --- Find number of samples per spreading code ---------------------------
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
// --- Find time constants -------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
|
@ -115,7 +115,7 @@ void glonass_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest
|
||||
const int32_t _codeLength = 511;
|
||||
|
||||
// --- Find number of samples per spreading code ---------------------------
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
// --- Find time constants -------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
|
@ -115,7 +115,7 @@ void glonass_l2_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest
|
||||
const int32_t _codeLength = 511;
|
||||
|
||||
// --- Find number of samples per spreading code ---------------------------
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
// --- Find time constants -------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "gnss_signal_processing.h"
|
||||
#include "GPS_L1_CA.h"
|
||||
#include <gnuradio/fxpt_nco.h>
|
||||
#include <cstddef> // for size_t
|
||||
|
||||
|
||||
auto auxCeil2 = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
|
||||
@ -168,7 +169,7 @@ void resampler(const gsl::span<float> _from, gsl::span<float> _dest, float _fs_i
|
||||
// --- Find time constants -------------------------------------------------
|
||||
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
|
||||
const float _t_out = 1 / _fs_out; // Out sampling period in sec
|
||||
for (uint32_t i = 0; i < _dest.size() - 1; i++)
|
||||
for (size_t i = 0; i < _dest.size() - 1; i++)
|
||||
{
|
||||
// === Digitizing ==================================================
|
||||
// --- compute index array to read sampled values ------------------
|
||||
@ -191,7 +192,7 @@ void resampler(gsl::span<const std::complex<float>> _from, gsl::span<std::comple
|
||||
// --- Find time constants -------------------------------------------------
|
||||
const float _t_in = 1 / _fs_in; // Incoming sampling period in sec
|
||||
const float _t_out = 1 / _fs_out; // Out sampling period in sec
|
||||
for (uint32_t i = 0; i < _dest.size() - 1; i++)
|
||||
for (size_t i = 0; i < _dest.size() - 1; i++)
|
||||
{
|
||||
// === Digitizing ==================================================
|
||||
// --- compute index array to read sampled values ------------------
|
||||
|
@ -166,7 +166,7 @@ void gps_l1_ca_code_gen_complex_sampled(gsl::span<std::complex<float>> _dest, ui
|
||||
const int32_t _codeLength = 1023;
|
||||
|
||||
// --- Find number of samples per spreading code ---------------------------
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
|
||||
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / (static_cast<double>(_codeFreqBasis) / static_cast<double>(_codeLength)));
|
||||
|
||||
// --- Find time constants -------------------------------------------------
|
||||
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
|
||||
|
@ -1584,11 +1584,11 @@ void time2epoch(gtime_t t, double *ep)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ep[0] = 1970 + days / 1461 * 4 + mon / 12;
|
||||
ep[0] = 1970 + static_cast<int>(days / 1461) * 4 + static_cast<int>(mon / 12);
|
||||
ep[1] = mon % 12 + 1;
|
||||
ep[2] = day + 1;
|
||||
ep[3] = sec / 3600;
|
||||
ep[4] = sec % 3600 / 60;
|
||||
ep[3] = static_cast<int>(sec / 3600);
|
||||
ep[4] = sec % static_cast<int>(3600 / 60);
|
||||
ep[5] = sec % 60 + t.sec;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
|
||||
#include "rtklib_sbas.h"
|
||||
#include "rtklib_rtkcmn.h"
|
||||
#include <cmath> // for lround
|
||||
#include <cstring>
|
||||
|
||||
/* extract field from line ---------------------------------------------------*/
|
||||
@ -727,7 +728,7 @@ void readmsgs(const char *file, int sel, gtime_t ts, gtime_t te,
|
||||
sbs->msgs = sbs_msgs;
|
||||
}
|
||||
sbs->msgs[sbs->n].week = week;
|
||||
sbs->msgs[sbs->n].tow = static_cast<int>(tow + 0.5);
|
||||
sbs->msgs[sbs->n].tow = static_cast<int>(std::lround(tow));
|
||||
sbs->msgs[sbs->n].prn = prn;
|
||||
for (i = 0; i < 29; i++)
|
||||
{
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "rtklib_rtkcmn.h"
|
||||
#include "rtklib_rtksvr.h"
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@ -1326,7 +1327,7 @@ int decode_solstat(char *buff, solstat_t *stat)
|
||||
stat->resp = static_cast<float>(resp);
|
||||
stat->resc = static_cast<float>(resc);
|
||||
stat->flag = static_cast<unsigned char>((vsat << 5) + (slip << 3) + fix);
|
||||
stat->snr = static_cast<unsigned char>(snr * 4.0 + 0.5);
|
||||
stat->snr = static_cast<unsigned char>(std::lround(snr * 4.0));
|
||||
stat->lock = static_cast<uint16_t>(lock);
|
||||
stat->outc = static_cast<uint16_t>(outc);
|
||||
stat->slipc = static_cast<uint16_t>(slipc);
|
||||
|
@ -268,10 +268,10 @@ void rtl_tcp_signal_source_c::set_if_gain(int gain)
|
||||
g += r.step;
|
||||
}
|
||||
}
|
||||
for (unsigned stage = 1; stage <= gains.size(); stage++)
|
||||
for (size_t stage = 1; stage <= gains.size(); stage++)
|
||||
{
|
||||
int stage_gain = static_cast<int>(gains[stage] * 10);
|
||||
unsigned param = (stage << 16) | (stage_gain & 0xffff);
|
||||
size_t param = (stage << 16) | (stage_gain & 0xffff);
|
||||
boost::system::error_code ec = rtl_tcp_command(RTL_TCP_SET_IF_GAIN, param, socket_);
|
||||
if (ec)
|
||||
{
|
||||
|
@ -164,7 +164,7 @@ int unpack_2bit_samples::work(int noutput_items,
|
||||
{
|
||||
if (swap_endian_bytes_)
|
||||
{
|
||||
for (unsigned int i = 0; i < ninput_bytes; ++i)
|
||||
for (size_t i = 0; i < ninput_bytes; ++i)
|
||||
{
|
||||
// Read packed input sample (1 byte = 4 samples)
|
||||
raw_byte.byte = in[i];
|
||||
@ -177,7 +177,7 @@ int unpack_2bit_samples::work(int noutput_items,
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < ninput_bytes; ++i)
|
||||
for (size_t i = 0; i < ninput_bytes; ++i)
|
||||
{
|
||||
// Read packed input sample (1 byte = 4 samples)
|
||||
raw_byte.byte = in[i];
|
||||
@ -193,7 +193,7 @@ int unpack_2bit_samples::work(int noutput_items,
|
||||
{
|
||||
if (swap_endian_bytes_)
|
||||
{
|
||||
for (unsigned int i = 0; i < ninput_bytes; ++i)
|
||||
for (size_t i = 0; i < ninput_bytes; ++i)
|
||||
{
|
||||
// Read packed input sample (1 byte = 4 samples)
|
||||
raw_byte.byte = in[i];
|
||||
@ -206,7 +206,7 @@ int unpack_2bit_samples::work(int noutput_items,
|
||||
}
|
||||
else
|
||||
{
|
||||
for (unsigned int i = 0; i < ninput_bytes; ++i)
|
||||
for (size_t i = 0; i < ninput_bytes; ++i)
|
||||
{
|
||||
// Read packed input sample (1 byte = 4 samples)
|
||||
raw_byte.byte = in[i];
|
||||
|
@ -98,14 +98,14 @@ int Gnss_Sdr_Valve::work(int noutput_items,
|
||||
return 0;
|
||||
}
|
||||
// multichannel support
|
||||
for (unsigned int ch = 0; ch < output_items.size(); ch++)
|
||||
for (size_t ch = 0; ch < output_items.size(); ch++)
|
||||
{
|
||||
memcpy(output_items[ch], input_items[ch], n * input_signature()->sizeof_stream_item(ch));
|
||||
}
|
||||
d_ncopied_items += n;
|
||||
return n;
|
||||
}
|
||||
for (unsigned int ch = 0; ch < output_items.size(); ch++)
|
||||
for (size_t ch = 0; ch < output_items.size(); ch++)
|
||||
{
|
||||
memcpy(output_items[ch], input_items[ch], noutput_items * input_signature()->sizeof_stream_item(ch));
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ bool sbas_l1_telemetry_decoder_gs::Sample_Aligner::get_symbols(const std::vector
|
||||
VLOG(FLOW) << "get_symbols(): "
|
||||
<< "d_past_sample=" << d_past_sample << "\tsamples size=" << samples.size();
|
||||
|
||||
for (uint32_t i_sym = 0; i_sym < samples.size() / sbas_l1_telemetry_decoder_gs::D_SAMPLES_PER_SYMBOL; i_sym++)
|
||||
for (size_t i_sym = 0; i_sym < samples.size() / sbas_l1_telemetry_decoder_gs::D_SAMPLES_PER_SYMBOL; i_sym++)
|
||||
{
|
||||
// get the next samples
|
||||
for (int32_t i = 0; i < d_n_smpls_in_history; i++)
|
||||
|
@ -124,7 +124,7 @@ void Bayesian_estimator::update_sequential(const arma::vec& data)
|
||||
arma::vec mu_posterior = (kappa_prior * mu_prior + K * y_mean) / (kappa_prior + K);
|
||||
int kappa_posterior = kappa_prior + K;
|
||||
int nu_posterior = nu_prior + K;
|
||||
arma::mat Psi_posterior = Psi_prior + Psi_N + (kappa_prior * K) / (kappa_prior + K) * (y_mean - mu_prior) * ((y_mean - mu_prior).t());
|
||||
arma::mat Psi_posterior = Psi_prior + Psi_N + (kappa_prior * static_cast<float>(K)) / (kappa_prior + static_cast<float>(K)) * (y_mean - mu_prior) * ((y_mean - mu_prior).t());
|
||||
|
||||
mu_est = mu_posterior;
|
||||
if ((nu_posterior - ny - 1) > 0)
|
||||
@ -163,7 +163,7 @@ void Bayesian_estimator::update_sequential(const arma::vec& data, const arma::ve
|
||||
arma::vec mu_posterior = (kappa_prior_0 * mu_prior_0 + K * y_mean) / (kappa_prior_0 + K);
|
||||
int kappa_posterior = kappa_prior_0 + K;
|
||||
int nu_posterior = nu_prior_0 + K;
|
||||
arma::mat Psi_posterior = Psi_prior_0 + Psi_N + (kappa_prior_0 * K) / (kappa_prior_0 + K) * (y_mean - mu_prior_0) * ((y_mean - mu_prior_0).t());
|
||||
arma::mat Psi_posterior = Psi_prior_0 + Psi_N + (kappa_prior_0 * static_cast<float>(K)) / (kappa_prior_0 + static_cast<float>(K)) * (y_mean - mu_prior_0) * ((y_mean - mu_prior_0).t());
|
||||
|
||||
mu_est = mu_posterior;
|
||||
if ((nu_posterior - ny - 1) > 0)
|
||||
|
@ -108,7 +108,7 @@ void CubatureFilter::predict_sequential(const arma::vec& x_post, const arma::mat
|
||||
arma::vec Xi_post;
|
||||
arma::vec Xi_pred;
|
||||
|
||||
for (uint8_t i = 0; i < np; i++)
|
||||
for (int i = 0; i < np; i++)
|
||||
{
|
||||
Xi_post = Sm_post * (std::sqrt(static_cast<float>(np) / 2.0) * gen_one.col(i)) + x_post;
|
||||
Xi_pred = (*transition_fcn)(Xi_post);
|
||||
@ -151,7 +151,7 @@ void CubatureFilter::update_sequential(const arma::vec& z_upd, const arma::vec&
|
||||
// Propagate and evaluate cubature points
|
||||
arma::vec Xi_pred;
|
||||
arma::vec Zi_pred;
|
||||
for (uint8_t i = 0; i < np; i++)
|
||||
for (int i = 0; i < np; i++)
|
||||
{
|
||||
Xi_pred = Sm_pred * (std::sqrt(static_cast<float>(np) / 2.0) * gen_one.col(i)) + x_pred;
|
||||
Zi_pred = (*measurement_fcn)(Xi_pred);
|
||||
@ -270,7 +270,7 @@ void UnscentedFilter::predict_sequential(const arma::vec& x_post, const arma::ma
|
||||
|
||||
Xi_post.col(0) = x_post;
|
||||
Xi_pred.col(0) = (*transition_fcn)(Xi_post.col(0));
|
||||
for (uint8_t i = 1; i <= nx; i++)
|
||||
for (int i = 1; i <= nx; i++)
|
||||
{
|
||||
Xi_fact = std::sqrt(static_cast<float>(nx) + lambda) * arma::sqrtmat_sympd(P_x_post);
|
||||
Xi_post.col(i) = x_post + Xi_fact.col(i - 1);
|
||||
@ -285,7 +285,7 @@ void UnscentedFilter::predict_sequential(const arma::vec& x_post, const arma::ma
|
||||
|
||||
// Compute predicted error covariance
|
||||
arma::mat P_x_pred = W0_c * ((Xi_pred.col(0) - x_pred) * (Xi_pred.col(0).t() - x_pred.t()));
|
||||
for (uint8_t i = 1; i < np; i++)
|
||||
for (int i = 1; i < np; i++)
|
||||
{
|
||||
P_x_pred = P_x_pred + Wi_m * ((Xi_pred.col(i) - x_pred) * (Xi_pred.col(i).t() - x_pred.t()));
|
||||
}
|
||||
@ -325,7 +325,7 @@ void UnscentedFilter::update_sequential(const arma::vec& z_upd, const arma::vec&
|
||||
|
||||
Xi_pred.col(0) = x_pred;
|
||||
Zi_pred.col(0) = (*measurement_fcn)(Xi_pred.col(0));
|
||||
for (uint8_t i = 1; i <= nx; i++)
|
||||
for (int i = 1; i <= nx; i++)
|
||||
{
|
||||
Xi_fact = std::sqrt(static_cast<float>(nx) + lambda) * arma::sqrtmat_sympd(P_x_pred);
|
||||
Xi_pred.col(i) = x_pred + Xi_fact.col(i - 1);
|
||||
@ -341,7 +341,7 @@ void UnscentedFilter::update_sequential(const arma::vec& z_upd, const arma::vec&
|
||||
// Compute measurement covariance and cross covariance
|
||||
arma::mat P_zz_pred = W0_c * ((Zi_pred.col(0) - z_pred) * (Zi_pred.col(0).t() - z_pred.t()));
|
||||
arma::mat P_xz_pred = W0_c * ((Xi_pred.col(0) - x_pred) * (Zi_pred.col(0).t() - z_pred.t()));
|
||||
for (uint8_t i = 0; i < np; i++)
|
||||
for (int i = 0; i < np; i++)
|
||||
{
|
||||
P_zz_pred = P_zz_pred + Wi_m * ((Zi_pred.col(i) - z_pred) * (Zi_pred.col(i).t() - z_pred.t()));
|
||||
P_xz_pred = P_xz_pred + Wi_m * ((Xi_pred.col(i) - x_pred) * (Zi_pred.col(i).t() - z_pred.t()));
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "tracking_loop_filter.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
|
||||
const int MAX_LOOP_ORDER = 3;
|
||||
const int MAX_LOOP_HISTORY_LENGTH = 4;
|
||||
@ -74,7 +75,7 @@ float Tracking_loop_filter::apply(float current_input)
|
||||
float result = 0.0;
|
||||
|
||||
// Handle the old outputs first:
|
||||
for (unsigned int ii = 0; ii < d_output_coefficients.size(); ++ii)
|
||||
for (size_t ii = 0; ii < d_output_coefficients.size(); ++ii)
|
||||
{
|
||||
result += d_output_coefficients[ii] * d_outputs[(d_current_index + ii) % MAX_LOOP_HISTORY_LENGTH];
|
||||
}
|
||||
@ -94,7 +95,7 @@ float Tracking_loop_filter::apply(float current_input)
|
||||
|
||||
d_inputs[d_current_index] = current_input;
|
||||
|
||||
for (unsigned int ii = 0; ii < d_input_coefficients.size(); ++ii)
|
||||
for (size_t ii = 0; ii < d_input_coefficients.size(); ++ii)
|
||||
{
|
||||
result += d_input_coefficients[ii] * d_inputs[(d_current_index + ii) % MAX_LOOP_HISTORY_LENGTH];
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static char* find_char_or_comment(char* s, char c)
|
||||
/* Version of strncpy that ensures dest (size bytes) is null-terminated. */
|
||||
static char* strncpy0(char* dest, const char* src, size_t size)
|
||||
{
|
||||
for (unsigned int i = 0; i < size - 1; i++)
|
||||
for (size_t i = 0; i < size - 1; i++)
|
||||
{
|
||||
dest[i] = src[i];
|
||||
}
|
||||
@ -169,7 +169,7 @@ int ini_parse(const char* filename,
|
||||
if (*end == ']')
|
||||
{
|
||||
*end = '\0';
|
||||
strncpy0(section.data(), start + 1, sizeof(section));
|
||||
strncpy0(section.data(), start + 1, section.size());
|
||||
prev_name[MAX_NAME - 1] = '\0';
|
||||
}
|
||||
else if (!error)
|
||||
@ -195,7 +195,7 @@ int ini_parse(const char* filename,
|
||||
rstrip(value);
|
||||
|
||||
/* Valid name=value pair found, call handler */
|
||||
strncpy0(prev_name.data(), name, sizeof(prev_name));
|
||||
strncpy0(prev_name.data(), name, prev_name.size());
|
||||
if (!handler(user, section.data(), name, value) && !error)
|
||||
{
|
||||
error = lineno;
|
||||
|
@ -324,7 +324,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
|
||||
size_t max_encoded_len = 1;
|
||||
asn_enc_rval_t erval;
|
||||
int ret;
|
||||
int edx;
|
||||
ssize_t edx;
|
||||
|
||||
ASN_DEBUG("Estimating size for SET OF %s", td->name);
|
||||
|
||||
@ -919,7 +919,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
|
||||
if(nelems < 0) _ASN_DECODE_STARVED;
|
||||
}
|
||||
|
||||
for(i = 0; i < nelems; i++) {
|
||||
for(ssize_t k = 0; k < nelems; k++) {
|
||||
void *ptr = 0;
|
||||
ASN_DEBUG("SET OF %s decoding", elm->type->name);
|
||||
rv = elm->type->uper_decoder(opt_codec_ctx, elm->type,
|
||||
|
@ -324,7 +324,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
|
||||
size_t max_encoded_len = 1;
|
||||
asn_enc_rval_t erval;
|
||||
int ret;
|
||||
int edx;
|
||||
ssize_t edx;
|
||||
|
||||
ASN_DEBUG("Estimating size for SET OF %s", td->name);
|
||||
|
||||
@ -919,7 +919,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
|
||||
if(nelems < 0) _ASN_DECODE_STARVED;
|
||||
}
|
||||
|
||||
for(i = 0; i < nelems; i++) {
|
||||
for(ssize_t k = 0; k < nelems; k++) {
|
||||
void *ptr = 0;
|
||||
ASN_DEBUG("SET OF %s decoding", elm->type->name);
|
||||
rv = elm->type->uper_decoder(opt_codec_ctx, elm->type,
|
||||
|
@ -134,8 +134,8 @@ int EXPORT supl_ulp_send(supl_ctx_t *ctx, supl_ulp_t *pdu)
|
||||
|
||||
int EXPORT supl_ulp_recv(supl_ctx_t *ctx, supl_ulp_t *pdu)
|
||||
{
|
||||
int err;
|
||||
int n;
|
||||
int64_t err;
|
||||
int64_t n;
|
||||
asn_dec_rval_t rval;
|
||||
ULP_PDU_t *length;
|
||||
|
||||
|
@ -155,7 +155,7 @@ void GNSSFlowgraph::connect()
|
||||
}
|
||||
|
||||
// Signal Source > Signal conditioner >
|
||||
for (unsigned int i = 0; i < sig_conditioner_.size(); i++)
|
||||
for (size_t i = 0; i < sig_conditioner_.size(); i++)
|
||||
{
|
||||
if (configuration_->property(sig_conditioner_.at(i)->role() + ".enable_FPGA", false) == false)
|
||||
{
|
||||
@ -984,7 +984,7 @@ void GNSSFlowgraph::disconnect()
|
||||
}
|
||||
|
||||
// Signal Source > Signal conditioner >
|
||||
for (unsigned int i = 0; i < sig_conditioner_.size(); i++)
|
||||
for (size_t i = 0; i < sig_conditioner_.size(); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ std::string TcpCmdInterface::status(const std::vector<std::string> &commandLine
|
||||
struct tm tstruct = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, nullptr};
|
||||
std::array<char, 80> buf1{};
|
||||
tstruct = *gmtime(&UTC_time);
|
||||
strftime(buf1.data(), sizeof(buf1), "%d/%m/%Y %H:%M:%S", &tstruct);
|
||||
strftime(buf1.data(), buf1.size(), "%d/%m/%Y %H:%M:%S", &tstruct);
|
||||
std::string str_time = std::string(buf1.data());
|
||||
str_stream << "- Receiver UTC Time: " << str_time << std::endl;
|
||||
str_stream << std::setprecision(9);
|
||||
|
@ -924,13 +924,13 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
|
||||
}
|
||||
else // we are in the same week than the leap second event
|
||||
{
|
||||
if ((beidoutime_corrected - secondOfLeapSecondEvent) < (2 / 3) * 24 * 60 * 60)
|
||||
if ((beidoutime_corrected - secondOfLeapSecondEvent) < (static_cast<double>(2) / static_cast<double>(3)) * 24 * 60 * 60)
|
||||
{
|
||||
t_utc_daytime = fmod(beidoutime_corrected - Delta_t_UTC, 86400);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((beidoutime_corrected - secondOfLeapSecondEvent) < (5 / 4) * 24 * 60 * 60)
|
||||
if ((beidoutime_corrected - secondOfLeapSecondEvent) < (static_cast<double>(5) / static_cast<double>(4)) * 24 * 60 * 60)
|
||||
{
|
||||
int32_t W = fmod(beidoutime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
|
||||
t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "MATH_CONSTANTS.h" // for TWO_N20, TWO_N30, TWO_N14, TWO_N15, TWO_N18
|
||||
#include "gnss_satellite.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cstddef> // for size_t
|
||||
#include <map>
|
||||
#include <ostream> // for operator<<
|
||||
|
||||
@ -124,7 +125,7 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset<GLONASS_GNAV_STRING_B
|
||||
std::vector<uint32_t> string_bits(GLONASS_GNAV_STRING_BITS);
|
||||
|
||||
// Populate data and hamming code vectors
|
||||
for (uint32_t i = 0; i < string_bits.size(); i++)
|
||||
for (size_t i = 0; i < string_bits.size(); i++)
|
||||
{
|
||||
string_bits[i] = static_cast<uint32_t>(bits[i]);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ int PositionSystemTest::run_receiver()
|
||||
std::cout << "Failed to run command: " << argum2 << std::endl;
|
||||
return -1;
|
||||
}
|
||||
while (fgets(buffer.data(), sizeof(buffer), fp) != nullptr)
|
||||
while (fgets(buffer.data(), buffer.size(), fp) != nullptr)
|
||||
{
|
||||
std::string aux = std::string(buffer.data());
|
||||
EXPECT_EQ(aux.empty(), false);
|
||||
|
@ -73,10 +73,10 @@ DataTypeAdapter::DataTypeAdapter()
|
||||
std::array<int8_t, 6> input_bytes{2, 23, -1, 127, -127, 0};
|
||||
std::array<int16_t, 8> input_shorts{2, 23, -1, 127, -127, 0, 255, 255};
|
||||
|
||||
const std::vector<int8_t> input_data_bytes_(input_bytes.data(), input_bytes.data() + sizeof(input_bytes) / sizeof(int8_t));
|
||||
const std::vector<int8_t> input_data_bytes_(input_bytes.data(), input_bytes.data() + input_bytes.size() / sizeof(int8_t));
|
||||
input_data_bytes = input_data_bytes_;
|
||||
|
||||
const std::vector<int16_t> input_data_shorts_(input_shorts.data(), input_shorts.data() + sizeof(input_shorts) / sizeof(int16_t));
|
||||
const std::vector<int16_t> input_data_shorts_(input_shorts.data(), input_shorts.data() + input_shorts.size() / sizeof(int16_t));
|
||||
input_data_shorts = input_data_shorts_;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ Acquisition_Dump_Reader::Acquisition_Dump_Reader(const std::string& basename,
|
||||
d_num_doppler_bins = 0;
|
||||
num_dwells = 0;
|
||||
|
||||
Acquisition_Dump_Reader(basename,
|
||||
*this = Acquisition_Dump_Reader(basename,
|
||||
sat_,
|
||||
doppler_max_,
|
||||
doppler_step_,
|
||||
|
@ -30,9 +30,12 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include "unpack_2bit_samples.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstddef>
|
||||
|
||||
#ifdef GR_GREATER_38
|
||||
#include <gnuradio/blocks/vector_sink.h>
|
||||
#include <gnuradio/blocks/vector_source.h>
|
||||
@ -41,8 +44,6 @@
|
||||
#include <gnuradio/blocks/vector_source_b.h>
|
||||
#include <gnuradio/blocks/vector_source_s.h>
|
||||
#endif
|
||||
#include "unpack_2bit_samples.h"
|
||||
#include <gnuradio/blocks/stream_to_vector.h>
|
||||
|
||||
std::vector<uint8_t> packData(std::vector<int8_t> const &raw_data,
|
||||
bool big_endian)
|
||||
@ -81,13 +82,13 @@ std::vector<uint8_t> packData(std::vector<int8_t> const &raw_data,
|
||||
return packed_data;
|
||||
}
|
||||
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
{
|
||||
bool big_endian_bytes = true;
|
||||
size_t item_size = 1;
|
||||
bool big_endian_items = false;
|
||||
|
||||
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
std::vector<uint8_t> unpacked_data;
|
||||
@ -97,7 +98,6 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
gr::blocks::vector_source_b::sptr source =
|
||||
gr::blocks::vector_source_b::make(packed_data);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
@ -109,7 +109,6 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
@ -121,19 +120,19 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianByte)
|
||||
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
for (size_t i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
{
|
||||
bool big_endian_bytes = false;
|
||||
size_t item_size = 1;
|
||||
bool big_endian_items = false;
|
||||
|
||||
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
std::vector<uint8_t> unpacked_data;
|
||||
@ -143,7 +142,6 @@ TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
gr::blocks::vector_source_b::sptr source =
|
||||
gr::blocks::vector_source_b::make(packed_data);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
@ -155,7 +153,6 @@ TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
@ -167,23 +164,23 @@ TEST(Unpack2bitSamplesTest, CheckLittleEndianByte)
|
||||
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
for (size_t i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
{
|
||||
bool big_endian_bytes = true;
|
||||
size_t item_size = 2;
|
||||
bool big_endian_items = true;
|
||||
|
||||
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
// change the order of each pair of bytes:
|
||||
for (unsigned int ii = 0; ii < packed_data.size(); ii += item_size)
|
||||
for (size_t ii = 0; ii < packed_data.size(); ii += item_size)
|
||||
{
|
||||
unsigned int kk = ii + item_size - 1;
|
||||
unsigned int jj = ii;
|
||||
@ -209,7 +206,6 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
gr::blocks::vector_source_s::sptr source =
|
||||
gr::blocks::vector_source_s::make(packed_data_short);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
@ -221,7 +217,6 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
@ -233,23 +228,23 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortBigEndianByte)
|
||||
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
for (size_t i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
{
|
||||
bool big_endian_bytes = false;
|
||||
size_t item_size = 2;
|
||||
bool big_endian_items = true;
|
||||
|
||||
|
||||
std::vector<int8_t> raw_data = {-1, 3, 1, -1, -3, 1, 3, 1};
|
||||
std::vector<uint8_t> packed_data = packData(raw_data, big_endian_bytes);
|
||||
// change the order of each pair of bytes:
|
||||
for (unsigned int ii = 0; ii < packed_data.size(); ii += item_size)
|
||||
for (size_t ii = 0; ii < packed_data.size(); ii += item_size)
|
||||
{
|
||||
unsigned int kk = ii + item_size - 1;
|
||||
unsigned int jj = ii;
|
||||
@ -275,7 +270,6 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
gr::blocks::vector_source_s::sptr source =
|
||||
gr::blocks::vector_source_s::make(packed_data_short);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> unpacker =
|
||||
make_unpack_2bit_samples(big_endian_bytes,
|
||||
item_size,
|
||||
@ -287,7 +281,6 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
gr::blocks::vector_sink_b::sptr sink =
|
||||
gr::blocks::vector_sink_b::make(raw_data.size());
|
||||
|
||||
|
||||
top_block->connect(source, 0, unpacker, 0);
|
||||
top_block->connect(unpacker, 0, stov, 0);
|
||||
top_block->connect(stov, 0, sink, 0);
|
||||
@ -299,7 +292,7 @@ TEST(Unpack2bitSamplesTest, CheckBigEndianShortLittleEndianByte)
|
||||
|
||||
EXPECT_EQ(raw_data.size(), unpacked_data.size());
|
||||
|
||||
for (unsigned int i = 0; i < raw_data.size(); ++i)
|
||||
for (size_t i = 0; i < raw_data.size(); ++i)
|
||||
{
|
||||
EXPECT_EQ(raw_data[i], static_cast<int8_t>(unpacked_data[i]));
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "tracking_loop_filter.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstddef>
|
||||
|
||||
TEST(TrackingLoopFilterTest, FirstOrderLoop)
|
||||
{
|
||||
@ -87,7 +88,7 @@ TEST(TrackingLoopFilterTest, FirstOrderLoopWithLastIntegrator)
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
for (size_t i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
@ -118,7 +119,7 @@ TEST(TrackingLoopFilterTest, SecondOrderLoop)
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
for (size_t i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
@ -149,7 +150,7 @@ TEST(TrackingLoopFilterTest, SecondOrderLoopWithLastIntegrator)
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
for (size_t i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
@ -180,7 +181,7 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoop)
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
for (size_t i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
@ -211,7 +212,7 @@ TEST(TrackingLoopFilterTest, ThirdOrderLoopWithLastIntegrator)
|
||||
theFilter.initialize(0.0);
|
||||
|
||||
float result = 0.0;
|
||||
for (unsigned int i = 0; i < sample_data.size(); ++i)
|
||||
for (size_t i = 0; i < sample_data.size(); ++i)
|
||||
{
|
||||
result = theFilter.apply(sample_data[i]);
|
||||
EXPECT_NEAR(result, expected_out[i], 1e-4);
|
||||
|
@ -329,8 +329,8 @@ double FrontEndCal::estimate_doppler_from_eph(unsigned int PRN, double TOW, doub
|
||||
arma::vec SV_pos_ecef = "0.0 0.0 0.0 0.0";
|
||||
double obs_time_start;
|
||||
double obs_time_stop;
|
||||
obs_time_start = TOW - num_secs / 2;
|
||||
obs_time_stop = TOW + num_secs / 2;
|
||||
obs_time_start = TOW - static_cast<double>(num_secs) / 2.0;
|
||||
obs_time_stop = TOW + static_cast<double>(num_secs) / 2.0;
|
||||
int n_points = round((obs_time_stop - obs_time_start) / step_secs);
|
||||
arma::vec ranges = arma::zeros(n_points, 1);
|
||||
double obs_time = obs_time_start;
|
||||
|
Loading…
Reference in New Issue
Block a user