2017-04-20 14:10:12 +00:00
|
|
|
|
/*!
|
2019-03-02 01:21:03 +00:00
|
|
|
|
* \file rtklib_pvt_gs.h
|
2017-04-20 14:10:12 +00:00
|
|
|
|
* \brief Interface of a Position Velocity and Time computation block
|
|
|
|
|
* \author Javier Arribas, 2017. jarribas(at)cttc.es
|
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
|
* -----------------------------------------------------------------------------
|
2017-04-20 14:10:12 +00:00
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
|
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
2017-04-20 14:10:12 +00:00
|
|
|
|
*
|
|
|
|
|
* GNSS-SDR is a software defined Global Navigation
|
|
|
|
|
* Satellite Systems receiver
|
|
|
|
|
*
|
|
|
|
|
* This file is part of GNSS-SDR.
|
|
|
|
|
*
|
2020-02-08 00:20:02 +00:00
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2017-04-20 14:10:12 +00:00
|
|
|
|
*
|
2020-07-28 14:57:15 +00:00
|
|
|
|
* -----------------------------------------------------------------------------
|
2017-04-20 14:10:12 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
|
#ifndef GNSS_SDR_RTKLIB_PVT_GS_H
|
|
|
|
|
#define GNSS_SDR_RTKLIB_PVT_GS_H
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2019-02-26 00:38:48 +00:00
|
|
|
|
#include "gnss_synchro.h"
|
2019-03-05 07:59:04 +00:00
|
|
|
|
#include "rtklib.h"
|
2018-11-07 18:27:26 +00:00
|
|
|
|
#include <boost/date_time/gregorian/gregorian.hpp>
|
2018-12-09 21:00:09 +00:00
|
|
|
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
2019-03-05 07:59:04 +00:00
|
|
|
|
#include <gnuradio/sync_block.h> // for sync_block
|
|
|
|
|
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
|
|
|
|
#include <pmt/pmt.h> // for pmt_t
|
|
|
|
|
#include <chrono> // for system_clock
|
2020-07-19 07:39:32 +00:00
|
|
|
|
#include <cstddef> // for size_t
|
2019-03-05 07:59:04 +00:00
|
|
|
|
#include <cstdint> // for int32_t
|
|
|
|
|
#include <ctime> // for time_t
|
|
|
|
|
#include <map> // for map
|
|
|
|
|
#include <memory> // for shared_ptr, unique_ptr
|
|
|
|
|
#include <string> // for string
|
|
|
|
|
#include <sys/types.h> // for key_t
|
|
|
|
|
#include <vector> // for vector
|
2020-04-02 21:59:35 +00:00
|
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
|
|
|
|
#else
|
|
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
#endif
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2019-03-05 07:59:04 +00:00
|
|
|
|
class Beidou_Dnav_Almanac;
|
|
|
|
|
class Beidou_Dnav_Ephemeris;
|
|
|
|
|
class Galileo_Almanac;
|
|
|
|
|
class Galileo_Ephemeris;
|
|
|
|
|
class GeoJSON_Printer;
|
|
|
|
|
class Gps_Almanac;
|
|
|
|
|
class Gps_Ephemeris;
|
|
|
|
|
class Gpx_Printer;
|
|
|
|
|
class Kml_Printer;
|
|
|
|
|
class Monitor_Pvt_Udp_Sink;
|
|
|
|
|
class Nmea_Printer;
|
|
|
|
|
class Pvt_Conf;
|
|
|
|
|
class Rinex_Printer;
|
|
|
|
|
class Rtcm_Printer;
|
|
|
|
|
class Rtklib_Solver;
|
2019-03-02 01:21:03 +00:00
|
|
|
|
class rtklib_pvt_gs;
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2020-04-02 21:59:35 +00:00
|
|
|
|
#if GNURADIO_USES_STD_POINTERS
|
2020-04-02 11:23:20 +00:00
|
|
|
|
using rtklib_pvt_gs_sptr = std::shared_ptr<rtklib_pvt_gs>;
|
2020-04-02 21:59:35 +00:00
|
|
|
|
#else
|
|
|
|
|
using rtklib_pvt_gs_sptr = boost::shared_ptr<rtklib_pvt_gs>;
|
|
|
|
|
#endif
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2019-03-02 01:21:03 +00:00
|
|
|
|
rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
|
2018-10-27 22:42:28 +00:00
|
|
|
|
const Pvt_Conf& conf_,
|
2018-12-02 04:29:11 +00:00
|
|
|
|
const rtk_t& rtk);
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
|
|
|
|
/*!
|
2018-11-06 13:39:57 +00:00
|
|
|
|
* \brief This class implements a block that computes the PVT solution using the RTKLIB integrated library
|
2017-04-20 14:10:12 +00:00
|
|
|
|
*/
|
2019-03-02 01:21:03 +00:00
|
|
|
|
class rtklib_pvt_gs : public gr::sync_block
|
2017-04-20 14:10:12 +00:00
|
|
|
|
{
|
2019-07-01 21:44:42 +00:00
|
|
|
|
public:
|
|
|
|
|
~rtklib_pvt_gs(); //!< Default destructor
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get latest set of GPS ephemeris from PVT block
|
|
|
|
|
*/
|
|
|
|
|
std::map<int, Gps_Ephemeris> get_gps_ephemeris_map() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get latest set of GPS almanac from PVT block
|
|
|
|
|
*/
|
|
|
|
|
std::map<int, Gps_Almanac> get_gps_almanac_map() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get latest set of Galileo ephemeris from PVT block
|
|
|
|
|
*/
|
|
|
|
|
std::map<int, Galileo_Ephemeris> get_galileo_ephemeris_map() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get latest set of Galileo almanac from PVT block
|
|
|
|
|
*/
|
|
|
|
|
std::map<int, Galileo_Almanac> get_galileo_almanac_map() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get latest set of BeiDou DNAV ephemeris from PVT block
|
|
|
|
|
*/
|
|
|
|
|
std::map<int, Beidou_Dnav_Ephemeris> get_beidou_dnav_ephemeris_map() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get latest set of BeiDou DNAV almanac from PVT block
|
|
|
|
|
*/
|
|
|
|
|
std::map<int, Beidou_Dnav_Almanac> get_beidou_dnav_almanac_map() const;
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Clear all ephemeris information and the almanacs for GPS and Galileo
|
|
|
|
|
*/
|
|
|
|
|
void clear_ephemeris();
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* \brief Get the latest Position WGS84 [deg], Ground Velocity, Course over Ground, and UTC Time, if available
|
|
|
|
|
*/
|
|
|
|
|
bool get_latest_PVT(double* longitude_deg,
|
|
|
|
|
double* latitude_deg,
|
|
|
|
|
double* height_m,
|
|
|
|
|
double* ground_speed_kmh,
|
|
|
|
|
double* course_over_ground_deg,
|
|
|
|
|
time_t* UTC_time) const;
|
|
|
|
|
|
|
|
|
|
int work(int noutput_items, gr_vector_const_void_star& input_items,
|
|
|
|
|
gr_vector_void_star& output_items); //!< PVT Signal Processing
|
|
|
|
|
|
2017-04-20 14:10:12 +00:00
|
|
|
|
private:
|
2019-03-02 01:21:03 +00:00
|
|
|
|
friend rtklib_pvt_gs_sptr rtklib_make_pvt_gs(uint32_t nchannels,
|
2018-10-27 22:42:28 +00:00
|
|
|
|
const Pvt_Conf& conf_,
|
2018-12-02 04:29:11 +00:00
|
|
|
|
const rtk_t& rtk);
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2019-03-04 07:12:50 +00:00
|
|
|
|
rtklib_pvt_gs(uint32_t nchannels,
|
|
|
|
|
const Pvt_Conf& conf_,
|
|
|
|
|
const rtk_t& rtk);
|
|
|
|
|
|
2020-06-19 10:39:28 +00:00
|
|
|
|
void msg_handler_telemetry(const pmt::pmt_t& msg);
|
|
|
|
|
|
|
|
|
|
void initialize_and_apply_carrier_phase_offset();
|
|
|
|
|
|
|
|
|
|
void apply_rx_clock_offset(std::map<int, Gnss_Synchro>& observables_map,
|
|
|
|
|
double rx_clock_offset_s);
|
|
|
|
|
|
|
|
|
|
std::map<int, Gnss_Synchro> interpolate_observables(const std::map<int, Gnss_Synchro>& observables_map_t0,
|
|
|
|
|
const std::map<int, Gnss_Synchro>& observables_map_t1,
|
|
|
|
|
double rx_time_s);
|
|
|
|
|
|
|
|
|
|
inline std::time_t convert_to_time_t(const boost::posix_time::ptime pt) const
|
2019-07-31 16:16:09 +00:00
|
|
|
|
{
|
2020-06-19 10:39:28 +00:00
|
|
|
|
return (pt - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))).total_seconds();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> split_string(const std::string& s, char delim) const;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
long mtype; // NOLINT(google-runtime-int) required by SysV queue messaging
|
|
|
|
|
double ttff;
|
|
|
|
|
} d_ttff_msgbuf;
|
|
|
|
|
bool send_sys_v_ttff_msg(d_ttff_msgbuf ttff);
|
|
|
|
|
|
|
|
|
|
bool save_gnss_synchro_map_xml(const std::string& file_name); // debug helper function
|
|
|
|
|
bool load_gnss_synchro_map_xml(const std::string& file_name); // debug helper function
|
2019-08-01 18:09:35 +00:00
|
|
|
|
|
2020-06-25 00:50:07 +00:00
|
|
|
|
std::shared_ptr<Rtklib_Solver> d_internal_pvt_solver;
|
|
|
|
|
std::shared_ptr<Rtklib_Solver> d_user_pvt_solver;
|
|
|
|
|
|
2020-06-18 23:36:36 +00:00
|
|
|
|
std::unique_ptr<Rinex_Printer> d_rp;
|
2020-06-18 09:49:28 +00:00
|
|
|
|
std::unique_ptr<Kml_Printer> d_kml_dump;
|
|
|
|
|
std::unique_ptr<Gpx_Printer> d_gpx_dump;
|
|
|
|
|
std::unique_ptr<Nmea_Printer> d_nmea_printer;
|
|
|
|
|
std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
|
|
|
|
|
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
|
2020-06-18 23:36:36 +00:00
|
|
|
|
std::unique_ptr<Monitor_Pvt_Udp_Sink> d_udp_sink_ptr;
|
2018-10-27 22:42:28 +00:00
|
|
|
|
|
2020-06-18 23:36:36 +00:00
|
|
|
|
std::chrono::time_point<std::chrono::system_clock> d_start;
|
|
|
|
|
std::chrono::time_point<std::chrono::system_clock> d_end;
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2020-06-18 23:36:36 +00:00
|
|
|
|
std::string d_dump_filename;
|
|
|
|
|
std::string d_xml_base_path;
|
|
|
|
|
std::string d_local_time_str;
|
2020-02-06 15:56:42 +00:00
|
|
|
|
|
2020-06-18 23:36:36 +00:00
|
|
|
|
std::vector<bool> d_channel_initialized;
|
|
|
|
|
std::vector<double> d_initial_carrier_phase_offset_estimation_rads;
|
2017-04-20 14:10:12 +00:00
|
|
|
|
|
2020-06-19 10:39:28 +00:00
|
|
|
|
enum StringValue_
|
|
|
|
|
{
|
|
|
|
|
evGPS_1C,
|
|
|
|
|
evGPS_2S,
|
|
|
|
|
evGPS_L5,
|
|
|
|
|
evSBAS_1C,
|
|
|
|
|
evGAL_1B,
|
|
|
|
|
evGAL_5X,
|
|
|
|
|
evGLO_1G,
|
|
|
|
|
evGLO_2G,
|
|
|
|
|
evBDS_B1,
|
|
|
|
|
evBDS_B2,
|
|
|
|
|
evBDS_B3
|
|
|
|
|
};
|
|
|
|
|
std::map<std::string, StringValue_> d_mapStringValues;
|
2020-06-18 23:36:36 +00:00
|
|
|
|
std::map<int, Gnss_Synchro> d_gnss_observables_map;
|
|
|
|
|
std::map<int, Gnss_Synchro> d_gnss_observables_map_t0;
|
|
|
|
|
std::map<int, Gnss_Synchro> d_gnss_observables_map_t1;
|
|
|
|
|
|
|
|
|
|
boost::posix_time::time_duration d_utc_diff_time;
|
2020-06-23 07:47:58 +00:00
|
|
|
|
|
2020-07-19 07:39:32 +00:00
|
|
|
|
size_t d_gps_ephemeris_sptr_type_hash_code;
|
|
|
|
|
size_t d_gps_iono_sptr_type_hash_code;
|
|
|
|
|
size_t d_gps_utc_model_sptr_type_hash_code;
|
|
|
|
|
size_t d_gps_cnav_ephemeris_sptr_type_hash_code;
|
|
|
|
|
size_t d_gps_cnav_iono_sptr_type_hash_code;
|
|
|
|
|
size_t d_gps_cnav_utc_model_sptr_type_hash_code;
|
|
|
|
|
size_t d_gps_almanac_sptr_type_hash_code;
|
|
|
|
|
size_t d_galileo_ephemeris_sptr_type_hash_code;
|
|
|
|
|
size_t d_galileo_iono_sptr_type_hash_code;
|
|
|
|
|
size_t d_galileo_utc_model_sptr_type_hash_code;
|
|
|
|
|
size_t d_galileo_almanac_helper_sptr_type_hash_code;
|
|
|
|
|
size_t d_galileo_almanac_sptr_type_hash_code;
|
|
|
|
|
size_t d_glonass_gnav_ephemeris_sptr_type_hash_code;
|
|
|
|
|
size_t d_glonass_gnav_utc_model_sptr_type_hash_code;
|
|
|
|
|
size_t d_glonass_gnav_almanac_sptr_type_hash_code;
|
|
|
|
|
size_t d_beidou_dnav_ephemeris_sptr_type_hash_code;
|
|
|
|
|
size_t d_beidou_dnav_iono_sptr_type_hash_code;
|
|
|
|
|
size_t d_beidou_dnav_utc_model_sptr_type_hash_code;
|
|
|
|
|
size_t d_beidou_dnav_almanac_sptr_type_hash_code;
|
|
|
|
|
|
2020-06-23 07:47:58 +00:00
|
|
|
|
double d_rinex_version;
|
|
|
|
|
double d_rx_time;
|
|
|
|
|
|
|
|
|
|
key_t d_sysv_msg_key;
|
|
|
|
|
int d_sysv_msqid;
|
|
|
|
|
|
|
|
|
|
int32_t d_rinexobs_rate_ms;
|
|
|
|
|
int32_t d_rtcm_MT1045_rate_ms; // Galileo Broadcast Ephemeris
|
|
|
|
|
int32_t d_rtcm_MT1019_rate_ms; // GPS Broadcast Ephemeris (orbits)
|
|
|
|
|
int32_t d_rtcm_MT1020_rate_ms; // GLONASS Broadcast Ephemeris (orbits)
|
|
|
|
|
int32_t d_rtcm_MT1077_rate_ms; // The type 7 Multiple Signal Message format for the USA’s GPS system, popular
|
|
|
|
|
int32_t d_rtcm_MT1087_rate_ms; // GLONASS MSM7. The type 7 Multiple Signal Message format for the Russian GLONASS system
|
|
|
|
|
int32_t d_rtcm_MT1097_rate_ms; // Galileo MSM7. The type 7 Multiple Signal Message format for Europe’s Galileo system
|
|
|
|
|
int32_t d_rtcm_MSM_rate_ms;
|
|
|
|
|
int32_t d_kml_rate_ms;
|
|
|
|
|
int32_t d_gpx_rate_ms;
|
|
|
|
|
int32_t d_geojson_rate_ms;
|
|
|
|
|
int32_t d_nmea_rate_ms;
|
|
|
|
|
int32_t d_last_status_print_seg; // for status printer
|
|
|
|
|
int32_t d_output_rate_ms;
|
|
|
|
|
int32_t d_display_rate_ms;
|
|
|
|
|
int32_t d_report_rate_ms;
|
|
|
|
|
int32_t d_max_obs_block_rx_clock_offset_ms;
|
|
|
|
|
|
|
|
|
|
uint32_t d_nchannels;
|
|
|
|
|
uint32_t d_type_of_rx;
|
|
|
|
|
|
|
|
|
|
bool d_dump;
|
|
|
|
|
bool d_dump_mat;
|
|
|
|
|
bool d_rinex_output_enabled;
|
|
|
|
|
bool d_rinex_header_written;
|
|
|
|
|
bool d_rinex_header_updated;
|
|
|
|
|
bool d_geojson_output_enabled;
|
|
|
|
|
bool d_gpx_output_enabled;
|
|
|
|
|
bool d_kml_output_enabled;
|
|
|
|
|
bool d_nmea_output_file_enabled;
|
|
|
|
|
bool d_first_fix;
|
|
|
|
|
bool d_xml_storage;
|
|
|
|
|
bool d_flag_monitor_pvt_enabled;
|
|
|
|
|
bool d_show_local_time_zone;
|
|
|
|
|
bool d_waiting_obs_block_rx_clock_offset_correction_msg;
|
|
|
|
|
bool d_enable_rx_clock_correction;
|
|
|
|
|
bool d_rtcm_writing_started;
|
|
|
|
|
bool d_rtcm_enabled;
|
2017-04-20 14:10:12 +00:00
|
|
|
|
};
|
|
|
|
|
|
2020-02-08 09:10:46 +00:00
|
|
|
|
#endif // GNSS_SDR_RTKLIB_PVT_GS_H
|