GNSS-SDR  0.0.19
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 
24 /** \addtogroup PVT
25  * \{ */
26 /** \addtogroup PVT_libs
27  * \{ */
28 
29 
30 /*!
31  * \brief Base class for a PVT solution
32  *
33  */
35 {
36 public:
37  Pvt_Solution() = default;
38  virtual ~Pvt_Solution() = default;
39 
40  virtual double get_hdop() const = 0;
41  virtual double get_vdop() const = 0;
42  virtual double get_pdop() const = 0;
43  virtual double get_gdop() const = 0;
44 
45  std::array<double, 3> get_rx_pos() const;
46  std::array<double, 3> get_rx_vel() const;
47  boost::posix_time::ptime get_position_UTC_time() const;
48  double get_latitude() const; //!< Get RX position Latitude WGS84 [deg]
49  double get_longitude() const; //!< Get RX position Longitude WGS84 [deg]
50  double get_height() const; //!< Get RX position height WGS84 [m]
51  double get_time_offset_s() const; //!< Get RX time offset [s]
52  double get_clock_drift_ppm() const; //!< Get the Rx clock drift [ppm]
53  double get_speed_over_ground() const; //!< Get RX speed over ground [m/s]
54  double get_course_over_ground() const; //!< Get RX course over ground [deg]
55  int get_num_valid_observations() const; //!< Get the number of valid pseudorange observations (valid satellites)
56  bool is_pre_2009() const;
57  bool is_valid_position() const;
58 
59  void set_rx_pos(const std::array<double, 3> &pos); //!< Set position: X, Y, Z in Cartesian ECEF coordinates [m]
60  void set_rx_vel(const std::array<double, 3> &vel); //!< Set velocity: East [m/s], North [m/s], Up [m/s]
61  void set_position_UTC_time(const boost::posix_time::ptime &pt);
62  void set_time_offset_s(double offset); //!< Set RX time offset [s]
63  void set_clock_drift_ppm(double clock_drift_ppm); //!< Set the Rx clock drift [ppm]
64  void set_speed_over_ground(double speed_m_s); //!< Set RX speed over ground [m/s]
65  void set_course_over_ground(double cog_deg); //!< Set RX course over ground [deg]
66  void set_valid_position(bool is_valid);
67  void set_num_valid_observations(int num); //!< Set the number of valid pseudorange observations (valid satellites)
68  void set_pre_2009_file(bool pre_2009_file); //!< Flag for the week rollover computation in post processing mode for signals older than 2009
69 
70 private:
71  /*
72  * Conversion of Cartesian coordinates (X,Y,Z) to geographical
73  * coordinates (d_latitude_d, d_longitude_d, d_height_m) on a selected reference ellipsoid.
74  *
75  * \param[in] X [m] Cartesian coordinate
76  * \param[in] Y [m] Cartesian coordinate
77  * \param[in] Z [m] Cartesian coordinate
78  * \param[in] elipsoid_selection. Choices of Reference Ellipsoid for Geographical Coordinates:
79  * 0 - International Ellipsoid 1924.
80  * 1 - International Ellipsoid 1967.
81  * 2 - World Geodetic System 1972.
82  * 3 - Geodetic Reference System 1980.
83  * 4 - World Geodetic System 1984.
84  *
85  */
86  int cart2geo(double X, double Y, double Z, int elipsoid_selection);
87 
88  std::array<double, 3> d_rx_pos{};
89  std::array<double, 3> d_rx_vel{};
90  boost::posix_time::ptime d_position_UTC_time;
91 
92  double d_latitude_d{0.0}; // RX position Latitude WGS84 [deg]
93  double d_longitude_d{0.0}; // RX position Longitude WGS84 [deg]
94  double d_height_m{0.0}; // RX position height WGS84 [m]
95  double d_rx_dt_s{0.0}; // RX time offset [s]
96  double d_rx_clock_drift_ppm{0.0}; // RX clock drift [ppm]
97  double d_speed_over_ground_m_s{0.0}; // RX speed over ground [m/s]
98  double d_course_over_ground_d{0.0}; // RX course over ground [deg]
99 
100  int d_valid_observations{0}; // Number of valid observations in this epoch
101 
102  bool d_pre_2009_file{false}; // Flag to correct week rollover in post processing mode for signals older than 2009
103  bool d_valid_position{false};
104 };
105 
106 
107 /** \} */
108 /** \} */
109 #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_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_clock_drift_ppm() const
Get the Rx clock drift [ppm].
double get_time_offset_s() const
Get RX time offset [s].
Base class for a PVT solution.
Definition: pvt_solution.h:34
void set_speed_over_ground(double speed_m_s)
Set RX speed over ground [m/s].