mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-05-20 16:24:10 +00:00
Fix member initializations, potential data race conditions, and minor performance issues detected by Coverity Scan
Never throw from main
This commit is contained in:
parent
d8fabdb4ac
commit
4916c6c8e8
@ -5651,7 +5651,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int32_t, Gal
|
|||||||
|
|
||||||
std::string E1B_DVS = std::to_string(galileo_ephemeris_iter->second.E1B_DVS);
|
std::string E1B_DVS = std::to_string(galileo_ephemeris_iter->second.E1B_DVS);
|
||||||
|
|
||||||
std::string SVhealth_str = std::move(E5B_HS) + std::to_string(galileo_ephemeris_iter->second.E5b_DVS) + "11" + "1" + std::string(E1B_DVS) + std::string(E1B_HS) + std::to_string(galileo_ephemeris_iter->second.E1B_DVS);
|
std::string SVhealth_str = std::move(E5B_HS) + std::to_string(galileo_ephemeris_iter->second.E5b_DVS) + "11" + "1" + std::move(E1B_DVS) + std::move(E1B_HS) + std::to_string(galileo_ephemeris_iter->second.E1B_DVS);
|
||||||
int32_t SVhealth = Rinex_Printer::toInt(SVhealth_str, 9);
|
int32_t SVhealth = Rinex_Printer::toInt(SVhealth_str, 9);
|
||||||
line += Rinex_Printer::doub2for(static_cast<double>(SVhealth), 18, 2);
|
line += Rinex_Printer::doub2for(static_cast<double>(SVhealth), 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include <cstdint> // for uint32_t
|
#include <cstdint> // for uint32_t
|
||||||
#include <memory> // for shared_ptr
|
#include <memory> // for shared_ptr
|
||||||
#include <string> // for string
|
#include <string> // for string
|
||||||
|
#include <utility> // for move
|
||||||
|
|
||||||
/** \addtogroup Acquisition
|
/** \addtogroup Acquisition
|
||||||
* \{ */
|
* \{ */
|
||||||
@ -118,7 +119,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm)
|
inline void set_channel_fsm(std::weak_ptr<ChannelFsm> channel_fsm)
|
||||||
{
|
{
|
||||||
d_channel_fsm = channel_fsm;
|
d_channel_fsm = std::move(channel_fsm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration,
|
void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration,
|
||||||
const std::string &role, uint32_t sel_queue_fpga, uint32_t blk_exp, uint32_t downsampling_factor_default, double chip_rate, double code_length_chips)
|
const std::string &role, uint32_t sel_queue_fpga, uint32_t blk_exp, uint32_t downsampling_factor_default, double chip_rate, double code_length_chips)
|
||||||
@ -58,7 +59,7 @@ void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configura
|
|||||||
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
|
std::cout << "Cannot find the FPGA uio device file corresponding to device name " << acquisition_device_name << std::endl;
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
}
|
}
|
||||||
device_name = device_io_name;
|
device_name = std::move(device_io_name);
|
||||||
|
|
||||||
// exclusion limit
|
// exclusion limit
|
||||||
excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / chip_rate) * static_cast<float>(fs_in)));
|
excludelimit = static_cast<unsigned int>(1 + ceil((1.0 / chip_rate) * static_cast<float>(fs_in)));
|
||||||
|
@ -450,7 +450,7 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (setup_filter(filter_source_, bandwidth_, sample_rate_, freq1_, rf_port_select_, ad9361_phy_B, rx_chan1, chn, 0, filter_filename_, Fpass_, Fstop_) == -1)
|
if (setup_filter(filter_source_, bandwidth_, sample_rate_, freq1_, rf_port_select_, ad9361_phy_B, rx_chan1, chn, 0, std::move(filter_filename_), Fpass_, Fstop_) == -1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -472,7 +472,7 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
|
|||||||
std::cout << rx_stream_dev_a << " channel 1 not found\n";
|
std::cout << rx_stream_dev_a << " channel 1 not found\n";
|
||||||
throw std::runtime_error(rx_stream_dev_a + "RX channel 1 not found");
|
throw std::runtime_error(rx_stream_dev_a + "RX channel 1 not found");
|
||||||
}
|
}
|
||||||
if (setup_filter(filter_source_, bandwidth_, sample_rate_, freq0_, rf_port_select_, ad9361_phy, rx_chan1, chn, 1, filter_filename_, Fpass_, Fstop_) == -1)
|
if (setup_filter(filter_source_, bandwidth_, sample_rate_, freq0_, rf_port_select_, ad9361_phy, rx_chan1, chn, 1, std::move(filter_filename_), Fpass_, Fstop_) == -1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,12 @@
|
|||||||
Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band)
|
Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band)
|
||||||
: d_enable_rx1_band(enable_rx1_band), d_enable_rx2_band(enable_rx2_band)
|
: d_enable_rx1_band(enable_rx1_band), d_enable_rx2_band(enable_rx2_band)
|
||||||
{
|
{
|
||||||
|
d_map_base_freq_band_1 = nullptr;
|
||||||
|
d_map_base_freq_band_2 = nullptr;
|
||||||
|
d_dev_descr_freq_band_1 = 0;
|
||||||
|
d_dev_descr_freq_band_2 = 0;
|
||||||
|
d_shift_out_bits_freq_band_1 = 0;
|
||||||
|
d_shift_out_bits_freq_band_2 = 0;
|
||||||
if (d_enable_rx1_band)
|
if (d_enable_rx1_band)
|
||||||
{
|
{
|
||||||
open_device(&d_map_base_freq_band_1, d_dev_descr_freq_band_1, 0);
|
open_device(&d_map_base_freq_band_1, d_dev_descr_freq_band_1, 0);
|
||||||
@ -41,7 +47,7 @@ Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, boo
|
|||||||
{
|
{
|
||||||
open_device(&d_map_base_freq_band_2, d_dev_descr_freq_band_2, 1);
|
open_device(&d_map_base_freq_band_2, d_dev_descr_freq_band_2, 1);
|
||||||
|
|
||||||
// init bit selection corresponding to frequency band 1
|
// init bit selection corresponding to frequency band 2
|
||||||
d_shift_out_bits_freq_band_2 = shift_out_bits_default;
|
d_shift_out_bits_freq_band_2 = shift_out_bits_default;
|
||||||
d_map_base_freq_band_2[0] = d_shift_out_bits_freq_band_2;
|
d_map_base_freq_band_2[0] = d_shift_out_bits_freq_band_2;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
|
|||||||
{
|
{
|
||||||
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
|
std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1);
|
||||||
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
|
dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/'));
|
||||||
d_dump_filename = dump_filename_;
|
d_dump_filename = std::move(dump_filename_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1383,6 +1383,7 @@ void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
|
|||||||
d_acquisition_gnss_synchro = p_gnss_synchro;
|
d_acquisition_gnss_synchro = p_gnss_synchro;
|
||||||
if (p_gnss_synchro->PRN > 0)
|
if (p_gnss_synchro->PRN > 0)
|
||||||
{
|
{
|
||||||
|
gr::thread::scoped_lock lock(d_setlock);
|
||||||
// A set_gnss_synchro command with a valid PRN is received when the system is going to run acquisition with that PRN.
|
// A set_gnss_synchro command with a valid PRN is received when the system is going to run acquisition with that PRN.
|
||||||
// We can use this command to pre-initialize tracking parameters and variables before the actual acquisition process takes place.
|
// We can use this command to pre-initialize tracking parameters and variables before the actual acquisition process takes place.
|
||||||
// In this way we minimize the latency between acquisition and tracking once the acquisition has been made.
|
// In this way we minimize the latency between acquisition and tracking once the acquisition has been made.
|
||||||
@ -1527,8 +1528,8 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
|
|||||||
{
|
{
|
||||||
case 1: // Pull-in
|
case 1: // Pull-in
|
||||||
{
|
{
|
||||||
d_worker_is_done = false;
|
|
||||||
boost::mutex::scoped_lock lock(d_mutex);
|
boost::mutex::scoped_lock lock(d_mutex);
|
||||||
|
d_worker_is_done = false;
|
||||||
while (!d_worker_is_done)
|
while (!d_worker_is_done)
|
||||||
{
|
{
|
||||||
d_m_condition.wait(lock);
|
d_m_condition.wait(lock);
|
||||||
|
@ -308,10 +308,6 @@ void Gps_L1_Ca_Gaussian_Tracking_cc::start_tracking()
|
|||||||
|
|
||||||
sys = std::string(1, d_acquisition_gnss_synchro->System);
|
sys = std::string(1, d_acquisition_gnss_synchro->System);
|
||||||
|
|
||||||
// DEBUG OUTPUT
|
|
||||||
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';
|
|
||||||
LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
|
|
||||||
|
|
||||||
// enable tracking
|
// enable tracking
|
||||||
d_pull_in = true;
|
d_pull_in = true;
|
||||||
d_enable_tracking = true;
|
d_enable_tracking = true;
|
||||||
@ -319,6 +315,10 @@ void Gps_L1_Ca_Gaussian_Tracking_cc::start_tracking()
|
|||||||
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
|
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
|
||||||
<< " Code Phase correction [samples]=" << delay_correction_samples
|
<< " Code Phase correction [samples]=" << delay_correction_samples
|
||||||
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
|
||||||
|
|
||||||
|
gr::thread::scoped_lock l(d_setlock);
|
||||||
|
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';
|
||||||
|
LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -776,6 +776,7 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail)
|
if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail)
|
||||||
{
|
{
|
||||||
|
gr::thread::scoped_lock l(d_setlock);
|
||||||
std::cout << "Loss of lock in channel " << d_channel << "!\n";
|
std::cout << "Loss of lock in channel " << d_channel << "!\n";
|
||||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||||
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
|
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
|
||||||
|
@ -57,20 +57,26 @@ Fpga_Multicorrelator_8sc::Fpga_Multicorrelator_8sc(int32_t n_correlators,
|
|||||||
d_Prompt_Data(nullptr),
|
d_Prompt_Data(nullptr),
|
||||||
d_shifts_chips(nullptr),
|
d_shifts_chips(nullptr),
|
||||||
d_prompt_data_shift(nullptr),
|
d_prompt_data_shift(nullptr),
|
||||||
d_rem_code_phase_chips(0),
|
d_rem_code_phase_chips(0.0),
|
||||||
d_code_phase_step_chips(0),
|
d_code_phase_step_chips(0.0),
|
||||||
d_rem_carrier_phase_in_rad(0),
|
d_code_phase_rate_step_chips(0.0),
|
||||||
d_phase_step_rad(0),
|
d_rem_carrier_phase_in_rad(0.0),
|
||||||
|
d_phase_step_rad(0.0),
|
||||||
|
d_carrier_phase_rate_step_rad(0.0),
|
||||||
d_code_length_samples(code_length_chips * code_samples_per_chip),
|
d_code_length_samples(code_length_chips * code_samples_per_chip),
|
||||||
d_n_correlators(n_correlators),
|
d_n_correlators(n_correlators),
|
||||||
d_device_descriptor(0),
|
d_device_descriptor(0),
|
||||||
d_map_base(nullptr),
|
d_map_base(nullptr),
|
||||||
d_correlator_length_samples(0),
|
d_correlator_length_samples(0),
|
||||||
d_code_phase_step_chips_num(0),
|
d_code_phase_step_chips_num(0),
|
||||||
|
d_code_phase_rate_step_chips_num(0),
|
||||||
d_rem_carr_phase_rad_int(0),
|
d_rem_carr_phase_rad_int(0),
|
||||||
d_phase_step_rad_int(0),
|
d_phase_step_rad_int(0),
|
||||||
|
d_carrier_phase_rate_step_rad_int(0),
|
||||||
d_ca_codes(ca_codes),
|
d_ca_codes(ca_codes),
|
||||||
d_data_codes(data_codes),
|
d_data_codes(data_codes),
|
||||||
|
d_secondary_code_0_length(0),
|
||||||
|
d_secondary_code_1_length(0),
|
||||||
d_track_pilot(track_pilot),
|
d_track_pilot(track_pilot),
|
||||||
d_secondary_code_enabled(false)
|
d_secondary_code_enabled(false)
|
||||||
{
|
{
|
||||||
|
@ -2097,6 +2097,7 @@ void GNSSFlowgraph::set_configuration(const std::shared_ptr<ConfigurationInterfa
|
|||||||
#if ENABLE_FPGA
|
#if ENABLE_FPGA
|
||||||
void GNSSFlowgraph::start_acquisition_helper()
|
void GNSSFlowgraph::start_acquisition_helper()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(signal_list_mutex_);
|
||||||
for (int i = 0; i < channels_count_; i++)
|
for (int i = 0; i < channels_count_; i++)
|
||||||
{
|
{
|
||||||
if (channels_state_[i] == 1)
|
if (channels_state_[i] == 1)
|
||||||
|
@ -91,6 +91,7 @@ GalileoE1PcpsAmbiguousAcquisitionTestFpga::GalileoE1PcpsAmbiguousAcquisitionTest
|
|||||||
|
|
||||||
doppler_max = 5000;
|
doppler_max = 5000;
|
||||||
doppler_step = 100;
|
doppler_step = 100;
|
||||||
|
nsamples_to_transfer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -280,7 +281,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool acquisition_successful;
|
bool acquisition_successful{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -310,7 +311,7 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal()
|
|||||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||||
|
|
||||||
std::string file = "data/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
|
std::string file = "data/Galileo_E1_ID_1_Fs_4Msps_8ms.dat";
|
||||||
args.file = file; // DMA file configuration
|
args.file = std::move(file); // DMA file configuration
|
||||||
|
|
||||||
// instantiate the FPGA switch and set the
|
// instantiate the FPGA switch and set the
|
||||||
// switch position to DMA.
|
// switch position to DMA.
|
||||||
@ -348,7 +349,7 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal()
|
|||||||
args.nsamples_tx = nsamples_to_transfer;
|
args.nsamples_tx = nsamples_to_transfer;
|
||||||
|
|
||||||
// run the acquisition. The acquisition must run in a separate thread because it is a blocking function
|
// run the acquisition. The acquisition must run in a separate thread because it is a blocking function
|
||||||
args_acq.acquisition = acquisition;
|
args_acq.acquisition = std::move(acquisition);
|
||||||
|
|
||||||
if (pthread_create(&thread_acquisition, nullptr, handler_acquisition_galileo_e1_pcps_ambiguous_acq_test, reinterpret_cast<void*>(&args_acq)) < 0)
|
if (pthread_create(&thread_acquisition, nullptr, handler_acquisition_galileo_e1_pcps_ambiguous_acq_test, reinterpret_cast<void*>(&args_acq)) < 0)
|
||||||
{
|
{
|
||||||
|
@ -279,7 +279,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool acquisition_successful;
|
bool acquisition_successful{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal()
|
|||||||
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR;
|
||||||
|
|
||||||
std::string file = "data/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string file = "data/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
args.file = file; // DMA file configuration
|
args.file = std::move(file); // DMA file configuration
|
||||||
|
|
||||||
// instantiate the FPGA switch and set the
|
// instantiate the FPGA switch and set the
|
||||||
// switch position to DMA.
|
// switch position to DMA.
|
||||||
@ -347,7 +347,7 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal()
|
|||||||
args.nsamples_tx = nsamples_to_transfer;
|
args.nsamples_tx = nsamples_to_transfer;
|
||||||
|
|
||||||
// run the acquisition. The acquisition must run in a separate thread because it is a blocking function
|
// run the acquisition. The acquisition must run in a separate thread because it is a blocking function
|
||||||
args_acq.acquisition = acquisition;
|
args_acq.acquisition = std::move(acquisition);
|
||||||
|
|
||||||
if (pthread_create(&thread_acquisition, nullptr, handler_acquisition_gps_l1_acq_test, reinterpret_cast<void*>(&args_acq)) < 0)
|
if (pthread_create(&thread_acquisition, nullptr, handler_acquisition_gps_l1_acq_test, reinterpret_cast<void*>(&args_acq)) < 0)
|
||||||
{
|
{
|
||||||
|
@ -224,7 +224,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex)
|
|||||||
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
config2->set_property("Test_Source.filename", filename);
|
config2->set_property("Test_Source.filename", std::move(filename));
|
||||||
config2->set_property("Test_Source.item_type", "gr_complex");
|
config2->set_property("Test_Source.item_type", "gr_complex");
|
||||||
config2->set_property("Test_Source.repeat", "true");
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <complex>
|
#include <complex>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <utility>
|
||||||
#ifdef GR_GREATER_38
|
#ifdef GR_GREATER_38
|
||||||
#include <gnuradio/analog/sig_source.h>
|
#include <gnuradio/analog/sig_source.h>
|
||||||
#else
|
#else
|
||||||
@ -177,7 +178,7 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex)
|
|||||||
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
config2->set_property("Test_Source.filename", filename);
|
config2->set_property("Test_Source.filename", std::move(filename));
|
||||||
config2->set_property("Test_Source.item_type", "gr_complex");
|
config2->set_property("Test_Source.item_type", "gr_complex");
|
||||||
config2->set_property("Test_Source.repeat", "true");
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <complex>
|
#include <complex>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <utility>
|
||||||
#ifdef GR_GREATER_38
|
#ifdef GR_GREATER_38
|
||||||
#include <gnuradio/analog/sig_source.h>
|
#include <gnuradio/analog/sig_source.h>
|
||||||
#else
|
#else
|
||||||
@ -176,7 +177,7 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex)
|
|||||||
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
config2->set_property("Test_Source.filename", filename);
|
config2->set_property("Test_Source.filename", std::move(filename));
|
||||||
config2->set_property("Test_Source.item_type", "gr_complex");
|
config2->set_property("Test_Source.item_type", "gr_complex");
|
||||||
config2->set_property("Test_Source.repeat", "true");
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
@ -269,6 +269,8 @@ static time_t utc_time(int week, int64_t tow)
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
const std::string intro_help(
|
const std::string intro_help(
|
||||||
std::string("\n RTL-SDR E4000 RF front-end center frequency and sampling rate calibration tool that uses GPS signals\n") +
|
std::string("\n RTL-SDR E4000 RF front-end center frequency and sampling rate calibration tool that uses GPS signals\n") +
|
||||||
"Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)\n" +
|
"Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)\n" +
|
||||||
@ -280,7 +282,13 @@ int main(int argc, char** argv)
|
|||||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
|
|
||||||
std::cout << "Initializing... Please wait.\n";
|
std::cout << "Initializing... Please wait.\n";
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e.what() << '\n';
|
||||||
|
std::cout << "front-end-cal program ended.\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
google::InitGoogleLogging(argv[0]);
|
google::InitGoogleLogging(argv[0]);
|
||||||
if (FLAGS_log_dir.empty())
|
if (FLAGS_log_dir.empty())
|
||||||
{
|
{
|
||||||
@ -291,6 +299,8 @@ int main(int argc, char** argv)
|
|||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
const fs::path p(FLAGS_log_dir);
|
const fs::path p(FLAGS_log_dir);
|
||||||
if (!fs::exists(p))
|
if (!fs::exists(p))
|
||||||
@ -299,13 +309,29 @@ int main(int argc, char** argv)
|
|||||||
<< FLAGS_log_dir
|
<< FLAGS_log_dir
|
||||||
<< " does not exist, attempting to create it"
|
<< " does not exist, attempting to create it"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
fs::create_directory(p);
|
errorlib::error_code ec;
|
||||||
|
if (!fs::create_directory(p, ec))
|
||||||
|
{
|
||||||
|
std::cerr << "Could not create the " << FLAGS_log_dir << " folder. Front-end-cal program ended.\n";
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std::cout << "Logging with be done at "
|
std::cout << "Logging with be done at "
|
||||||
<< FLAGS_log_dir << '\n';
|
<< FLAGS_log_dir << '\n';
|
||||||
}
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e.what() << '\n';
|
||||||
|
std::cerr << "Could not create the " << FLAGS_log_dir << " folder. Front-end-cal program ended.\n";
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 0. Instantiate the FrontEnd Calibration class
|
// 0. Instantiate the FrontEnd Calibration class
|
||||||
|
try
|
||||||
|
{
|
||||||
FrontEndCal front_end_cal;
|
FrontEndCal front_end_cal;
|
||||||
|
|
||||||
// 1. Load configuration parameters from config file
|
// 1. Load configuration parameters from config file
|
||||||
@ -643,7 +669,21 @@ int main(int argc, char** argv)
|
|||||||
std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " (Eph not found)\n";
|
std::cout << " " << it.first << " " << it.second - mean_f_if_Hz << " (Eph not found)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "Exception: " << e.what();
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "Unknown error\n";
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
gflags::ShutDownCommandLineFlags();
|
gflags::ShutDownCommandLineFlags();
|
||||||
std::cout << "GNSS-SDR Front-end calibration program ended.\n";
|
std::cout << "GNSS-SDR Front-end calibration program ended.\n";
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if GNSSTK_USES_GPSTK_NAMESPACE
|
#if GNSSTK_USES_GPSTK_NAMESPACE
|
||||||
@ -673,7 +674,7 @@ void carrier_doppler_single_diff(
|
|||||||
{
|
{
|
||||||
// 2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
err = delta_measured_carrier_doppler_cycles;
|
err = std::move(delta_measured_carrier_doppler_cycles);
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
|
|
||||||
@ -865,7 +866,7 @@ void code_pseudorange_single_diff(
|
|||||||
// 2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
|
|
||||||
err = delta_measured_obs;
|
err = std::move(delta_measured_obs);
|
||||||
|
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
@ -1014,7 +1015,7 @@ void coderate_phaserate_consistence(
|
|||||||
|
|
||||||
// 2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
err = ratediff;
|
err = std::move(ratediff);
|
||||||
|
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
@ -1098,7 +1099,7 @@ void code_phase_diff(
|
|||||||
{
|
{
|
||||||
// 2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
err = code_minus_phase;
|
err = std::move(code_minus_phase);
|
||||||
|
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
@ -1727,6 +1728,8 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
std::cout << "Running RINEX observables difference tool...\n";
|
std::cout << "Running RINEX observables difference tool...\n";
|
||||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||||
|
try
|
||||||
|
{
|
||||||
if (FLAGS_single_diff)
|
if (FLAGS_single_diff)
|
||||||
{
|
{
|
||||||
if (FLAGS_dupli_sat)
|
if (FLAGS_dupli_sat)
|
||||||
@ -1742,7 +1745,25 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
RINEX_doublediff(FLAGS_remove_rx_clock_error);
|
RINEX_doublediff(FLAGS_remove_rx_clock_error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (const gnsstk::Exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e;
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "Exception: " << e.what();
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cerr << "Unknown error\n";
|
||||||
|
gflags::ShutDownCommandLineFlags();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
gflags::ShutDownCommandLineFlags();
|
gflags::ShutDownCommandLineFlags();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user