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