GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
rtklib_solver.h
Go to the documentation of this file.
1 /*!
2  * \file rtklib_solver.h
3  * \brief PVT solver based on rtklib library functions adapted to the GNSS-SDR
4  * data flow and structures
5  * \authors <ul>
6  * <li> 2017, Javier Arribas
7  * <li> 2017-2023, Carles Fernandez
8  * <li> 2007-2013, T. Takasu
9  * </ul>
10  *
11  * This is a derived work from RTKLIB http://www.rtklib.com/
12  * The original source code at https://github.com/tomojitakasu/RTKLIB is
13  * released under the BSD 2-clause license with an additional exclusive clause
14  * that does not apply here. This additional clause is reproduced below:
15  *
16  * " The software package includes some companion executive binaries or shared
17  * libraries necessary to execute APs on Windows. These licenses succeed to the
18  * original ones of these software. "
19  *
20  * Neither the executive binaries nor the shared libraries are required by, used
21  * or included in GNSS-SDR.
22  *
23  * -----------------------------------------------------------------------------
24  * Copyright (C) 2007-2013, T. Takasu
25  * Copyright (C) 2017-2019, Javier Arribas
26  * Copyright (C) 2017-2023, Carles Fernandez
27  * All rights reserved.
28  *
29  * SPDX-License-Identifier: BSD-2-Clause
30  *
31  * -----------------------------------------------------------------------------
32  */
33 
34 #ifndef GNSS_SDR_RTKLIB_SOLVER_H
35 #define GNSS_SDR_RTKLIB_SOLVER_H
36 
37 
38 #include "beidou_dnav_almanac.h"
39 #include "beidou_dnav_ephemeris.h"
40 #include "beidou_dnav_iono.h"
41 #include "beidou_dnav_utc_model.h"
42 #include "galileo_almanac.h"
43 #include "galileo_ephemeris.h"
44 #include "galileo_has_data.h"
45 #include "galileo_iono.h"
46 #include "galileo_utc_model.h"
47 #include "glonass_gnav_almanac.h"
48 #include "glonass_gnav_ephemeris.h"
49 #include "glonass_gnav_utc_model.h"
50 #include "gnss_synchro.h"
51 #include "gps_almanac.h"
52 #include "gps_cnav_ephemeris.h"
53 #include "gps_cnav_iono.h"
54 #include "gps_cnav_utc_model.h"
55 #include "gps_ephemeris.h"
56 #include "gps_iono.h"
57 #include "gps_utc_model.h"
58 #include "monitor_pvt.h"
59 #include "pvt_conf.h"
60 #include "pvt_kf.h"
61 #include "pvt_solution.h"
62 #include "rtklib.h"
63 #include "rtklib_conversions.h"
64 #include <array>
65 #include <cstdint>
66 #include <fstream>
67 #include <map>
68 #include <string>
69 #include <utility>
70 
71 /** \addtogroup PVT
72  * \{ */
73 /** \addtogroup PVT_libs pvt_libs
74  * Library for the computation of PVT solutions.
75  * \{ */
76 
77 
78 /*!
79  * \brief This class implements a PVT solution based on RTKLIB
80  */
82 {
83 public:
84  Rtklib_Solver(const rtk_t& rtk,
85  const Pvt_Conf& conf,
86  const std::string& dump_filename,
87  uint32_t type_of_rx,
88  bool flag_dump_to_file,
89  bool flag_dump_to_mat);
90 
91  ~Rtklib_Solver();
92 
93  bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, double kf_update_interval_s);
94 
95  double get_hdop() const override;
96  double get_vdop() const override;
97  double get_pdop() const override;
98  double get_gdop() const override;
99  Monitor_Pvt get_monitor_pvt() const;
100  void store_has_data(const Galileo_HAS_data& new_has_data);
101  void update_has_corrections(const std::map<int, Gnss_Synchro>& obs_map);
102 
103  sol_t pvt_sol{};
104  std::array<ssat_t, MAXSAT> pvt_ssat{};
105 
106  std::map<int, Galileo_Ephemeris> galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris
107  std::map<int, Gps_Ephemeris> gps_ephemeris_map; //!< Map storing new GPS_Ephemeris
108  std::map<int, Gps_CNAV_Ephemeris> gps_cnav_ephemeris_map; //!< Map storing new GPS_CNAV_Ephemeris
109  std::map<int, Glonass_Gnav_Ephemeris> glonass_gnav_ephemeris_map; //!< Map storing new GLONASS GNAV Ephemeris
110  std::map<int, Beidou_Dnav_Ephemeris> beidou_dnav_ephemeris_map; //!< Map storing new BeiDou DNAV Ephmeris
111 
112  Galileo_Utc_Model galileo_utc_model;
113  Galileo_Iono galileo_iono;
114  std::map<int, Galileo_Almanac> galileo_almanac_map;
115 
116  Gps_Utc_Model gps_utc_model;
117  Gps_Iono gps_iono;
118  std::map<int, Gps_Almanac> gps_almanac_map;
119 
120  Gps_CNAV_Iono gps_cnav_iono;
121  Gps_CNAV_Utc_Model gps_cnav_utc_model;
122 
123  Glonass_Gnav_Utc_Model glonass_gnav_utc_model; //!< Map storing GLONASS GNAV UTC Model
124  Glonass_Gnav_Almanac glonass_gnav_almanac; //!< Map storing GLONASS GNAV Almanac Model
125 
126  Beidou_Dnav_Utc_Model beidou_dnav_utc_model;
127  Beidou_Dnav_Iono beidou_dnav_iono;
128  std::map<int, Beidou_Dnav_Almanac> beidou_dnav_almanac_map;
129 
130 private:
131  bool save_matfile() const;
132 
133  void check_has_orbit_clock_validity(const std::map<int, Gnss_Synchro>& obs_map);
134  void get_has_biases(const std::map<int, Gnss_Synchro>& obs_map);
135  void get_current_has_obs_correction(const std::string& signal, uint32_t tow_obs, int prn);
136 
137  std::array<obsd_t, MAXOBS> d_obs_data{};
138  std::array<double, 4> d_dop{};
139  std::map<int, int> d_rtklib_freq_index;
140  std::map<std::string, int> d_rtklib_band_index;
141 
142  std::map<std::string, std::map<int, HAS_orbit_corrections>> d_has_orbit_corrections_store_map; // first key is system, second key is PRN
143  std::map<std::string, std::map<int, HAS_clock_corrections>> d_has_clock_corrections_store_map; // first key is system, second key is PRN
144 
145  std::map<std::string, std::map<int, std::pair<float, uint32_t>>> d_has_code_bias_store_map; // first key is signal, second key is PRN
146  std::map<std::string, std::map<int, std::pair<float, uint32_t>>> d_has_phase_bias_store_map; // first key is signal, second key is PRN
147 
148  std::map<std::string, std::map<int, HAS_obs_corrections>> d_has_obs_corr_map; // first key is signal, second key is PRN
149 
150  std::string d_dump_filename;
151  std::ofstream d_dump_file;
152  rtk_t d_rtk{};
153  nav_t d_nav_data{};
154  Monitor_Pvt d_monitor_pvt{};
155  Pvt_Conf d_conf;
156  Pvt_Kf d_pvt_kf;
157  uint32_t d_type_of_rx;
158  bool d_flag_dump_enabled;
159  bool d_flag_dump_mat_enabled;
160 };
161 
162 
163 /** \} */
164 /** \} */
165 #endif // GNSS_SDR_RTKLIB_SOLVER_H
This class is a storage for the GPS IONOSPHERIC data as described in IS-GPS-200M. ...
Definition: gps_iono.h:35
Interface of a GLONASS EPHEMERIS storage.
This class is a storage for the BeiDou DNAV UTC Model.
Interface of a GLONASS GNAV UTC MODEL storage.
Kalman Filter for Position and Velocity.
Definition: pvt_kf.h:33
Interface of a GLONASS GNAV ALMANAC storage.
Interface of a BeiDou UTC MODEL storage.
Interface of a GPS CNAV UTC MODEL storage.
Interface of a Beidou DNAV Almanac storage.
Definition: rtklib.h:752
This class is a storage for the BEIDOU IONOSPHERIC data as described in ICD v2.1. ...
Glonass_Gnav_Almanac glonass_gnav_almanac
Map storing GLONASS GNAV Almanac Model.
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
Interface of a GPS UTC MODEL storage.
Interface of a BEIDOU EPHEMERIS storage.
Class that contains all the configuration parameters for the PVT block.
Interface of a Galileo ALMANAC storage.
This class contains parameters and outputs of the PVT block.
Definition: monitor_pvt.h:33
This class implements a PVT solution based on RTKLIB.
Definition: rtklib_solver.h:81
Interface of a GPS ALMANAC storage.
main header file for the rtklib library
This class is a storage for the GPS UTC MODEL data as described in in IS-GPS-200M.
std::map< int, Gps_CNAV_Ephemeris > gps_cnav_ephemeris_map
Map storing new GPS_CNAV_Ephemeris.
GNSS-SDR to RTKLIB data structures conversion functions.
Glonass_Gnav_Utc_Model glonass_gnav_utc_model
Map storing GLONASS GNAV UTC Model.
This class is a storage for the GALILEO IONOSPHERIC data as described in Galileo ICD paragraph 5...
Definition: galileo_iono.h:37
Interface of a Galileo UTC MODEL storage.
Interface of a GPS EPHEMERIS storage.
std::map< int, Galileo_Ephemeris > galileo_ephemeris_map
Map storing new Galileo_Ephemeris.
Interface of a GPS CNAV IONOSPHERIC MODEL storage.
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5...
This class is a storage for the GPS UTC MODEL data as described in IS-GPS-200M.
Definition: gps_utc_model.h:35
Interface of a BEIDOU IONOSPHERIC MODEL storage.
Interface of the Monitor_Pvt class.
This class is a storage for the GLONASS SV ALMANAC data as described GLONASS ICD (Edition 5...
Kalman Filter for Position and Velocity.
This class is a storage for the GALILEO UTC MODEL data as described in Galileo ICD https://www...
Interface of a GPS CNAV EPHEMERIS storage.
Interface of a Galileo Ionospheric Model storage.
Definition: rtklib.h:819
This class is a storage for the GPS IONOSPHERIC data as described in IS-GPS-200M. ...
Definition: gps_cnav_iono.h:34
std::map< int, Beidou_Dnav_Ephemeris > beidou_dnav_ephemeris_map
Map storing new BeiDou DNAV Ephmeris.
std::map< int, Glonass_Gnav_Ephemeris > glonass_gnav_ephemeris_map
Map storing new GLONASS GNAV Ephemeris.
Interface of a GPS IONOSPHERIC MODEL storage.
Interface of a Galileo EPHEMERIS storage.
Class for Galileo HAS message type 1 data storage.
std::map< int, Gps_Ephemeris > gps_ephemeris_map
Map storing new GPS_Ephemeris.
Base class for a PVT solution.
Definition: pvt_solution.h:34
Interface of a base class for a PVT solution.
Definition: rtklib.h:1066
Interface of the Gnss_Synchro class.