mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-23 11:37:40 +00:00
First working version of a complete 5 state Kalman filter for both carrier and code tracking, tested with GPS L1 CA 1ms integration.
This commit is contained in:
@@ -21,6 +21,7 @@ set(TRACKING_LIB_SOURCES
|
||||
tracking_FLL_PLL_filter.cc
|
||||
tracking_loop_filter.cc
|
||||
dll_pll_conf.cc
|
||||
kf_conf.cc
|
||||
bayesian_estimation.cc
|
||||
exponential_smoother.cc
|
||||
)
|
||||
@@ -38,6 +39,7 @@ set(TRACKING_LIB_HEADERS
|
||||
tracking_FLL_PLL_filter.h
|
||||
tracking_loop_filter.h
|
||||
dll_pll_conf.h
|
||||
kf_conf.h
|
||||
bayesian_estimation.h
|
||||
exponential_smoother.h
|
||||
)
|
||||
|
151
src/algorithms/tracking/libs/kf_conf.cc
Normal file
151
src/algorithms/tracking/libs/kf_conf.cc
Normal file
@@ -0,0 +1,151 @@
|
||||
/*!
|
||||
* \file Kf_conf.cc
|
||||
* \brief Class that contains all the configuration parameters for generic
|
||||
* tracking block based on a DLL and a PLL.
|
||||
* \author Javier Arribas, 2018. jarribas(at)cttc.es
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "kf_conf.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include "item_type_helpers.h"
|
||||
#include <glog/logging.h>
|
||||
|
||||
|
||||
Kf_Conf::Kf_Conf()
|
||||
{
|
||||
/*KF tracking configuration */
|
||||
high_dyn = false;
|
||||
smoother_length = 10;
|
||||
fs_in = 2000000.0;
|
||||
vector_length = 0U;
|
||||
dump = false;
|
||||
dump_mat = true;
|
||||
dump_filename = std::string("./Kf_dump.dat");
|
||||
|
||||
pull_in_time_s = 10;
|
||||
bit_synchronization_time_limit_s = pull_in_time_s + 60;
|
||||
early_late_space_chips = 0.25;
|
||||
very_early_late_space_chips = 0.5;
|
||||
early_late_space_narrow_chips = 0.15;
|
||||
very_early_late_space_narrow_chips = 0.5;
|
||||
slope = 1.0;
|
||||
spc = 0.5;
|
||||
y_intercept = 1.0;
|
||||
carrier_aiding = true;
|
||||
extend_correlation_symbols = 1;
|
||||
cn0_samples = FLAGS_cn0_samples;
|
||||
cn0_smoother_samples = 200;
|
||||
cn0_smoother_alpha = 0.002;
|
||||
carrier_lock_test_smoother_alpha = 0.002;
|
||||
carrier_lock_test_smoother_samples = 25;
|
||||
cn0_min = FLAGS_cn0_min;
|
||||
max_carrier_lock_fail = FLAGS_max_carrier_lock_fail;
|
||||
max_code_lock_fail = FLAGS_max_lock_fail;
|
||||
carrier_lock_th = FLAGS_carrier_lock_th;
|
||||
track_pilot = true;
|
||||
enable_doppler_correction = false;
|
||||
system = 'G';
|
||||
signal[0] = '1';
|
||||
signal[1] = 'C';
|
||||
signal[2] = '\0';
|
||||
item_type = "gr_complex";
|
||||
|
||||
expected_cn0_dbhz = 0;
|
||||
//System covariances (Q)
|
||||
code_phase_sd_chips = 0;
|
||||
code_rate_sd_chips_s = 0;
|
||||
carrier_phase_sd_rad = 0;
|
||||
carrier_freq_sd_hz = 0;
|
||||
carrier_freq_rate_sd_hz_s = 0;
|
||||
//initial Kalman covariance matrix (P)
|
||||
init_code_phase_sd_chips = 0;
|
||||
init_code_rate_sd_chips_s = 0;
|
||||
init_carrier_phase_sd_rad = 0;
|
||||
init_carrier_freq_sd_hz = 0;
|
||||
init_carrier_freq_rate_sd_hz_s = 0;
|
||||
|
||||
enable_dynamic_measurement_covariance = false;
|
||||
use_estimated_cn0 = false;
|
||||
}
|
||||
|
||||
|
||||
void Kf_Conf::SetFromConfiguration(const ConfigurationInterface *configuration,
|
||||
const std::string &role)
|
||||
{
|
||||
item_type = configuration->property(role + ".item_type", item_type);
|
||||
if (!item_type_valid(item_type))
|
||||
{
|
||||
LOG(WARNING) << "Unknown item type: " + item_type << ". Set to gr_complex";
|
||||
item_type = "gr_complex";
|
||||
}
|
||||
|
||||
double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", fs_in);
|
||||
fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated);
|
||||
high_dyn = configuration->property(role + ".high_dyn", high_dyn);
|
||||
dump = configuration->property(role + ".dump", dump);
|
||||
dump_filename = configuration->property(role + ".dump_filename", dump_filename);
|
||||
dump_mat = configuration->property(role + ".dump_mat", dump_mat);
|
||||
|
||||
pull_in_time_s = configuration->property(role + ".pull_in_time_s", pull_in_time_s);
|
||||
bit_synchronization_time_limit_s = pull_in_time_s + 60;
|
||||
early_late_space_chips = configuration->property(role + ".early_late_space_chips", early_late_space_chips);
|
||||
early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", early_late_space_narrow_chips);
|
||||
very_early_late_space_chips = configuration->property(role + ".very_early_late_space_chips", very_early_late_space_chips);
|
||||
very_early_late_space_narrow_chips = configuration->property(role + ".very_early_late_space_narrow_chips", very_early_late_space_narrow_chips);
|
||||
extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", extend_correlation_symbols);
|
||||
track_pilot = configuration->property(role + ".track_pilot", track_pilot);
|
||||
cn0_samples = configuration->property(role + ".cn0_samples", cn0_samples);
|
||||
cn0_min = configuration->property(role + ".cn0_min", cn0_min);
|
||||
max_code_lock_fail = configuration->property(role + ".max_lock_fail", max_code_lock_fail);
|
||||
max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", max_carrier_lock_fail);
|
||||
carrier_lock_th = configuration->property(role + ".carrier_lock_th", carrier_lock_th);
|
||||
carrier_aiding = configuration->property(role + ".carrier_aiding", carrier_aiding);
|
||||
|
||||
// tracking lock tests smoother parameters
|
||||
cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", cn0_smoother_samples);
|
||||
cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", cn0_smoother_alpha);
|
||||
smoother_length = configuration->property(role + ".smoother_length", smoother_length);
|
||||
if (smoother_length < 1)
|
||||
{
|
||||
smoother_length = 1;
|
||||
LOG(WARNING) << "smoother_length must be bigger than 0. It has been set to 1";
|
||||
}
|
||||
carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", carrier_lock_test_smoother_samples);
|
||||
carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", carrier_lock_test_smoother_alpha);
|
||||
|
||||
// Kalman filter covariances
|
||||
|
||||
//Measurement covariances (R)
|
||||
expected_cn0_dbhz = configuration->property(role + ".expected_cn0_dbhz", 42.0);
|
||||
enable_dynamic_measurement_covariance = configuration->property(role + ".enable_dynamic_measurement_covariance", false);
|
||||
use_estimated_cn0 = configuration->property(role + ".use_estimated_cn0", false);
|
||||
|
||||
//System covariances (Q)
|
||||
code_phase_sd_chips = configuration->property(role + ".code_phase_sd_chips", 0.001);
|
||||
code_rate_sd_chips_s = configuration->property(role + ".code_rate_sd_chips_s", 0.001);
|
||||
|
||||
carrier_phase_sd_rad = configuration->property(role + ".carrier_phase_sd_rad", 0.001);
|
||||
carrier_freq_sd_hz = configuration->property(role + ".carrier_freq_sd_hz", 0.1);
|
||||
carrier_freq_rate_sd_hz_s = configuration->property(role + ".carrier_freq_rate_sd_hz_s", 1);
|
||||
|
||||
//initial Kalman covariance matrix (P)
|
||||
init_code_phase_sd_chips = configuration->property(role + ".init_code_phase_sd_chips", 1);
|
||||
init_code_rate_sd_chips_s = configuration->property(role + ".init_code_rate_sd_chips_s", 100);
|
||||
|
||||
init_carrier_phase_sd_rad = configuration->property(role + ".init_carrier_phase_sd_rad", 10);
|
||||
init_carrier_freq_sd_hz = configuration->property(role + ".init_carrier_freq_sd_hz", 1000);
|
||||
init_carrier_freq_rate_sd_hz_s = configuration->property(role + ".init_carrier_freq_rate_sd_hz_s", 1000);
|
||||
}
|
91
src/algorithms/tracking/libs/kf_conf.h
Normal file
91
src/algorithms/tracking/libs/kf_conf.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/*!
|
||||
* \file Kf_conf.h
|
||||
* \brief Class that contains all the configuration parameters for generic tracking block based on a Kalman Filter.
|
||||
* \author Javier Arribas, 2020. jarribas(at)cttc.es
|
||||
*
|
||||
* Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL.
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_Kf_CONF_H
|
||||
#define GNSS_SDR_Kf_CONF_H
|
||||
|
||||
#include "configuration_interface.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
class Kf_Conf
|
||||
{
|
||||
public:
|
||||
Kf_Conf();
|
||||
void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role);
|
||||
|
||||
std::string item_type;
|
||||
std::string dump_filename;
|
||||
double fs_in;
|
||||
double carrier_lock_th;
|
||||
float early_late_space_chips;
|
||||
float very_early_late_space_chips;
|
||||
float early_late_space_narrow_chips;
|
||||
float very_early_late_space_narrow_chips;
|
||||
float slope;
|
||||
float spc;
|
||||
float y_intercept;
|
||||
float cn0_smoother_alpha;
|
||||
float carrier_lock_test_smoother_alpha;
|
||||
uint32_t pull_in_time_s;
|
||||
uint32_t bit_synchronization_time_limit_s;
|
||||
uint32_t vector_length;
|
||||
uint32_t smoother_length;
|
||||
int32_t extend_correlation_symbols;
|
||||
int32_t cn0_samples;
|
||||
int32_t cn0_smoother_samples;
|
||||
int32_t carrier_lock_test_smoother_samples;
|
||||
int32_t cn0_min;
|
||||
int32_t max_code_lock_fail;
|
||||
int32_t max_carrier_lock_fail;
|
||||
char signal[3]{};
|
||||
char system;
|
||||
bool track_pilot;
|
||||
bool enable_doppler_correction;
|
||||
bool carrier_aiding;
|
||||
bool high_dyn;
|
||||
bool dump;
|
||||
bool dump_mat;
|
||||
|
||||
//KF statistics
|
||||
//states: code_phase_chips, carrier_phase_rads, carrier_freq_hz, carrier_freq_rate_hz_s, code_freq_rate_chips_s
|
||||
//Measurement covariances (R)
|
||||
double expected_cn0_dbhz;
|
||||
//System covariances (Q)
|
||||
double code_phase_sd_chips;
|
||||
double code_rate_sd_chips_s;
|
||||
|
||||
double carrier_phase_sd_rad;
|
||||
double carrier_freq_sd_hz;
|
||||
double carrier_freq_rate_sd_hz_s;
|
||||
//initial Kalman covariance matrix (P)
|
||||
double init_code_phase_sd_chips;
|
||||
double init_code_rate_sd_chips_s;
|
||||
|
||||
double init_carrier_phase_sd_rad;
|
||||
double init_carrier_freq_sd_hz;
|
||||
double init_carrier_freq_rate_sd_hz_s;
|
||||
|
||||
bool enable_dynamic_measurement_covariance;
|
||||
bool use_estimated_cn0;
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user