GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
rtklib_pvt_gs.h
Go to the documentation of this file.
1/*!
2 * \file rtklib_pvt_gs.h
3 * \brief Interface of a Position Velocity and Time computation block
4 * \author Javier Arribas, 2017. jarribas(at)cttc.es
5 *
6 * -----------------------------------------------------------------------------
7 *
8 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
9 * This file is part of GNSS-SDR.
10 *
11 * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
12 * SPDX-License-Identifier: GPL-3.0-or-later
13 *
14 * -----------------------------------------------------------------------------
15 */
16
17#ifndef GNSS_SDR_RTKLIB_PVT_GS_H
18#define GNSS_SDR_RTKLIB_PVT_GS_H
19
22#include "gnss_synchro.h"
23#include "gnss_time.h"
24#include "osnma_data.h"
25#include "rtklib.h"
28#include <boost/date_time/gregorian/gregorian.hpp>
29#include <boost/date_time/posix_time/posix_time.hpp>
30#include <boost/interprocess/ipc/message_queue.hpp>
31#include <gnuradio/sync_block.h> // for sync_block
32#include <gnuradio/types.h> // for gr_vector_const_void_star
33#include <pmt/pmt.h> // for pmt_t
34#include <chrono> // for system_clock
35#include <cstddef> // for size_t
36#include <cstdint> // for int32_t
37#include <ctime> // for time_t
38#include <fstream> // for std::fstream
39#include <map> // for map
40#include <memory> // for shared_ptr, unique_ptr
41#include <queue> // for std::queue
42#include <set> // for std::set
43#include <string> // for string
44#include <vector> // for vector
45
46/** \addtogroup PVT
47 * \{ */
48/** \addtogroup PVT_gnuradio_blocks pvt_gr_blocks
49 * GNU Radio blocks for the computation of PVT solutions.
50 * \{ */
51
52
55class Galileo_Almanac;
58class Geohash;
59class GeoJSON_Printer;
60class Gps_Almanac;
61class Gps_Ephemeris;
62class Gpx_Printer;
63class Kml_Printer;
66class Nmea_Printer;
67class Pvt_Conf;
68class Rinex_Printer;
69class Rtcm_Printer;
72class Rtklib_Solver;
73class rtklib_pvt_gs;
74
75using rtklib_pvt_gs_sptr = gnss_shared_ptr<rtklib_pvt_gs>;
76
77rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
78 const Pvt_Conf& conf_,
79 const rtk_t& rtk,
80 const SensorDataSourceConfiguration& sensor_data_configuration);
81
82/*!
83 * \brief This class implements a block that computes the PVT solution using the RTKLIB integrated library
84 */
85class rtklib_pvt_gs : public gr::sync_block
86{
87public:
88 ~rtklib_pvt_gs(); //!< Default destructor
89
90 /*!
91 * \brief Get latest set of GPS ephemeris from PVT block
92 */
93 std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
94
95 /*!
96 * \brief Get latest set of GPS almanac from PVT block
97 */
98 std::map<int, Gps_Almanac> get_gps_almanac_map() const;
99
100 /*!
101 * \brief Get latest set of Galileo ephemeris from PVT block
102 */
103 std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
104
105 /*!
106 * \brief Get latest set of Galileo almanac from PVT block
107 */
108 std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
109
110 /*!
111 * \brief Get latest set of BeiDou DNAV ephemeris from PVT block
112 */
113 std::map<int, Beidou_Dnav_Ephemeris> get_beidou_dnav_ephemeris_map() const;
114
115 /*!
116 * \brief Get latest set of BeiDou DNAV almanac from PVT block
117 */
118 std::map<int, Beidou_Dnav_Almanac> get_beidou_dnav_almanac_map() const;
119
120 /*!
121 * \brief Clear all ephemeris information and the almanacs for GPS and Galileo
122 */
124
125 /*!
126 * \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
127 */
128 bool get_latest_PVT(double* longitude_deg,
129 double* latitude_deg,
130 double* height_m,
131 double* ground_speed_kmh,
132 double* course_over_ground_deg,
133 time_t* UTC_time) const;
134
135 int work(int noutput_items, gr_vector_const_void_star& input_items,
136 gr_vector_void_star& output_items); //!< PVT Signal Processing
137
138private:
139 friend rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
140 const Pvt_Conf& conf_,
141 const rtk_t& rtk,
142 const SensorDataSourceConfiguration& sensor_data_configuration);
143
144 rtklib_pvt_gs(uint32_t nchannels,
145 const Pvt_Conf& conf_,
146 const rtk_t& rtk,
147 const SensorDataSourceConfiguration& sensor_data_configuration);
148
149 void log_source_timetag_info(double RX_time_ns, double TAG_time_ns);
150
151 void msg_handler_telemetry(const pmt::pmt_t& msg);
152
153 void msg_handler_has_data(const pmt::pmt_t& msg);
154
155 void msg_handler_osnma(const pmt::pmt_t& msg);
156
157 void initialize_and_apply_carrier_phase_offset();
158
159 void apply_rx_clock_offset(std::map<int, Gnss_Synchro>& observables_map,
160 double rx_clock_offset_s);
161
162 void update_HAS_corrections();
163
164 std::map<int, Gnss_Synchro> interpolate_observables(const std::map<int, Gnss_Synchro>& observables_map_t0,
165 const std::map<int, Gnss_Synchro>& observables_map_t1,
166 double rx_time_s);
167
168 inline std::time_t convert_to_time_t(const boost::posix_time::ptime pt) const
169 {
170 return (pt - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds();
171 }
172
173 std::vector<std::string> split_string(const std::string& s, char delim) const;
174
175 bool send_ttff_msg(double ttff) const;
176 bool save_gnss_synchro_map_xml(const std::string& file_name); // debug helper function
177 bool load_gnss_synchro_map_xml(const std::string& file_name); // debug helper function
178
179 std::fstream d_log_timetag_file;
180
181 std::unique_ptr<SensorDataAggregator> d_sensor_data_aggregator;
182
183 std::shared_ptr<Rtklib_Solver> d_internal_pvt_solver;
184 std::shared_ptr<Rtklib_Solver> d_user_pvt_solver;
185
186 std::unique_ptr<boost::interprocess::message_queue> d_mq;
187
188 std::unique_ptr<Rinex_Printer> d_rp;
189 std::unique_ptr<Kml_Printer> d_kml_dump;
190 std::unique_ptr<Gpx_Printer> d_gpx_dump;
191 std::unique_ptr<Nmea_Printer> d_nmea_printer;
192 std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
193 std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
194 std::unique_ptr<Monitor_Pvt_Udp_Sink> d_udp_sink_ptr;
195 std::unique_ptr<Monitor_Ephemeris_Udp_Sink> d_eph_udp_sink_ptr;
196 std::unique_ptr<Has_Simple_Printer> d_has_simple_printer;
197 std::unique_ptr<An_Packet_Printer> d_an_printer;
198
199 std::chrono::time_point<std::chrono::system_clock> d_start;
200 std::chrono::time_point<std::chrono::system_clock> d_end;
201
202 const std::string d_queue_name;
203 std::string d_dump_filename;
204 std::string d_xml_base_path;
205 std::string d_local_time_str;
206
207 std::vector<bool> d_channel_initialized;
208 std::vector<double> d_initial_carrier_phase_offset_estimation_rads;
209
210 std::map<int, Gnss_Synchro> d_gnss_observables_map;
211 std::map<int, Gnss_Synchro> d_gnss_observables_map_t0;
212 std::map<int, Gnss_Synchro> d_gnss_observables_map_t1;
213 std::map<uint32_t, std::set<uint32_t>> d_auth_nav_data_map;
214
215 std::queue<GnssTime> d_TimeChannelTagTimestamps;
216
217 boost::posix_time::time_duration d_utc_diff_time;
218 const std::unique_ptr<Geohash> d_geohash;
219
220 const size_t d_gps_ephemeris_sptr_type_hash_code;
221 const size_t d_gps_iono_sptr_type_hash_code;
222 const size_t d_gps_utc_model_sptr_type_hash_code;
223 const size_t d_gps_cnav_ephemeris_sptr_type_hash_code;
224 const size_t d_gps_cnav_iono_sptr_type_hash_code;
225 const size_t d_gps_cnav_utc_model_sptr_type_hash_code;
226 const size_t d_gps_almanac_sptr_type_hash_code;
227 const size_t d_galileo_ephemeris_sptr_type_hash_code;
228 const size_t d_galileo_iono_sptr_type_hash_code;
229 const size_t d_galileo_utc_model_sptr_type_hash_code;
230 const size_t d_galileo_almanac_helper_sptr_type_hash_code;
231 const size_t d_galileo_almanac_sptr_type_hash_code;
232 const size_t d_glonass_gnav_ephemeris_sptr_type_hash_code;
233 const size_t d_glonass_gnav_utc_model_sptr_type_hash_code;
234 const size_t d_glonass_gnav_almanac_sptr_type_hash_code;
235 const size_t d_beidou_dnav_ephemeris_sptr_type_hash_code;
236 const size_t d_beidou_dnav_iono_sptr_type_hash_code;
237 const size_t d_beidou_dnav_utc_model_sptr_type_hash_code;
238 const size_t d_beidou_dnav_almanac_sptr_type_hash_code;
239 const size_t d_galileo_has_data_sptr_type_hash_code;
240
241 const double d_rinex_version;
242 double d_rx_time;
243 uint64_t d_local_counter_ms;
244 uint64_t d_timestamp_rx_clock_offset_correction_msg_ms;
245
246 const int32_t d_rinexobs_rate_ms;
247 int32_t d_rtcm_MT1045_rate_ms; // Galileo Broadcast Ephemeris
248 int32_t d_rtcm_MT1019_rate_ms; // GPS Broadcast Ephemeris (orbits)
249 int32_t d_rtcm_MT1020_rate_ms; // GLONASS Broadcast Ephemeris (orbits)
250 int32_t d_rtcm_MT1077_rate_ms; // The type 7 Multiple Signal Message format for the USA’s GPS system, popular
251 int32_t d_rtcm_MT1087_rate_ms; // GLONASS MSM7. The type 7 Multiple Signal Message format for the Russian GLONASS system
252 int32_t d_rtcm_MT1097_rate_ms; // Galileo MSM7. The type 7 Multiple Signal Message format for Europe’s Galileo system
253 int32_t d_rtcm_MSM_rate_ms;
254 const int32_t d_kml_rate_ms;
255 const int32_t d_gpx_rate_ms;
256 const int32_t d_geojson_rate_ms;
257 const int32_t d_nmea_rate_ms;
258 const int32_t d_an_rate_ms;
259 const int32_t d_output_rate_ms;
260 const int32_t d_display_rate_ms;
261 const int32_t d_report_rate_ms;
262 const int32_t d_max_obs_block_rx_clock_offset_ms;
263
264 const uint32_t d_nchannels;
265 const uint32_t d_signal_enabled_flags;
266 const uint32_t d_observable_interval_ms;
267 uint32_t d_pvt_errors_counter;
268
269 bool d_dump;
270 const bool d_dump_mat;
271 const bool d_rinex_output_enabled;
272 bool d_geojson_output_enabled;
273 bool d_gpx_output_enabled;
274 bool d_kml_output_enabled;
275 bool d_nmea_output_file_enabled;
276 bool d_rtcm_enabled;
277 bool d_first_fix;
278 bool d_xml_storage;
279 const bool d_flag_monitor_pvt_enabled;
280 const bool d_flag_monitor_ephemeris_enabled;
281 const bool d_show_local_time_zone;
282 const bool d_enable_rx_clock_correction;
283 bool d_enable_has_messages;
284 const bool d_an_printer_enabled;
285 bool d_log_timetag;
286 const bool d_use_has_corrections;
287 const bool d_use_unhealthy_sats;
288 const bool d_osnma_strict;
289};
290
291
292/** \} */
293/** \} */
294#endif // GNSS_SDR_RTKLIB_PVT_GS_H
class that prints PVT solutions in a serial device following a custom version of the Advanced Navigat...
This class is a storage for the BeiDou D1 almanac.
This is a storage class for the Beidou SV ephemeris data as described in BeiDou Navigation Satellite ...
This class is a storage for the Galileo SV ALMANAC data.
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
Prints PVT solutions in GeoJSON format file.
Class for geohash encoding / decoding See https://en.wikipedia.org/wiki/Geohash.
Definition geohash.h:35
This class is a storage for the GPS SV ALMANAC data as described in IS-GPS-200M.
Definition gps_almanac.h:36
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
Prints PVT information to GPX format file.
Definition gpx_printer.h:40
Prints HAS messages content in a txt file. See HAS-SIS-ICD for a message description.
Prints PVT information to OGC KML format file (can be viewed with Google Earth).
Definition kml_printer.h:39
This class provides a implementation of a subset of the NMEA-0183 standard for interfacing marine ele...
Class that handles the generation of Receiver INdependent EXchange format (RINEX) files.
This class provides a implementation of a subset of the RTCM Standard 10403.2 messages.
This class implements a PVT solution based on RTKLIB.
This class implements a block that computes the PVT solution using the RTKLIB integrated library.
std::map< int, Galileo_Ephemeris > get_galileo_ephemeris_map() const
Get latest set of Galileo ephemeris from PVT block.
std::map< int, Beidou_Dnav_Ephemeris > get_beidou_dnav_ephemeris_map() const
Get latest set of BeiDou DNAV ephemeris from PVT block.
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
PVT Signal Processing.
std::map< int, Beidou_Dnav_Almanac > get_beidou_dnav_almanac_map() const
Get latest set of BeiDou DNAV almanac from PVT block.
std::map< int, Gps_Ephemeris > get_gps_ephemeris_map() const
Get latest set of GPS ephemeris from PVT block.
std::map< int, Galileo_Almanac > get_galileo_almanac_map() const
Get latest set of Galileo almanac from PVT block.
bool get_latest_PVT(double *longitude_deg, double *latitude_deg, double *height_m, double *ground_speed_kmh, double *course_over_ground_deg, time_t *UTC_time) const
Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time,...
std::map< int, Gps_Almanac > get_gps_almanac_map() const
Get latest set of GPS almanac from PVT block.
~rtklib_pvt_gs()
Default destructor.
void clear_ephemeris()
Clear all ephemeris information and the almanacs for GPS and Galileo.
This interface represents a GNSS block.
This file implements std::make_unique for C++11.
Interface of the Gnss_Synchro class.
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)
Class for Galileo OSNMA data storage.
main header file for the rtklib library
Aggregates sensor samples from gnu radio stream tags into typed lists for easy access.