2017-04-20 14:10:12 +00:00
|
|
|
/*!
|
|
|
|
* \file rtklib_solver.h
|
|
|
|
* \brief PVT solver based on rtklib library functions adapted to the GNSS-SDR
|
|
|
|
* data flow and structures
|
|
|
|
* \authors <ul>
|
|
|
|
* <li> 2017, Javier Arribas
|
|
|
|
* <li> 2017, Carles Fernandez
|
|
|
|
* <li> 2007-2013, T. Takasu
|
|
|
|
* </ul>
|
|
|
|
*
|
|
|
|
* This is a derived work from RTKLIB http://www.rtklib.com/
|
|
|
|
* The original source code at https://github.com/tomojitakasu/RTKLIB is
|
|
|
|
* released under the BSD 2-clause license with an additional exclusive clause
|
|
|
|
* that does not apply here. This additional clause is reproduced below:
|
|
|
|
*
|
|
|
|
* " The software package includes some companion executive binaries or shared
|
|
|
|
* libraries necessary to execute APs on Windows. These licenses succeed to the
|
|
|
|
* original ones of these software. "
|
|
|
|
*
|
|
|
|
* Neither the executive binaries nor the shared libraries are required by, used
|
|
|
|
* or included in GNSS-SDR.
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------
|
|
|
|
* Copyright (C) 2007-2013, T. Takasu
|
|
|
|
* Copyright (C) 2017, Javier Arribas
|
|
|
|
* Copyright (C) 2017, Carles Fernandez
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
2017-05-08 19:30:41 +00:00
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* -------------------------------------------------------------------------*/
|
|
|
|
|
2017-04-20 14:10:12 +00:00
|
|
|
#ifndef GNSS_SDR_RTKLIB_SOLVER_H_
|
|
|
|
#define GNSS_SDR_RTKLIB_SOLVER_H_
|
|
|
|
|
2018-02-26 02:15:53 +00:00
|
|
|
|
2017-05-02 17:31:38 +00:00
|
|
|
#include "rtklib_rtkpos.h"
|
2017-04-20 14:10:12 +00:00
|
|
|
#include "galileo_navigation_message.h"
|
|
|
|
#include "gps_navigation_message.h"
|
|
|
|
#include "gps_cnav_navigation_message.h"
|
2017-07-18 03:09:10 +00:00
|
|
|
#include "glonass_gnav_navigation_message.h"
|
2018-10-24 15:28:12 +00:00
|
|
|
#include "galileo_almanac.h"
|
2017-04-20 14:10:12 +00:00
|
|
|
#include "gnss_synchro.h"
|
|
|
|
#include "pvt_solution.h"
|
2018-02-26 02:15:53 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief This class implements a simple PVT Least Squares solution
|
|
|
|
*/
|
|
|
|
class rtklib_solver : public Pvt_Solution
|
|
|
|
{
|
|
|
|
private:
|
2017-08-15 23:01:59 +00:00
|
|
|
rtk_t rtk_;
|
|
|
|
std::string d_dump_filename;
|
|
|
|
std::ofstream d_dump_file;
|
2018-10-31 13:56:59 +00:00
|
|
|
bool save_matfile();
|
2018-10-05 09:49:11 +00:00
|
|
|
|
2017-08-15 23:01:59 +00:00
|
|
|
bool d_flag_dump_enabled;
|
2018-10-31 13:56:59 +00:00
|
|
|
bool d_flag_dump_mat_enabled;
|
2017-08-15 23:01:59 +00:00
|
|
|
int d_nchannels; // Number of available channels for positioning
|
2018-05-07 07:13:45 +00:00
|
|
|
double dop_[4];
|
|
|
|
|
2017-04-20 14:10:12 +00:00
|
|
|
public:
|
2018-10-05 09:49:11 +00:00
|
|
|
sol_t pvt_sol;
|
2018-11-07 15:03:45 +00:00
|
|
|
ssat_t pvt_ssat[MAXSAT];
|
2018-12-02 04:29:11 +00:00
|
|
|
rtklib_solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t& rtk);
|
2017-04-20 14:10:12 +00:00
|
|
|
~rtklib_solver();
|
|
|
|
|
2018-06-02 10:55:00 +00:00
|
|
|
bool get_PVT(const std::map<int, Gnss_Synchro>& gnss_observables_map, bool flag_averaging);
|
2018-05-07 07:13:45 +00:00
|
|
|
double get_hdop() const;
|
|
|
|
double get_vdop() const;
|
|
|
|
double get_pdop() const;
|
|
|
|
double get_gdop() const;
|
2018-06-02 10:55:00 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
std::map<int, Galileo_Ephemeris> galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris
|
|
|
|
std::map<int, Gps_Ephemeris> gps_ephemeris_map; //!< Map storing new GPS_Ephemeris
|
|
|
|
std::map<int, Gps_CNAV_Ephemeris> gps_cnav_ephemeris_map; //!< Map storing new GPS_CNAV_Ephemeris
|
|
|
|
std::map<int, Glonass_Gnav_Ephemeris> glonass_gnav_ephemeris_map; //!< Map storing new GLONASS GNAV Ephmeris
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
|
|
Galileo_Utc_Model galileo_utc_model;
|
|
|
|
Galileo_Iono galileo_iono;
|
2018-10-24 15:28:12 +00:00
|
|
|
std::map<int, Galileo_Almanac> galileo_almanac_map;
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
|
|
Gps_Utc_Model gps_utc_model;
|
|
|
|
Gps_Iono gps_iono;
|
2018-10-25 09:01:29 +00:00
|
|
|
std::map<int, Gps_Almanac> gps_almanac_map;
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
|
|
Gps_CNAV_Iono gps_cnav_iono;
|
|
|
|
Gps_CNAV_Utc_Model gps_cnav_utc_model;
|
2017-08-16 15:33:29 +00:00
|
|
|
|
2018-03-03 01:03:39 +00:00
|
|
|
Glonass_Gnav_Utc_Model glonass_gnav_utc_model; //!< Map storing GLONASS GNAV UTC Model
|
|
|
|
Glonass_Gnav_Almanac glonass_gnav_almanac; //!< Map storing GLONASS GNAV Almanac Model
|
2017-07-18 03:09:10 +00:00
|
|
|
|
2017-08-16 15:33:29 +00:00
|
|
|
int count_valid_position;
|
2017-04-20 14:10:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|