1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

Make the carrier smoothing parameter an integer

This commit is contained in:
Carles Fernandez 2020-02-11 19:34:21 +01:00
parent dfc02b2e5c
commit 207b01a6c0
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 21 additions and 10 deletions

View File

@ -19,7 +19,6 @@
#include "gnss_sdr_flags.h"
#include <cstdint>
#include <iostream>
#include <string>
@ -71,7 +70,7 @@ DEFINE_double(dll_bw_hz, 0.0, "If defined, bandwidth of the DLL low pass filter,
DEFINE_double(pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter, in Hz (overrides the configuration file).");
DEFINE_double(carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M");
DEFINE_int32(carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M (overrides the configuration file)");
#if GFLAGS_GREATER_2_0
@ -215,6 +214,19 @@ static bool ValidatePllBw(const char* flagname, double value)
return false;
}
static bool ValidateCarrierSmoothingFactor(const char* flagname, int32_t value)
{
const int32_t min_value = 1;
if (value >= min_value)
{ // value is ok
return true;
}
std::cout << "Invalid value for flag -" << flagname << ": " << value << ". Allowed range is 1 <= " << flagname << "." << std::endl;
std::cout << "GNSS-SDR program ended." << std::endl;
return false;
}
DEFINE_validator(c, &ValidateC);
DEFINE_validator(config_file, &ValidateConfigFile);
DEFINE_validator(s, &ValidateS);
@ -227,6 +239,6 @@ DEFINE_validator(max_lock_fail, &ValidateMaxLockFail);
DEFINE_validator(carrier_lock_th, &ValidateCarrierLockTh);
DEFINE_validator(dll_bw_hz, &ValidateDllBw);
DEFINE_validator(pll_bw_hz, &ValidatePllBw);
DEFINE_validator(carrier_smoothing_factor, &ValidateCarrierSmoothingFactor);
#endif

View File

@ -22,6 +22,7 @@
#include <gflags/gflags.h>
#include <cstdint>
DECLARE_string(c); //!< Path to the configuration file.
DECLARE_string(config_file); //!< Path to the configuration file.
@ -47,8 +48,8 @@ DECLARE_double(dll_bw_hz); //!< Bandwidth of the DLL low pass filter
DECLARE_double(pll_bw_hz); //!< Bandwidth of the PLL low pass filter, in Hz (overrides the configuration file).
// Declare flags for observables block
DECLARE_double(carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file).
const double DEFAULT_CARRIER_SMOOTHING_FACTOR = 200.0;
DECLARE_int32(carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file).
const int32_t DEFAULT_CARRIER_SMOOTHING_FACTOR = 200;
// Declare flags for PVT
DECLARE_string(RINEX_version); //!< If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file.

View File

@ -23,8 +23,6 @@
#include "gnss_sdr_flags.h"
#include "obs_conf.h"
#include <glog/logging.h>
#include <cmath> // for std::fabs
#include <limits> // for epsilon()
#include <ostream> // for operator<<
HybridObservables::HybridObservables(ConfigurationInterface* configuration,
@ -45,7 +43,7 @@ HybridObservables::HybridObservables(ConfigurationInterface* configuration,
conf.nchannels_out = out_streams_;
conf.enable_carrier_smoothing = configuration->property(role + ".enable_carrier_smoothing", conf.enable_carrier_smoothing);
if (std::fabs(FLAGS_carrier_smoothing_factor - DEFAULT_CARRIER_SMOOTHING_FACTOR) <= std::numeric_limits<double>::epsilon()) // compare doubles
if (FLAGS_carrier_smoothing_factor == DEFAULT_CARRIER_SMOOTHING_FACTOR)
{
conf.smoothing_factor = configuration->property(role + ".smoothing_factor", conf.smoothing_factor);
}

View File

@ -135,7 +135,7 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_) : gr::block(
d_channel_last_pseudorange_smooth = std::vector<double>(d_nchannels_out, 0.0);
d_channel_last_carrier_phase_rads = std::vector<double>(d_nchannels_out, 0.0);
d_smooth_filter_M = conf_.smoothing_factor;
d_smooth_filter_M = static_cast<double>(conf_.smoothing_factor);
}

View File

@ -28,7 +28,7 @@ class Obs_Conf
{
public:
bool enable_carrier_smoothing;
double smoothing_factor;
int32_t smoothing_factor;
uint32_t nchannels_in;
uint32_t nchannels_out;
bool dump;