2011-11-28 10:19:41 +00:00
|
|
|
/*!
|
|
|
|
* \file gps_l1_ca_ls_pvt.h
|
2011-12-28 21:36:45 +00:00
|
|
|
* \brief Interface of a Least Squares Position, Velocity, and Time (PVT)
|
|
|
|
* solver, based on K.Borre's Matlab receiver.
|
2011-11-28 10:19:41 +00:00
|
|
|
* \author Javier Arribas, 2011. jarribas(at)cttc.es
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
*
|
2012-01-10 09:49:09 +00:00
|
|
|
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
|
2011-11-28 10:19:41 +00:00
|
|
|
*
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
* Satellite Systems receiver
|
|
|
|
*
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* at your option) any later version.
|
|
|
|
*
|
|
|
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
2011-10-28 15:01:46 +00:00
|
|
|
*/
|
2011-12-28 03:05:37 +00:00
|
|
|
#ifndef GNSS_SDR_GPS_L1_CA_LS_PVT_H_
|
|
|
|
#define GNSS_SDR_GPS_L1_CA_LS_PVT_H_
|
2011-10-28 15:01:46 +00:00
|
|
|
|
- Major changes:
- The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively.
- Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature.
- Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file.
- Tracking blocks now uses DOUBLE values in their outputs.
- Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT
- Temporarily disabled the RINEX output (I am working on that!)
- GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file.
- Bug fixes:
- FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file.
- GPS_L1_CA_DLL_PLL now computes correctly the PRN start values.
- GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values.
- Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation.
- New features
- Tracking blocks perform a signal integrity check against NaN outliers before the correlation process.
- Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs"
- Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms.
- GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file.
- Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth.
- We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
|
|
|
#include <fstream>
|
2011-10-28 15:01:46 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
2013-07-04 13:47:40 +00:00
|
|
|
//#include <math.h>
|
|
|
|
#include <cmath>
|
2011-10-28 15:01:46 +00:00
|
|
|
#include <map>
|
|
|
|
#include <algorithm>
|
|
|
|
#include "gps_navigation_message.h"
|
|
|
|
#include "GPS_L1_CA.h"
|
2011-11-28 10:19:41 +00:00
|
|
|
#include "armadillo"
|
2012-04-11 10:43:35 +00:00
|
|
|
#include "boost/date_time/posix_time/posix_time.hpp"
|
2011-11-28 10:19:41 +00:00
|
|
|
|
2012-02-03 16:13:52 +00:00
|
|
|
#include "gnss_synchro.h"
|
2013-03-14 12:52:32 +00:00
|
|
|
#include "gps_ephemeris.h"
|
|
|
|
#include "gps_utc_model.h"
|
2012-02-03 16:13:52 +00:00
|
|
|
|
2012-08-28 17:14:18 +00:00
|
|
|
#define PVT_MAX_CHANNELS 24
|
|
|
|
|
2011-12-28 03:05:37 +00:00
|
|
|
/*!
|
|
|
|
* \brief This class implements a simple PVT Least Squares solution
|
|
|
|
*/
|
2011-10-28 15:01:46 +00:00
|
|
|
class gps_l1_ca_ls_pvt
|
|
|
|
{
|
|
|
|
private:
|
2011-11-28 10:52:52 +00:00
|
|
|
arma::vec leastSquarePos(arma::mat satpos, arma::vec obs, arma::mat w);
|
2012-09-02 16:53:59 +00:00
|
|
|
arma::vec rotateSatellite(double traveltime, arma::vec X_sat);
|
|
|
|
void topocent(double *Az, double *El, double *D, arma::vec x, arma::vec dx);
|
2012-08-28 17:14:18 +00:00
|
|
|
void togeod(double *dphi, double *dlambda, double *h, double a, double finv, double X, double Y, double Z);
|
2011-10-28 15:01:46 +00:00
|
|
|
public:
|
2011-12-28 03:05:37 +00:00
|
|
|
int d_nchannels; //! Number of available channels for positioning
|
2012-09-02 16:53:59 +00:00
|
|
|
int d_valid_observations; //! Number of valid pseudorange observations (valid satellites)
|
2012-08-28 17:14:18 +00:00
|
|
|
int d_visible_satellites_IDs[PVT_MAX_CHANNELS]; //! Array with the IDs of the valid satellites
|
2012-10-28 11:38:50 +00:00
|
|
|
double d_visible_satellites_El[PVT_MAX_CHANNELS]; //! Array with the LOS Elevation of the valid satellites
|
|
|
|
double d_visible_satellites_Az[PVT_MAX_CHANNELS]; //! Array with the LOS Azimuth of the valid satellites
|
|
|
|
double d_visible_satellites_Distance[PVT_MAX_CHANNELS]; //! Array with the LOS Distance of the valid satellites
|
|
|
|
double d_visible_satellites_CN0_dB[PVT_MAX_CHANNELS]; //! Array with the IDs of the valid satellites
|
2012-08-28 17:14:18 +00:00
|
|
|
|
2012-01-12 00:47:32 +00:00
|
|
|
Gps_Navigation_Message* d_ephemeris;
|
2013-03-14 12:52:32 +00:00
|
|
|
|
|
|
|
// new ephemeris storage
|
|
|
|
std::map<int,Gps_Ephemeris> gps_ephemeris_map;
|
|
|
|
// new utc_model storage
|
|
|
|
Gps_Utc_Model gps_utc_model;
|
|
|
|
// new iono storage
|
|
|
|
Gps_Iono gps_iono;
|
|
|
|
|
2012-04-11 10:43:35 +00:00
|
|
|
double d_GPS_current_time;
|
|
|
|
boost::posix_time::ptime d_position_UTC_time;
|
|
|
|
|
|
|
|
bool b_valid_position;
|
|
|
|
|
2011-12-28 03:05:37 +00:00
|
|
|
double d_latitude_d; //! Latitude in degrees
|
|
|
|
double d_longitude_d; //! Longitude in degrees
|
|
|
|
double d_height_m; //! Height [m]
|
2012-08-24 10:18:21 +00:00
|
|
|
|
- Major changes:
- The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively.
- Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature.
- Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file.
- Tracking blocks now uses DOUBLE values in their outputs.
- Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT
- Temporarily disabled the RINEX output (I am working on that!)
- GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file.
- Bug fixes:
- FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file.
- GPS_L1_CA_DLL_PLL now computes correctly the PRN start values.
- GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values.
- Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation.
- New features
- Tracking blocks perform a signal integrity check against NaN outliers before the correlation process.
- Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs"
- Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms.
- GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file.
- Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth.
- We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
|
|
|
//averaging
|
|
|
|
std::deque<double> d_hist_latitude_d;
|
|
|
|
std::deque<double> d_hist_longitude_d;
|
|
|
|
std::deque<double> d_hist_height_m;
|
2011-12-28 03:05:37 +00:00
|
|
|
int d_averaging_depth; //! Length of averaging window
|
- Major changes:
- The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively.
- Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature.
- Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file.
- Tracking blocks now uses DOUBLE values in their outputs.
- Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT
- Temporarily disabled the RINEX output (I am working on that!)
- GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file.
- Bug fixes:
- FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file.
- GPS_L1_CA_DLL_PLL now computes correctly the PRN start values.
- GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values.
- Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation.
- New features
- Tracking blocks perform a signal integrity check against NaN outliers before the correlation process.
- Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs"
- Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms.
- GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file.
- Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth.
- We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
|
|
|
|
2011-12-28 03:05:37 +00:00
|
|
|
double d_avg_latitude_d; //! Averaged latitude in degrees
|
|
|
|
double d_avg_longitude_d; //! Averaged longitude in degrees
|
|
|
|
double d_avg_height_m; //! Averaged height [m]
|
- Major changes:
- The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively.
- Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature.
- Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file.
- Tracking blocks now uses DOUBLE values in their outputs.
- Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT
- Temporarily disabled the RINEX output (I am working on that!)
- GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file.
- Bug fixes:
- FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file.
- GPS_L1_CA_DLL_PLL now computes correctly the PRN start values.
- GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values.
- Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation.
- New features
- Tracking blocks perform a signal integrity check against NaN outliers before the correlation process.
- Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs"
- Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms.
- GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file.
- Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth.
- We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
|
|
|
|
2011-10-28 15:01:46 +00:00
|
|
|
double d_x_m;
|
|
|
|
double d_y_m;
|
|
|
|
double d_z_m;
|
|
|
|
|
2012-08-24 10:18:21 +00:00
|
|
|
// DOP estimations
|
|
|
|
|
|
|
|
double d_GDOP;
|
|
|
|
double d_PDOP;
|
|
|
|
double d_HDOP;
|
|
|
|
double d_VDOP;
|
|
|
|
double d_TDOP;
|
|
|
|
|
- Major changes:
- The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively.
- Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature.
- Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file.
- Tracking blocks now uses DOUBLE values in their outputs.
- Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT
- Temporarily disabled the RINEX output (I am working on that!)
- GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file.
- Bug fixes:
- FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file.
- GPS_L1_CA_DLL_PLL now computes correctly the PRN start values.
- GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values.
- Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation.
- New features
- Tracking blocks perform a signal integrity check against NaN outliers before the correlation process.
- Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs"
- Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms.
- GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file.
- Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth.
- We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
|
|
|
bool d_flag_dump_enabled;
|
2012-08-28 17:14:18 +00:00
|
|
|
bool d_flag_averaging;
|
|
|
|
|
- Major changes:
- The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively.
- Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature.
- Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file.
- Tracking blocks now uses DOUBLE values in their outputs.
- Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT
- Temporarily disabled the RINEX output (I am working on that!)
- GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file.
- Bug fixes:
- FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file.
- GPS_L1_CA_DLL_PLL now computes correctly the PRN start values.
- GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values.
- Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation.
- New features
- Tracking blocks perform a signal integrity check against NaN outliers before the correlation process.
- Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs"
- Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms.
- GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file.
- Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth.
- We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
|
|
|
std::string d_dump_filename;
|
|
|
|
std::ofstream d_dump_file;
|
|
|
|
|
|
|
|
void set_averaging_depth(int depth);
|
|
|
|
|
|
|
|
gps_l1_ca_ls_pvt(int nchannels,std::string dump_filename, bool flag_dump_to_file);
|
2011-10-28 15:01:46 +00:00
|
|
|
~gps_l1_ca_ls_pvt();
|
|
|
|
|
2013-03-14 12:52:32 +00:00
|
|
|
bool get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, double GPS_current_time, bool flag_averaging);
|
2011-12-28 03:05:37 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Conversion of Cartesian coordinates (X,Y,Z) to geographical
|
|
|
|
* coordinates (d_latitude_d, d_longitude_d, d_height_m) on a selected reference ellipsoid.
|
|
|
|
*
|
|
|
|
* \param[in] X [m] Cartesian coordinate
|
|
|
|
* \param[in] Y [m] Cartesian coordinate
|
|
|
|
* \param[in] Z [m] Cartesian coordinate
|
2012-09-02 16:53:59 +00:00
|
|
|
* \param[in] elipsoid_selection. Choices of Reference Ellipsoid for Geographical Coordinates:
|
2012-01-10 09:49:09 +00:00
|
|
|
* 0 - International Ellipsoid 1924.
|
|
|
|
* 1 - International Ellipsoid 1967.
|
|
|
|
* 2 - World Geodetic System 1972.
|
|
|
|
* 3 - Geodetic Reference System 1980.
|
|
|
|
* 4 - World Geodetic System 1984.
|
2011-12-28 03:05:37 +00:00
|
|
|
*
|
|
|
|
*/
|
2011-10-28 15:01:46 +00:00
|
|
|
void cart2geo(double X, double Y, double Z, int elipsoid_selection);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|