1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Fix shadowed variables

This commit is contained in:
Carles Fernandez 2020-02-26 18:16:04 +01:00
parent 57517b44dd
commit 538c1e6182
18 changed files with 77 additions and 89 deletions

View File

@ -1673,7 +1673,7 @@ int32_t Rtcm::read_MT1019(const std::string& message, Gps_Ephemeris& gps_eph)
gps_eph.d_Cuc = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_UC_LSB;
index += 16;
gps_eph.d_e_eccentricity = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 32))) * E_LSB;
gps_eph.d_e_eccentricity = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 32))) * ECCENTRICITY_LSB;
index += 32;
gps_eph.d_Cus = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_US_LSB;
@ -4372,7 +4372,7 @@ int32_t Rtcm::set_DF089(const Gps_Ephemeris& gps_eph)
int32_t Rtcm::set_DF090(const Gps_Ephemeris& gps_eph)
{
auto ecc = static_cast<uint64_t>(std::round(gps_eph.d_e_eccentricity / E_LSB));
auto ecc = static_cast<uint64_t>(std::round(gps_eph.d_e_eccentricity / ECCENTRICITY_LSB));
DF090 = std::bitset<32>(ecc);
return 0;
}

View File

@ -120,7 +120,7 @@ serial_t *openserial(const char *path, int mode, char *msg)
std::string s_aux = "/dev/" + std::string(port);
s_aux.resize(128, '\0');
int n = s_aux.length();
for (int i = 0; i < n; i++)
for (i = 0; i < n; i++)
{
dev[i] = s_aux[i];
}
@ -695,7 +695,7 @@ void syncfile(file_t *file1, file_t *file2)
void decodetcppath(const char *path, char *addr, char *port, char *user,
char *passwd, char *mntpnt, char *str)
{
char buff[MAXSTRPATH];
char buff[MAXSTRPATH] = "";
char *p;
char *q;
@ -1556,7 +1556,7 @@ int rspntrip_s(ntrip_t *ntrip, char *msg)
// strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by;
std::string s_aux(reinterpret_cast<char *>(ntrip->buff));
s_aux.resize(nb, '\0');
for (int i = 0; i < nb; i++)
for (i = 0; i < nb; i++)
{
msg[i] = s_aux[i];
}
@ -1815,7 +1815,7 @@ int statentrip(ntrip_t *ntrip)
void decodeftppath(const char *path, char *addr, char *file, char *user,
char *passwd, int *topts)
{
char buff[MAXSTRPATH];
char buff[MAXSTRPATH] = "";
char *p;
char *q;
@ -2006,9 +2006,9 @@ void *ftpthread(void *arg)
/* download command (ref [2]) */
if (ftp->proto == 0)
{ /* ftp */
std::string s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) +
" --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) +
" -O \"" + std::string(local) + "\"";
s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) +
" --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) +
" -O \"" + std::string(local) + "\"";
int k = s_aux.length();
if (k < 1024)
{
@ -2018,8 +2018,8 @@ void *ftpthread(void *arg)
}
}
std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
k = s_aux2.length();
for (int i = 0; (i < k) && (i < 1024); i++)
{
@ -2028,15 +2028,15 @@ void *ftpthread(void *arg)
}
else
{ /* http */
std::string s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\"";
s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\"";
int l = s_aux.length();
for (int i = 0; (i < l) && (i < 1024); i++)
{
opt[i] = s_aux[i];
}
std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " +
"\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n";
l = s_aux2.length();
for (int i = 0; (i < l) && (i < 1024); i++)
{
@ -2680,15 +2680,15 @@ void strsetopt(const int *opt)
/* set timeout time ------------------------------------------------------------
* set timeout time
* args : stream_t *stream I stream (STR_TCPCLI, STR_NTRIPCLI, STR_NTRIPSVR)
* int toinact I inactive timeout (ms) (0: no timeout)
* int inactive_timeout I inactive timeout (ms) (0: no timeout)
* int tirecon I reconnect interval (ms) (0: no reconnect)
* return : none
*-----------------------------------------------------------------------------*/
void strsettimeout(stream_t *stream, int toinact, int tirecon)
void strsettimeout(stream_t *stream, int inactive_timeout, int tirecon)
{
tcpcli_t *tcpcli;
tracet(3, "strsettimeout: toinact=%d tirecon=%d\n", toinact, tirecon);
tracet(3, "strsettimeout: toinact=%d tirecon=%d\n", inactive_timeout, tirecon);
if (stream->type == STR_TCPCLI)
{
@ -2703,7 +2703,7 @@ void strsettimeout(stream_t *stream, int toinact, int tirecon)
return;
}
tcpcli->toinact = toinact;
tcpcli->toinact = inactive_timeout;
tcpcli->tirecon = tirecon;
}

View File

@ -133,8 +133,6 @@ void signal_generator_c::init()
}
}
}
std::uniform_int_distribution<int> uniform_dist(0, RAND_MAX);
}

View File

@ -579,20 +579,14 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
d_page_part_symbols[i] = d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
d_page_part_symbols[i] = d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
}
else // 180 deg. inverted carrier phase PLL lock
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
for (uint32_t i = 0; i < d_frame_length_symbols; i++)
{
d_page_part_symbols[i] = -d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
d_page_part_symbols[i] = -d_symbol_history[i + d_samples_per_preamble]; // because last symbol of the preamble is just received now!
}
}
decode_FNAV_word(d_page_part_symbols.data(), d_frame_length_symbols);

View File

@ -442,12 +442,12 @@ Viterbi_Decoder::Prev::Prev(int states, int t)
this->t = t;
num_states = states;
state.reserve(num_states);
bit.reserve(num_states);
metric.reserve(num_states);
v_bit.reserve(num_states);
v_metric.reserve(num_states);
refcount = 1;
std::fill_n(state.begin(), num_states, 0);
std::fill_n(bit.begin(), num_states, 0);
std::fill_n(metric.begin(), num_states, 0.0F);
std::fill_n(v_bit.begin(), num_states, 0);
std::fill_n(v_metric.begin(), num_states, 0.0F);
}
@ -459,8 +459,8 @@ Viterbi_Decoder::Prev::Prev(const Prev& prev)
t = prev.t;
state = prev.state;
num_states = prev.num_states;
bit = prev.bit;
metric = prev.metric;
v_bit = prev.v_bit;
v_metric = prev.v_metric;
VLOG(LMORE) << "Prev("
<< "?"
<< ", " << t << ")"
@ -490,8 +490,8 @@ Viterbi_Decoder::Prev& Viterbi_Decoder::Prev::operator=(const Prev& other)
// take over resources
t = other.t;
state = other.state;
bit = other.bit;
metric = other.metric;
v_bit = other.v_bit;
v_metric = other.v_metric;
VLOG(LMORE) << "Prev("
<< "?"
@ -532,7 +532,7 @@ int Viterbi_Decoder::Prev::get_bit_of_current_state(int current_state)
// std::cout << "get prev bit : for state " << current_state << " at time " << t << ", the send bit is " << bit[current_state] << std::endl;
if (num_states > current_state)
{
return bit[current_state];
return v_bit[current_state];
}
return 0;
}
@ -542,7 +542,7 @@ float Viterbi_Decoder::Prev::get_metric_of_current_state(int current_state)
{
if (num_states > current_state)
{
return metric[current_state];
return v_metric[current_state];
}
return 0;
}
@ -567,7 +567,7 @@ void Viterbi_Decoder::Prev::set_decoded_bit_for_next_state(int next_state, int b
{
if (num_states > next_state)
{
this->bit[next_state] = bit;
this->v_bit[next_state] = bit;
}
}
@ -576,6 +576,6 @@ void Viterbi_Decoder::Prev::set_survivor_branch_metric_of_next_state(int next_st
{
if (num_states > next_state)
{
this->metric[next_state] = metric;
this->v_metric[next_state] = metric;
}
}

View File

@ -69,8 +69,8 @@ private:
private:
int t;
std::vector<int> state;
std::vector<int> bit;
std::vector<float> metric;
std::vector<int> v_bit;
std::vector<float> v_metric;
int refcount;
};

View File

@ -313,7 +313,7 @@ void Gnss_Sdr_Supl_Client::read_supl_data()
gps_eph_iterator->second.d_Delta_n = static_cast<double>(e->delta_n) * DELTA_N_LSB;
gps_eph_iterator->second.d_M_0 = static_cast<double>(e->M0) * M_0_LSB;
gps_eph_iterator->second.d_Cuc = static_cast<double>(e->Cuc) * C_UC_LSB;
gps_eph_iterator->second.d_e_eccentricity = static_cast<double>(e->e) * E_LSB;
gps_eph_iterator->second.d_e_eccentricity = static_cast<double>(e->e) * ECCENTRICITY_LSB;
gps_eph_iterator->second.d_Cus = static_cast<double>(e->Cus) * C_US_LSB;
gps_eph_iterator->second.d_sqrt_A = static_cast<double>(e->A_sqrt) * SQRT_A_LSB;
gps_eph_iterator->second.d_Toe = static_cast<double>(e->toe) * T_OE_LSB;

View File

@ -50,7 +50,6 @@ private:
boost::asio::ip::udp::socket socket;
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
std::vector<Gnss_Synchro> stocks;
Serdes_Gnss_Synchro serdes;
bool use_protobuf;
};

View File

@ -431,7 +431,7 @@ void GNSSFlowgraph::connect()
{
decimation--;
};
double acq_fs = static_cast<double>(fs) / static_cast<double>(decimation);
double acq_fs_decimated = static_cast<double>(fs) / static_cast<double>(decimation);
if (decimation > 1)
{
@ -455,8 +455,8 @@ void GNSSFlowgraph::connect()
taps = gr::filter::firdes::low_pass(1.0,
fs,
acq_fs / 2.1,
acq_fs / 2,
acq_fs_decimated / 2.1,
acq_fs_decimated / 2,
gr::filter::firdes::win_type::WIN_HAMMING);
gr::basic_block_sptr fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(decimation, taps);
@ -1361,8 +1361,8 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
if (channels_state_[n] == 1 or channels_state_[n] == 2) // channel in acquisition or in tracking
{
// recover the satellite assigned
Gnss_Signal gs = channels_[n]->get_signal();
push_back_signal(gs);
Gnss_Signal gs_assigned = channels_[n]->get_signal();
push_back_signal(gs_assigned);
channels_[n]->stop_channel(); // stop the acquisition or tracking operation
channels_state_[n] = 0;
@ -1950,7 +1950,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal
// 1. Get the current channel status map
std::map<int, std::shared_ptr<Gnss_Synchro>> current_channels_status = channels_status_->get_current_status_map();
// 2. search the currently tracked GPS L1 satellites and assist the GPS L2 acquisition if the satellite is not tracked on L2
bool found_signal = false;
for (auto& current_status : current_channels_status)
{
if (std::string(current_status.second->Signal) == "1C")

View File

@ -127,8 +127,8 @@ const std::vector<std::pair<int32_t, int32_t>> M_0({{107, 8}, {121, 24}});
const double M_0_LSB = PI_TWO_N31;
const std::vector<std::pair<int32_t, int32_t>> C_UC({{151, 16}});
const double C_UC_LSB = TWO_N29;
const std::vector<std::pair<int32_t, int32_t>> E({{167, 8}, {181, 24}});
const double E_LSB = TWO_N33;
const std::vector<std::pair<int32_t, int32_t>> ECCENTRICITY({{167, 8}, {181, 24}});
const double ECCENTRICITY_LSB = TWO_N33;
const std::vector<std::pair<int32_t, int32_t>> C_US({{211, 16}});
const double C_US_LSB = TWO_N29;
const std::vector<std::pair<int32_t, int32_t>> SQRT_A({{227, 8}, {241, 24}});

View File

@ -33,7 +33,6 @@ using CRC_Galileo_INAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false
void Galileo_Navigation_Message::reset()
{
flag_even_word = 0;
Page_type_time_stamp = 0;
flag_CRC_test = false;

View File

@ -45,7 +45,6 @@ public:
Galileo_Navigation_Message();
int32_t Page_type_time_stamp;
int32_t flag_even_word;
std::string page_Even;
bool flag_CRC_test;
bool flag_all_ephemeris; //!< Flag indicating that all words containing ephemeris have been received

View File

@ -290,8 +290,8 @@ int32_t Gps_Navigation_Message::subframe_decoder(char* subframe)
d_M_0 = d_M_0 * M_0_LSB;
d_Cuc = static_cast<double>(read_navigation_signed(subframe_bits, C_UC));
d_Cuc = d_Cuc * C_UC_LSB;
d_e_eccentricity = static_cast<double>(read_navigation_unsigned(subframe_bits, E));
d_e_eccentricity = d_e_eccentricity * E_LSB;
d_e_eccentricity = static_cast<double>(read_navigation_unsigned(subframe_bits, ECCENTRICITY));
d_e_eccentricity = d_e_eccentricity * ECCENTRICITY_LSB;
d_Cus = static_cast<double>(read_navigation_signed(subframe_bits, C_US));
d_Cus = d_Cus * C_US_LSB;
d_sqrt_A = static_cast<double>(read_navigation_unsigned(subframe_bits, SQRT_A));

View File

@ -489,11 +489,11 @@ void PositionSystemTest::check_results()
Rtklib_Solver_Dump_Reader pvt_reader;
pvt_reader.open_obs_file(FLAGS_pvt_solver_dump_filename);
int64_t n_epochs = pvt_reader.num_epochs();
R_eb_e = arma::zeros(3, n_epochs);
V_eb_e = arma::zeros(3, n_epochs);
LLH = arma::zeros(3, n_epochs);
receiver_time_s = arma::zeros(n_epochs, 1);
int64_t n_epochs_pvt = pvt_reader.num_epochs();
R_eb_e = arma::zeros(3, n_epochs_pvt);
V_eb_e = arma::zeros(3, n_epochs_pvt);
LLH = arma::zeros(3, n_epochs_pvt);
receiver_time_s = arma::zeros(n_epochs_pvt, 1);
int64_t current_epoch = 0;
while (pvt_reader.read_binary_obs())
{
@ -620,25 +620,25 @@ void PositionSystemTest::check_results()
// dynamic position
Spirent_Motion_Csv_Dump_Reader ref_reader;
ref_reader.open_obs_file(FLAGS_ref_motion_filename);
int64_t n_epochs = ref_reader.num_epochs();
ref_R_eb_e = arma::zeros(3, n_epochs);
ref_V_eb_e = arma::zeros(3, n_epochs);
ref_LLH = arma::zeros(3, n_epochs);
ref_time_s = arma::zeros(n_epochs, 1);
int64_t current_epoch = 0;
int64_t n_epochs_ref = ref_reader.num_epochs();
ref_R_eb_e = arma::zeros(3, n_epochs_ref);
ref_V_eb_e = arma::zeros(3, n_epochs_ref);
ref_LLH = arma::zeros(3, n_epochs_ref);
ref_time_s = arma::zeros(n_epochs_ref, 1);
int64_t current_epoch_index = 0;
while (ref_reader.read_csv_obs())
{
ref_time_s(current_epoch) = ref_reader.TOW_ms / 1000.0;
ref_R_eb_e(0, current_epoch) = ref_reader.Pos_X;
ref_R_eb_e(1, current_epoch) = ref_reader.Pos_Y;
ref_R_eb_e(2, current_epoch) = ref_reader.Pos_Z;
ref_V_eb_e(0, current_epoch) = ref_reader.Vel_X;
ref_V_eb_e(1, current_epoch) = ref_reader.Vel_Y;
ref_V_eb_e(2, current_epoch) = ref_reader.Vel_Z;
ref_LLH(0, current_epoch) = ref_reader.Lat;
ref_LLH(1, current_epoch) = ref_reader.Long;
ref_LLH(2, current_epoch) = ref_reader.Height;
current_epoch++;
ref_time_s(current_epoch_index) = ref_reader.TOW_ms / 1000.0;
ref_R_eb_e(0, current_epoch_index) = ref_reader.Pos_X;
ref_R_eb_e(1, current_epoch_index) = ref_reader.Pos_Y;
ref_R_eb_e(2, current_epoch_index) = ref_reader.Pos_Z;
ref_V_eb_e(0, current_epoch_index) = ref_reader.Vel_X;
ref_V_eb_e(1, current_epoch_index) = ref_reader.Vel_Y;
ref_V_eb_e(2, current_epoch_index) = ref_reader.Vel_Z;
ref_LLH(0, current_epoch_index) = ref_reader.Lat;
ref_LLH(1, current_epoch_index) = ref_reader.Long;
ref_LLH(2, current_epoch_index) = ref_reader.Height;
current_epoch_index++;
}
// interpolation of reference data to receiver epochs timestamps
arma::mat ref_interp_R_eb_e = arma::zeros(3, R_eb_e.n_cols);

View File

@ -152,18 +152,18 @@ TEST(MatioTest, WriteAndReadGrComplex)
auto *x_read_real = reinterpret_cast<float *>(x_read_st->Re);
auto *x_read_imag = reinterpret_cast<float *>(x_read_st->Im);
std::vector<gr_complex> x_v_read;
for (unsigned int i = 0; i < size; i++)
for (unsigned int k = 0; k < size; k++)
{
x_v_read.emplace_back(x_read_real[i], x_read_imag[i]);
x_v_read.emplace_back(x_read_real[k], x_read_imag[k]);
}
Mat_Close(matfp_read);
Mat_VarFree(matvar_read);
for (unsigned int i = 0; i < size; i++)
for (unsigned int k = 0; k < size; k++)
{
EXPECT_FLOAT_EQ(x_v[i].real(), x_v_read[i].real());
EXPECT_FLOAT_EQ(x_v[i].imag(), x_v_read[i].imag());
EXPECT_FLOAT_EQ(x_v[k].real(), x_v_read[k].real());
EXPECT_FLOAT_EQ(x_v[k].imag(), x_v_read[k].imag());
}
errorlib::error_code ec;
ASSERT_EQ(fs::remove(fs::path(filename), ec), true);

View File

@ -251,14 +251,14 @@ TEST(RtcmTest, MT1019)
gps_eph.i_satellite_PRN = 3;
gps_eph.d_IODC = 4;
gps_eph.d_e_eccentricity = 2.0 * E_LSB;
gps_eph.d_e_eccentricity = 2.0 * ECCENTRICITY_LSB;
gps_eph.b_fit_interval_flag = true;
std::string tx_msg = rtcm->print_MT1019(gps_eph);
EXPECT_EQ(0, rtcm->read_MT1019(tx_msg, gps_eph_read));
EXPECT_EQ(static_cast<unsigned int>(3), gps_eph_read.i_satellite_PRN);
EXPECT_DOUBLE_EQ(4, gps_eph_read.d_IODC);
EXPECT_DOUBLE_EQ(2.0 * E_LSB, gps_eph_read.d_e_eccentricity);
EXPECT_DOUBLE_EQ(2.0 * ECCENTRICITY_LSB, gps_eph_read.d_e_eccentricity);
EXPECT_EQ(expected_true, gps_eph_read.b_fit_interval_flag);
EXPECT_EQ(1, rtcm->read_MT1019(rtcm->bin_to_binary_data(rtcm->hex_to_bin("FFFFFFFFFFF")), gps_eph_read));
}

View File

@ -293,7 +293,7 @@ arma::vec FrontEndCal::geodetic2ecef(double phi, double lambda, double h, const
}
double FrontEndCal::estimate_doppler_from_eph(unsigned int PRN, double TOW, double lat, double lon, double height) noexcept(false)
double FrontEndCal::estimate_doppler_from_eph(unsigned int PRN, double tow, double lat, double lon, double height) noexcept(false)
{
int num_secs = 10;
double step_secs = 0.5;
@ -318,8 +318,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 - static_cast<double>(num_secs) / 2.0;
obs_time_stop = TOW + static_cast<double>(num_secs) / 2.0;
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;

View File

@ -54,7 +54,7 @@ public:
* 3- Approximate receiver Latitude and Longitude (WGS-84)
*
*/
double estimate_doppler_from_eph(unsigned int PRN, double TOW, double lat, double lon, double height) noexcept(false);
double estimate_doppler_from_eph(unsigned int PRN, double tow, double lat, double lon, double height) noexcept(false);
/*!
* \brief This function models the Elonics E4000 + RTL2832 front-end