GNSS-SDR  0.0.17
An Open Source GNSS Software Defined Receiver
hybrid_observables_gs.h
Go to the documentation of this file.
1 /*!
2  * \file hybrid_observables_gs.h
3  * \brief Interface of the observables computation block
4  * \author Mara Branzanti 2013. mara.branzanti(at)gmail.com
5  * \author Javier Arribas 2013. jarribas(at)cttc.es
6  * \author Antonio Ramos 2018. antonio.ramos(at)cttc.es
7  *
8  * -----------------------------------------------------------------------------
9  *
10  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
11  * This file is part of GNSS-SDR.
12  *
13  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
14  * SPDX-License-Identifier: GPL-3.0-or-later
15  *
16  * -----------------------------------------------------------------------------
17  */
18 
19 
20 #ifndef GNSS_SDR_HYBRID_OBSERVABLES_GS_H
21 #define GNSS_SDR_HYBRID_OBSERVABLES_GS_H
22 
23 #include "gnss_block_interface.h"
24 #include "gnss_time.h" // for timetags produced by Tracking
25 #include "obs_conf.h"
26 #include <boost/circular_buffer.hpp> // for boost::circular_buffer
27 #include <gnuradio/block.h> // for block
28 #include <gnuradio/types.h> // for gr_vector_int
29 #include <cstddef> // for size_t
30 #include <cstdint> // for int32_t
31 #include <fstream> // for std::ofstream
32 #include <map> // for std::map
33 #include <memory> // for std::shared, std:unique_ptr
34 #include <queue>
35 #include <string> // for std::string
36 #include <typeinfo> // for typeid
37 #include <vector> // for std::vector
38 
39 /** \addtogroup Observables
40  * \{ */
41 /** \addtogroup Observables_gnuradio_blocks obs_gr_blocks
42  * GNU Radio blocks for the computation of GNSS observables
43  * \{ */
44 
45 
46 class Gnss_Synchro;
48 
49 template <class T>
51 
52 using hybrid_observables_gs_sptr = gnss_shared_ptr<hybrid_observables_gs>;
53 
54 hybrid_observables_gs_sptr hybrid_observables_gs_make(const Obs_Conf& conf_);
55 
56 /*!
57  * \brief This class implements a block that computes observables
58  */
59 class hybrid_observables_gs : public gr::block
60 {
61 public:
63  void forecast(int noutput_items, gr_vector_int& ninput_items_required);
64  int general_work(int noutput_items, gr_vector_int& ninput_items,
65  gr_vector_const_void_star& input_items, gr_vector_void_star& output_items);
66 
67 private:
68  friend hybrid_observables_gs_sptr hybrid_observables_gs_make(const Obs_Conf& conf_);
69 
70  explicit hybrid_observables_gs(const Obs_Conf& conf_);
71 
72  const size_t d_double_type_hash_code = typeid(double).hash_code();
73 
74  void msg_handler_pvt_to_observables(const pmt::pmt_t& msg);
75  double compute_T_rx_s(const Gnss_Synchro& a) const;
76  bool interp_trk_obs(Gnss_Synchro& interpolated_obs, uint32_t ch, uint64_t rx_clock) const;
77  void update_TOW(const std::vector<Gnss_Synchro>& data);
78  void compute_pranges(std::vector<Gnss_Synchro>& data) const;
79  void smooth_pseudoranges(std::vector<Gnss_Synchro>& data);
80 
81  void set_tag_timestamp_in_sdr_timeframe(const std::vector<Gnss_Synchro>& data, uint64_t rx_clock);
82  int32_t save_matfile() const;
83 
84  Obs_Conf d_conf;
85 
86  enum StringValue_
87  {
88  evGPS_1C,
89  evGPS_2S,
90  evGPS_L5,
91  evSBAS_1C,
92  evGAL_1B,
93  evGAL_5X,
94  evGAL_E6,
95  evGAL_7X,
96  evGLO_1G,
97  evGLO_2G,
98  evBDS_B1,
99  evBDS_B2,
100  evBDS_B3
101  };
102  std::map<std::string, StringValue_> d_mapStringValues;
103 
104  std::unique_ptr<Gnss_circular_deque<Gnss_Synchro>> d_gnss_synchro_history; // Tracking observable history
105 
106  boost::circular_buffer<uint64_t> d_Rx_clock_buffer; // time history
107 
108  std::vector<std::queue<GnssTime>> d_SourceTagTimestamps;
109  std::queue<GnssTime> d_TimeChannelTagTimestamps;
110 
111  std::vector<bool> d_channel_last_pll_lock;
112  std::vector<double> d_channel_last_pseudorange_smooth;
113  std::vector<double> d_channel_last_carrier_phase_rads;
114 
115  std::string d_dump_filename;
116 
117  std::ofstream d_dump_file;
118 
119  double d_smooth_filter_M;
120  double d_T_rx_step_s;
121  double d_last_rx_clock_round20ms_error;
122 
123  uint32_t d_T_rx_TOW_ms;
124  uint32_t d_T_rx_step_ms;
125  uint32_t d_T_status_report_timer_ms;
126  uint32_t d_nchannels_in;
127  uint32_t d_nchannels_out;
128 
129  bool d_T_rx_TOW_set; // rx time follow GPST
130  bool d_always_output_gs;
131  bool d_dump;
132  bool d_dump_mat;
133 };
134 
135 /** \} */
136 /** \} */
137 #endif // GNSS_SDR_HYBRID_OBSERVABLES_GS_H
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)...
This class implements a block that computes observables.
This is the class that contains the information that is shared by the processing blocks.
Definition: gnss_synchro.h:38
This interface represents a GNSS block.
Class that contains all the configuration parameters for generic observables block.