GNSS-SDR  0.0.19
An Open Source GNSS Software Defined Receiver
rtcm_printer.h
Go to the documentation of this file.
1 /*!
2  * \file rtcm_printer.h
3  * \brief Interface of a RTCM 3.2 printer for GNSS-SDR
4  * This class provides a implementation of a subset of the RTCM Standard 10403.2
5  * for Differential GNSS Services
6  *
7  * \author Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es
8  *
9  * -----------------------------------------------------------------------------
10  *
11  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
12  * This file is part of GNSS-SDR.
13  *
14  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
15  * SPDX-License-Identifier: GPL-3.0-or-later
16  *
17  * -----------------------------------------------------------------------------
18  */
19 
20 #ifndef GNSS_SDR_RTCM_PRINTER_H
21 #define GNSS_SDR_RTCM_PRINTER_H
22 
23 #include <cstdint> // for int32_t
24 #include <fstream> // for std::ofstream
25 #include <map> // for std::map
26 #include <memory> // std::shared_ptr
27 #include <string>
28 
29 /** \addtogroup PVT
30  * \{ */
31 /** \addtogroup PVT_libs
32  * \{ */
33 
34 
35 class Galileo_Ephemeris;
38 class Gnss_Synchro;
39 class Gps_CNAV_Ephemeris;
40 class Gps_Ephemeris;
41 class Rtcm;
42 class Rtklib_Solver;
43 class Galileo_HAS_data;
44 
45 /*!
46  * \brief This class provides a implementation of a subset of the RTCM Standard 10403.2 messages
47  */
49 {
50 public:
51  /*!
52  * \brief Default constructor.
53  */
54  Rtcm_Printer(const std::string& filename,
55  bool flag_rtcm_file_dump,
56  bool flag_rtcm_server,
57  bool flag_rtcm_tty_port,
58  uint16_t rtcm_tcp_port,
59  uint16_t rtcm_station_id,
60  const std::string& rtcm_dump_devname,
61  bool time_tag_name = true,
62  const std::string& base_path = ".");
63 
64  /*!
65  * \brief Default destructor.
66  */
67  ~Rtcm_Printer();
68 
69  /*!
70  * \brief Print RTCM messages.
71  */
72  void Print_Rtcm_Messages(const Rtklib_Solver* pvt_solver,
73  const std::map<int, Gnss_Synchro>& gnss_observables_map,
74  double rx_time,
75  int32_t type_of_rx,
76  int32_t rtcm_MSM_rate_ms,
77  int32_t rtcm_MT1019_rate_ms,
78  int32_t rtcm_MT1020_rate_ms,
79  int32_t rtcm_MT1045_rate_ms,
80  int32_t rtcm_MT1077_rate_ms,
81  int32_t rtcm_MT1097_rate_ms,
82  bool flag_write_RTCM_MSM_output,
83  bool flag_write_RTCM_1019_output,
84  bool flag_write_RTCM_1020_output,
85  bool flag_write_RTCM_1045_output,
86  bool enable_rx_clock_correction);
87 
88  uint32_t lock_time(const Gps_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
89  uint32_t lock_time(const Gps_CNAV_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
90  uint32_t lock_time(const Galileo_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
91 
92  /*!
93  * \brief Locks time for logging given GLONASS GNAV Broadcast Ephemeris
94  * \note Code added as part of GSoC 2017 program
95  * \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
96  * \params obs_time Time of observation at the moment of printing
97  * \params observables Set of observables as defined by the platform
98  * \return locked time during logging process
99  */
100  uint32_t lock_time(const Glonass_Gnav_Ephemeris& eph, double obs_time, const Gnss_Synchro& gnss_synchro);
101 
102  void Print_IGM_Messages(const Galileo_HAS_data& has_data);
103 
104  std::string print_MT1005_test(); //!< For testing purposes
105 
106 private:
107  bool Print_Rtcm_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
108  bool Print_Rtcm_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
109  bool Print_Rtcm_MT1003(const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& cnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
110  bool Print_Rtcm_MT1004(const Gps_Ephemeris& gps_eph, const Gps_CNAV_Ephemeris& cnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
111 
112  /*
113  * \brief Prints L1-Only GLONASS RTK Observables
114  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
115  * \note Code added as part of GSoC 2017 program
116  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
117  * \param obs_time Time of observation at the moment of printing
118  * \param observables Set of observables as defined by the platform
119  * \return true or false upon operation success
120  */
121  bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
122 
123  /*
124  * \brief Prints Extended L1-Only GLONASS RTK Observables
125  * \details This GLONASS message type is used when only L1 data is present and bandwidth is very tight, often 1012 is used in such cases.
126  * \note Code added as part of GSoC 2017 program
127  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
128  * \param obs_time Time of observation at the moment of printing
129  * \param observables Set of observables as defined by the platform
130  * \return true or false upon operation success
131  */
132  bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
133 
134  /*
135  * \brief Prints L1&L2 GLONASS RTK Observables
136  * \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
137  * \note Code added as part of GSoC 2017 program
138  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
139  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
140  * \param obs_time Time of observation at the moment of printing
141  * \param observables Set of observables as defined by the platform
142  * \return true or false upon operation success
143  */
144  bool Print_Rtcm_MT1011(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
145 
146  /*
147  * \brief Prints Extended L1&L2 GLONASS RTK Observables
148  * \details This GLONASS message type is the most common observational message type, with L1/L2/SNR content. This is one of the most common messages found.
149  * \note Code added as part of GSoC 2017 program
150  * \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
151  * \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
152  * \param obs_time Time of observation at the moment of printing
153  * \param observables Set of observables as defined by the platform
154  * \return true or false upon operation success
155  */
156  bool Print_Rtcm_MT1012(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int32_t, Gnss_Synchro>& observables);
157 
158  bool Print_Rtcm_MT1019(const Gps_Ephemeris& gps_eph); // GPS Ephemeris, should be broadcast in the event that the IODC does not match the IODE, and every 2 minutes.
159  bool Print_Rtcm_MT1045(const Galileo_Ephemeris& gal_eph); // Galileo Ephemeris, should be broadcast every 2 minutes
160 
161  /*
162  * \brief Prints GLONASS GNAV Ephemeris
163  * \details This GLONASS message should be broadcast every 2 minutes
164  * \note Code added as part of GSoC 2017 program
165  * \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
166  * \param utc_model GLONASS GNAV Clock Information broadcast in string 5
167  * \return true or false upon operation success
168  */
169  bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& utc_model);
170 
171  bool Print_Rtcm_MSM(uint32_t msm_number,
172  const Gps_Ephemeris& gps_eph,
173  const Gps_CNAV_Ephemeris& gps_cnav_eph,
174  const Galileo_Ephemeris& gal_eph,
175  const Glonass_Gnav_Ephemeris& glo_gnav_eph,
176  double obs_time,
177  const std::map<int32_t, Gnss_Synchro>& observables,
178  uint32_t clock_steering_indicator,
179  uint32_t external_clock_indicator,
180  int32_t smooth_int,
181  bool divergence_free,
182  bool more_messages);
183 
184  bool Print_IGM01(const Galileo_HAS_data& has_data); // SSR Orbit Corrections
185  bool Print_IGM02(const Galileo_HAS_data& has_data); // SSR Clock Corrections
186  bool Print_IGM03(const Galileo_HAS_data& has_data); // SSR Combined Orbit & Clock Corrections
187  bool Print_IGM05(const Galileo_HAS_data& has_data); // SSR Bias Corrections
188 
189  int32_t init_serial(const std::string& serial_device); // serial port control
190  void close_serial() const;
191  bool Print_Message(const std::string& message);
192 
193  std::unique_ptr<Rtcm> rtcm;
194  std::ofstream rtcm_file_descriptor; // Output file stream for RTCM log file
195  std::string rtcm_filename; // String with the RTCM log filename
196  std::string rtcm_base_path;
197  std::string rtcm_devname;
198  int32_t rtcm_dev_descriptor; // RTCM serial device descriptor (i.e. COM port)
199  uint16_t port;
200  uint16_t station_id;
201  bool d_rtcm_writing_started;
202  bool d_rtcm_file_dump;
203 };
204 
205 
206 /** \} */
207 /** \} */
208 #endif // GNSS_SDR_RTCM_PRINTER_H
This is a storage class for the GPS CNAV ephemeris data as described in IS-GPS-200M.
This class is a storage and orbital model functions for the GPS SV ephemeris data as described in IS-...
Definition: gps_ephemeris.h:40
This class is a storage for Galileo HAS message type 1, as defined in Galileo High Accuracy Service S...
This class provides a implementation of a subset of the RTCM Standard 10403.2 messages.
Definition: rtcm_printer.h:48
This class is a storage and orbital model functions for the GLONASS SV ephemeris data as described in...
This class implements a PVT solution based on RTKLIB.
Definition: rtklib_solver.h:81
std::string print_MT1005_test()
For testing purposes.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This class implements the generation and reading of some Message Types defined in the RTCM 3...
Definition: rtcm.h:92
This class is a storage and orbital model functions for the Galileo SV ephemeris data as described in...
This class is a storage for the GLONASS GNAV UTC MODEL data as described in GLONASS ICD (Edition 5...
void Print_Rtcm_Messages(const Rtklib_Solver *pvt_solver, const std::map< int, Gnss_Synchro > &gnss_observables_map, double rx_time, int32_t type_of_rx, int32_t rtcm_MSM_rate_ms, int32_t rtcm_MT1019_rate_ms, int32_t rtcm_MT1020_rate_ms, int32_t rtcm_MT1045_rate_ms, int32_t rtcm_MT1077_rate_ms, int32_t rtcm_MT1097_rate_ms, bool flag_write_RTCM_MSM_output, bool flag_write_RTCM_1019_output, bool flag_write_RTCM_1020_output, bool flag_write_RTCM_1045_output, bool enable_rx_clock_correction)
Print RTCM messages.
~Rtcm_Printer()
Default destructor.
Rtcm_Printer(const std::string &filename, bool flag_rtcm_file_dump, bool flag_rtcm_server, bool flag_rtcm_tty_port, uint16_t rtcm_tcp_port, uint16_t rtcm_station_id, const std::string &rtcm_dump_devname, bool time_tag_name=true, const std::string &base_path=".")
Default constructor.