GNSS-SDR  0.0.13
An Open Source GNSS Software Defined Receiver
nonlinear_tracking.h
Go to the documentation of this file.
1 /*!
2  * \file nonlinear_tracking.h
3  * \brief Interface of a library for nonlinear tracking algorithms
4  *
5  * CubatureFilter implements the functionality of the Cubature Kalman
6  * Filter, which uses multidimensional cubature rules to estimate the
7  * time evolution of a nonlinear system. UnscentedFilter implements
8  * an Unscented Kalman Filter which uses Unscented Transform rules to
9  * perform a similar estimation.
10  *
11  * [1] I Arasaratnam and S Haykin. Cubature kalman filters. IEEE
12  * Transactions on Automatic Control, 54(6):1254–1269,2009.
13  *
14  * \authors <ul>
15  * <li> Gerald LaMountain, 2019. gerald(at)ece.neu.edu
16  * <li> Jordi Vila-Valls 2019. jvila(at)cttc.es
17  * </ul>
18  * -----------------------------------------------------------------------------
19  *
20  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
21  *
22  * GNSS-SDR is a software defined Global Navigation
23  * Satellite Systems receiver
24  *
25  * This file is part of GNSS-SDR.
26  *
27  * SPDX-License-Identifier: GPL-3.0-or-later
28  *
29  * -----------------------------------------------------------------------------
30  */
31 
32 #ifndef GNSS_SDR_NONLINEAR_TRACKING_H
33 #define GNSS_SDR_NONLINEAR_TRACKING_H
34 
35 #if ARMA_NO_BOUND_CHECKING
36 #define ARMA_NO_DEBUG 1
37 #endif
38 
39 #include <armadillo>
40 #include <gnuradio/gr_complex.h>
41 
42 // Abstract model function
44 {
45 public:
46  ModelFunction(){};
47  virtual arma::vec operator()(const arma::vec& input) = 0;
48  virtual ~ModelFunction() = default;
49 };
50 
52 {
53 public:
54  // Constructors and destructors
56  explicit CubatureFilter(int nx);
57  CubatureFilter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0);
58  ~CubatureFilter() = default;
59 
60  // Reinitialization function
61  void initialize(const arma::mat& x_pred_0, const arma::mat& P_x_pred_0);
62 
63  // Prediction and estimation
64  void predict_sequential(const arma::vec& x_post, const arma::mat& P_x_post, ModelFunction* transition_fcn, const arma::mat& noise_covariance);
65  void update_sequential(const arma::vec& z_upd, const arma::vec& x_pred, const arma::mat& P_x_pred, ModelFunction* measurement_fcn, const arma::mat& noise_covariance);
66 
67  // Getters
68  arma::mat get_x_pred() const;
69  arma::mat get_P_x_pred() const;
70  arma::mat get_x_est() const;
71  arma::mat get_P_x_est() const;
72 
73 private:
74  arma::vec x_pred_out;
75  arma::mat P_x_pred_out;
76  arma::vec x_est;
77  arma::mat P_x_est;
78 };
79 
81 {
82 public:
83  // Constructors and destructors
85  explicit UnscentedFilter(int nx);
86  UnscentedFilter(const arma::vec& x_pred_0, const arma::mat& P_x_pred_0);
87  ~UnscentedFilter() = default;
88 
89  // Reinitialization function
90  void initialize(const arma::mat& x_pred_0, const arma::mat& P_x_pred_0);
91 
92  // Prediction and estimation
93  void predict_sequential(const arma::vec& x_post, const arma::mat& P_x_post, ModelFunction* transition_fcn, const arma::mat& noise_covariance);
94  void update_sequential(const arma::vec& z_upd, const arma::vec& x_pred, const arma::mat& P_x_pred, ModelFunction* measurement_fcn, const arma::mat& noise_covariance);
95 
96  // Getters
97  arma::mat get_x_pred() const;
98  arma::mat get_P_x_pred() const;
99  arma::mat get_x_est() const;
100  arma::mat get_P_x_est() const;
101 
102 private:
103  arma::vec x_pred_out;
104  arma::mat P_x_pred_out;
105  arma::vec x_est;
106  arma::mat P_x_est;
107 };
108 
109 #endif