GNSS-SDR  0.0.17
An Open Source GNSS Software Defined Receiver
pvt_solution.h
Go to the documentation of this file.
1 /*!
2  * \file pvt_solution.h
3  * \brief Interface of a base class for a PVT solution
4  * \author Carles Fernandez-Prades, 2015. cfernandez(at)cttc.es
5  *
6  *
7  * -----------------------------------------------------------------------------
8  *
9  * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
10  * This file is part of GNSS-SDR.
11  *
12  * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
13  * SPDX-License-Identifier: GPL-3.0-or-later
14  *
15  * -----------------------------------------------------------------------------
16  */
17 
18 #ifndef GNSS_SDR_PVT_SOLUTION_H
19 #define GNSS_SDR_PVT_SOLUTION_H
20 
21 #include <boost/date_time/posix_time/posix_time.hpp>
22 #include <array>
23 #include <deque>
24 
25 /** \addtogroup PVT
26  * \{ */
27 /** \addtogroup PVT_libs
28  * \{ */
29 
30 
31 /*!
32  * \brief Base class for a PVT solution
33  *
34  */
36 {
37 public:
38  Pvt_Solution() = default;
39  virtual ~Pvt_Solution() = default;
40 
41  void set_rx_pos(const std::array<double, 3> &pos); //!< Set position: X, Y, Z in Cartesian ECEF coordinates [m]
42  void set_rx_vel(const std::array<double, 3> &vel); //!< Set velocity: East [m/s], North [m/s], Up [m/s]
43  void set_position_UTC_time(const boost::posix_time::ptime &pt);
44  void set_time_offset_s(double offset); //!< Set RX time offset [s]
45  void set_clock_drift_ppm(double clock_drift_ppm); //!< Set the Rx clock drift [ppm]
46  void set_speed_over_ground(double speed_m_s); //!< Set RX speed over ground [m/s]
47  void set_course_over_ground(double cog_deg); //!< Set RX course over ground [deg]
48  void set_valid_position(bool is_valid);
49  void set_num_valid_observations(int num); //!< Set the number of valid pseudorange observations (valid satellites)
50  void set_pre_2009_file(bool pre_2009_file); //!< Flag for the week rollover computation in post processing mode for signals older than 2009
51  // averaging
52  void set_averaging_depth(int depth); //!< Set length of averaging window
53  void set_averaging_flag(bool flag);
54  void perform_pos_averaging();
55 
56  std::array<double, 3> get_rx_pos() const;
57  std::array<double, 3> get_rx_vel() const;
58  boost::posix_time::ptime get_position_UTC_time() const;
59  double get_latitude() const; //!< Get RX position Latitude WGS84 [deg]
60  double get_longitude() const; //!< Get RX position Longitude WGS84 [deg]
61  double get_height() const; //!< Get RX position height WGS84 [m]
62  double get_time_offset_s() const; //!< Get RX time offset [s]
63  double get_clock_drift_ppm() const; //!< Get the Rx clock drift [ppm]
64  double get_speed_over_ground() const; //!< Get RX speed over ground [m/s]
65  double get_course_over_ground() const; //!< Get RX course over ground [deg]
66  double get_avg_latitude() const; //!< Get RX position averaged Latitude WGS84 [deg]
67  double get_avg_longitude() const; //!< Get RX position averaged Longitude WGS84 [deg]
68  double get_avg_height() const; //!< Get RX position averaged height WGS84 [m]
69  int get_num_valid_observations() const; //!< Get the number of valid pseudorange observations (valid satellites)
70  bool is_pre_2009() const;
71  bool is_valid_position() const;
72  bool is_averaging() const;
73 
74  virtual double get_hdop() const = 0;
75  virtual double get_vdop() const = 0;
76  virtual double get_pdop() const = 0;
77  virtual double get_gdop() const = 0;
78 
79 private:
80  /*
81  * Conversion of Cartesian coordinates (X,Y,Z) to geographical
82  * coordinates (d_latitude_d, d_longitude_d, d_height_m) on a selected reference ellipsoid.
83  *
84  * \param[in] X [m] Cartesian coordinate
85  * \param[in] Y [m] Cartesian coordinate
86  * \param[in] Z [m] Cartesian coordinate
87  * \param[in] elipsoid_selection. Choices of Reference Ellipsoid for Geographical Coordinates:
88  * 0 - International Ellipsoid 1924.
89  * 1 - International Ellipsoid 1967.
90  * 2 - World Geodetic System 1972.
91  * 3 - Geodetic Reference System 1980.
92  * 4 - World Geodetic System 1984.
93  *
94  */
95  int cart2geo(double X, double Y, double Z, int elipsoid_selection);
96 
97  std::array<double, 3> d_rx_pos{};
98  std::array<double, 3> d_rx_vel{};
99  boost::posix_time::ptime d_position_UTC_time;
100 
101  std::deque<double> d_hist_latitude_d;
102  std::deque<double> d_hist_longitude_d;
103  std::deque<double> d_hist_height_m;
104 
105  double d_latitude_d{0.0}; // RX position Latitude WGS84 [deg]
106  double d_longitude_d{0.0}; // RX position Longitude WGS84 [deg]
107  double d_height_m{0.0}; // RX position height WGS84 [m]
108  double d_rx_dt_s{0.0}; // RX time offset [s]
109  double d_rx_clock_drift_ppm{0.0}; // RX clock drift [ppm]
110  double d_speed_over_ground_m_s{0.0}; // RX speed over ground [m/s]
111  double d_course_over_ground_d{0.0}; // RX course over ground [deg]
112 
113  double d_avg_latitude_d{0.0}; // Averaged latitude in degrees
114  double d_avg_longitude_d{0.0}; // Averaged longitude in degrees
115  double d_avg_height_m{0.0}; // Averaged height [m]
116 
117  int d_averaging_depth{0}; // Length of averaging window
118  int d_valid_observations{0}; // Number of valid observations in this epoch
119 
120  bool d_pre_2009_file{false}; // Flag to correct week rollover in post processing mode for signals older than 2009
121  bool d_valid_position{false};
122  bool d_flag_averaging{false};
123 };
124 
125 
126 /** \} */
127 /** \} */
128 #endif // GNSS_SDR_PVT_SOLUTION_H
double get_latitude() const
Get RX position Latitude WGS84 [deg].
void set_clock_drift_ppm(double clock_drift_ppm)
Set the Rx clock drift [ppm].
void set_pre_2009_file(bool pre_2009_file)
Flag for the week rollover computation in post processing mode for signals older than 2009...
double get_speed_over_ground() const
Get RX speed over ground [m/s].
double get_height() const
Get RX position height WGS84 [m].
int get_num_valid_observations() const
Get the number of valid pseudorange observations (valid satellites)
double get_course_over_ground() const
Get RX course over ground [deg].
void set_course_over_ground(double cog_deg)
Set RX course over ground [deg].
void set_num_valid_observations(int num)
Set the number of valid pseudorange observations (valid satellites)
void set_rx_pos(const std::array< double, 3 > &pos)
Set position: X, Y, Z in Cartesian ECEF coordinates [m].
double get_avg_height() const
Get RX position averaged height WGS84 [m].
double get_longitude() const
Get RX position Longitude WGS84 [deg].
void set_rx_vel(const std::array< double, 3 > &vel)
Set velocity: East [m/s], North [m/s], Up [m/s].
void set_time_offset_s(double offset)
Set RX time offset [s].
double get_avg_latitude() const
Get RX position averaged Latitude WGS84 [deg].
void set_averaging_depth(int depth)
Set length of averaging window.
double get_clock_drift_ppm() const
Get the Rx clock drift [ppm].
double get_time_offset_s() const
Get RX time offset [s].
double get_avg_longitude() const
Get RX position averaged Longitude WGS84 [deg].
Base class for a PVT solution.
Definition: pvt_solution.h:35
void set_speed_over_ground(double speed_m_s)
Set RX speed over ground [m/s].