From 11f53a3fcb4ad64ea71c0daf38fd3c79d6ac7832 Mon Sep 17 00:00:00 2001 From: Jim Melton Date: Wed, 22 Sep 2021 18:12:30 -0600 Subject: [PATCH] document PVT params; enable RTKLIB trace level to be set --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 62 +++++---- src/algorithms/PVT/adapters/rtklib_pvt.h | 125 ++++++++++++++++++ .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 4 + src/algorithms/PVT/libs/CMakeLists.txt | 1 - src/algorithms/PVT/libs/pvt_conf.cc | 71 ---------- src/algorithms/PVT/libs/pvt_conf.h | 92 +++++++------ 6 files changed, 209 insertions(+), 146 deletions(-) delete mode 100644 src/algorithms/PVT/libs/pvt_conf.cc diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 8b6c011bf..aa97d8de7 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -16,17 +16,18 @@ #include "rtklib_pvt.h" -#include "MATH_CONSTANTS.h" // for D2R -#include "configuration_interface.h" // for ConfigurationInterface -#include "galileo_almanac.h" // for Galileo_Almanac -#include "galileo_ephemeris.h" // for Galileo_Ephemeris -#include "gnss_sdr_flags.h" // for FLAGS_RINEX_version -#include "gps_almanac.h" // for Gps_Almanac -#include "gps_ephemeris.h" // for Gps_Ephemeris -#include "pvt_conf.h" // for Pvt_Conf -#include "rtklib_rtkpos.h" // for rtkfree, rtkinit -#include // for LOG -#include // for operator<< +#include "MATH_CONSTANTS.h" // for D2R +#include "configuration_interface.h" // for ConfigurationInterface +#include "galileo_almanac.h" // for Galileo_Almanac +#include "galileo_ephemeris.h" // for Galileo_Ephemeris +#include "gnss_sdr_flags.h" // for FLAGS_RINEX_version +#include "gnss_sdr_string_literals.h" // for std::string_literals +#include "gps_almanac.h" // for Gps_Almanac +#include "gps_ephemeris.h" // for Gps_Ephemeris +#include "pvt_conf.h" // for Pvt_Conf +#include "rtklib_rtkpos.h" // for rtkfree, rtkinit +#include // for LOG +#include // for std::cout #if USE_OLD_BOOST_MATH_COMMON_FACTOR #include namespace bc = boost::math; @@ -35,6 +36,7 @@ namespace bc = boost::math; namespace bc = boost::integer; #endif +using namespace std::string_literals; Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, const std::string& role, @@ -54,6 +56,8 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); pvt_output_parameters.dump_mat = configuration->property(role + ".dump_mat", true); + pvt_output_parameters.rtk_trace_level = configuration->property(role + ".rtk_trace_level"s, 0); + // Flag to postprocess old gnss records (older than 2009) and avoid wrong week rollover pvt_output_parameters.pre_2009_file = configuration->property("GNSS-SDR.pre_2009_file", false); @@ -442,10 +446,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, if (positioning_mode == -1) { // warn user and set the default - std::cout << "WARNING: Bad specification of positioning mode.\n"; - std::cout << "positioning_mode possible values: Single / Static / Kinematic / PPP_Static / PPP_Kinematic\n"; - std::cout << "positioning_mode specified value: " << positioning_mode_str << '\n'; - std::cout << "Setting positioning_mode to Single\n"; + std::cout << "WARNING: Bad specification of positioning mode.\n" + << "positioning_mode possible values: Single / Static / Kinematic / PPP_Static / PPP_Kinematic\n" + << "positioning_mode specified value: " << positioning_mode_str << "\n" + << "Setting positioning_mode to Single\n" + << std::flush; positioning_mode = PMODE_SINGLE; } @@ -529,10 +534,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, if (iono_model == -1) { // warn user and set the default - std::cout << "WARNING: Bad specification of ionospheric model.\n"; - std::cout << "iono_model possible values: OFF / Broadcast / SBAS / Iono-Free-LC / Estimate_STEC / IONEX\n"; - std::cout << "iono_model specified value: " << iono_model_str << '\n'; - std::cout << "Setting iono_model to OFF\n"; + std::cout << "WARNING: Bad specification of ionospheric model.\n" + << "iono_model possible values: OFF / Broadcast / SBAS / Iono-Free-LC / Estimate_STEC / IONEX\n" + << "iono_model specified value: " << iono_model_str << "\n" + << "Setting iono_model to OFF\n" + << std::flush; iono_model = IONOOPT_OFF; /* 0: ionosphere option: correction off */ } @@ -562,10 +568,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, if (trop_model == -1) { // warn user and set the default - std::cout << "WARNING: Bad specification of tropospheric model.\n"; - std::cout << "trop_model possible values: OFF / Saastamoinen / SBAS / Estimate_ZTD / Estimate_ZTD_Grad\n"; - std::cout << "trop_model specified value: " << trop_model_str << '\n'; - std::cout << "Setting trop_model to OFF\n"; + std::cout << "WARNING: Bad specification of tropospheric model.\n" + << "trop_model possible values: OFF / Saastamoinen / SBAS / Estimate_ZTD / Estimate_ZTD_Grad\n" + << "trop_model specified value: " << trop_model_str << "\n" + << "Setting trop_model to OFF\n" + << std::flush; trop_model = TROPOPT_OFF; } @@ -640,10 +647,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, if (integer_ambiguity_resolution_gps == -1) { // warn user and set the default - std::cout << "WARNING: Bad specification of GPS ambiguity resolution method.\n"; - std::cout << "AR_GPS possible values: OFF / Continuous / Instantaneous / Fix-and-Hold / PPP-AR\n"; - std::cout << "AR_GPS specified value: " << integer_ambiguity_resolution_gps_str << '\n'; - std::cout << "Setting AR_GPS to OFF\n"; + std::cout << "WARNING: Bad specification of GPS ambiguity resolution method.\n" + << "AR_GPS possible values: OFF / Continuous / Instantaneous / Fix-and-Hold / PPP-AR\n" + << "AR_GPS specified value: " << integer_ambiguity_resolution_gps_str << "\n" + << "Setting AR_GPS to OFF\n" + << std::flush; integer_ambiguity_resolution_gps = ARMODE_OFF; } diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.h b/src/algorithms/PVT/adapters/rtklib_pvt.h index 18f17f4d6..57fb22c4c 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.h +++ b/src/algorithms/PVT/adapters/rtklib_pvt.h @@ -44,6 +44,131 @@ class Gps_Ephemeris; /*! * \brief This class implements a PvtInterface for the RTKLIB PVT block + * + * Global configuration options used: + * + * GNSS-SDR.pre_2009_file - flag indicating a file older than 2009 rollover should be processed (false) + * GNSS-SDR.observable_interval_ms - (20) + * + * It supports the following configuration options: + * + * .dump - (false) + * .dump_filename - ("./pvt.dat") + * .dump_mat - (true) + * .rtk_trace_level - debug level for the RTKLIB methods (0) + * + * .output_rate_ms - (500) + * Note that the actual rate is the least common multiple of this value and GNSS-SDR.observable_interval_ms + * .display_rate_ms - (500) + * + * .flag_nmea_tty_port - (false) + * .nmea_dump_filename - ("./nmea_pvt.nmea") + * .nmea_dump_devname - ("/dev/tty1") + * + * .rinex_version - (3) overridden by -RINEX_version=n.nn command line argument + * .rinexobs_rate_ms - rate at which RINEX observations are written (1000). Note that + * the actual rate is the least common multiple of this value and + * .output_rate_ms + * .rinex_name - (-RINEX_name command-line argument) + * + * .flag_rtcm_tty_port - (false) + * .rtcm_dump_devname - ("/dev/pts/1") + * .flag_rtcm_server - (false) + * .rtcm_tcp_port - (2101) + * .rtcm_station_id - (1234) + * Output rates ... all values are LCM with the computed output rate (above) + * .rtcm_MT1019_rate_ms - (5000) + * .rtcm_MT1020_rate_ms - (5000) + * .rtcm_MT1045_rate_ms - (5000) + * .rtcm_MSM_rate_ms - (1000) + * .rtcm_MT1077_rate_ms - (.rtcm_MSM_rate_ms) + * .rtcm_MT1087_rate_ms - (.rtcm_MSM_rate_ms) + * .rtcm_MT1097_rate_ms - (.rtcm_MSM_rate_ms) + * + * .kml_rate_ms - (1000) + * .gpx_rate_ms - (1000) + * .geojson_rate_ms - (1000) + * .nmea_rate_ms - (1000) + * + * .positioning_mode - The RTKLIB positioning mode. ("Single") Supported values are "Single", + * "Static", "Kinematic", "PPP_Static" and "PPP_Kinematic". Unsupported modes + * include DGPS/DGNSS, Moving Baseline, Fixed, and PPP-fixed + * .num_bands - number of frequencies to use, between 1 and 3. Default is based on the channels configured + * .elevation_mask - (15.0). Value must be in the range [0,90.0] + * .dynamics_model - (0) 0:none, 1:velocity, 2:acceleration + + * .iono_model - ("OFF"). Supported values are "OFF", "Broadcast", "SBAS", "Iono-Free-LC", + * "Estimate_STEC", "IONEX". Unsupported values include QZSS broadcast, QZSS + * LEX, and SLANT TEC. + * .trop_model - ("OFF"). Supported values are "OFF", "Saastamoinen", "SBAS", "Estimate_ZTD", and + * "Estimate_ZTD_Grad". Unsupported values include ZTD correction and ZTD+grad + * correction + * .phwindup - phase windup correction for PPP modes (0) + * .reject_GPS_IIA - whether the GPS Block IIA satellites in eclipse are excluded (0). Only applies in PPP-* modes + * .raim_fde - whether RAIM (receiver autonomous integrity monitoring) FDE (fault detection and exclusion) is enabled (0) + * .earth_tide - (0) + * .navigation_system - mask of navigation systems to use. Default based on configured channels + * 0x01:GPS, 0x02:SBAS, 0x04:GLONASS, 0x08:Galileo, 0x10:QZSS, 0x20:BeiDou, + * 0x40:IRNS, 0x80:LEO + * + * .AR_GPS - Ambiguity Resolution mode for GPS ("Continuous"). Supported values are "OFF", + * "Continuous", "Instantaneous", "Fix-and-Hold", "PPP-AR". Unsupported values + * include PPP-AR ILS, WLNL, and TCAR. + * .AR_GLO - Ambiguity Resolution mode for GLONASS (1). Value must be in the range [0,3]. (0:off,1:on,2:auto cal,3:ext cal) + * .AR_DBS - Ambiguity Resolution Mode for BeiDou (1). Value must be in the range [0,1]. (0:off,1:on) + * .min_ratio_to_fix_ambiguity - (3.0) + * .min_lock_to_fix_ambiguity - (0) + * .min_elevation_to_fix_ambiguity - minimum elevation (deg) to fix integer ambiguity (0.0) + * .outage_reset_ambiguity - (5) + * .slip_threshold - (0.05) + * .threshold_reject_gdop - if GDOP is over this value, the observable is excluded (30.0) + * .threshold_reject_innovation - if innovation is over this value, the observable is excluded (30.0) + * .number_filter_iter - number of iterations for the estimation filter (1) + * .bias_0 - (30.0) + * .iono_0 - (0.03) + * .trop_0 - (0.3) + * .sigma_bias - process noise stddev of carrier-phase bias(ambiguity)(cycle/sqrt(s)) (1e-4) + * .sigma_iono - process noise stddev of vertical ionospheric delay per 10km baseline (m/sqrt(s)) (1e-3) + * .sigma_trop - process noise stddev of zenith tropospheric delay (m/sqrt(s)) (1e-4) + * .sigma_acch - process noise stddev of the receiver acceleration horizontal component (m/s2/sqrt(s)) (1e-1) + * .sigma_accv - process noise stddev of the receiver acceleration vertical component (m/s2/sqrt(s)) (1e-2) + * .sigma_pos - (0.0) + * .code_phase_error_ratio_l1 - (100.0) + * .code_phase_error_ratio_l2 - (100.0) + * .code_phase_error_ratio_l5 - (100.0) + * .carrier_phase_error_factor_a - (0.003) + * .carrier_phase_error_factor_b - (0.003) + * + * .output_enabled - (true) + * .rinex_output_enabled - (.output_enabled) + * .gpx_output_enabled - (.output_enabled) + * .geojson_output_enabled - (.output_enabled) + * .kml_output_enabled - (.output_enabled) + * .xml_output_enabled - (.output_enabled) + * .nmea_output_enabled - (.output_enabled) + * .rtcm_output_enabled - (false) + + * .output_path - directory to which output files are written (".") + * .rinex_output_path - (.output_path) + * .gpx_output_path - (.output_path) + * .geojson_output_path - (.output_path) + * .kml_output_path - (.output_path) + * .xml_output_path - (.output_path) + * .nmea_output_path - (.output_path) + * .rtcm_output_path - (.output_path) + * + * .enable_monitor - enable the PVT monitor (false) + * .monitor_client_addresses - ("127.0.0.1") + * .monitor_udp_port - DO NOT USE THE DEFAULT (1234) + * .enable_protobuf - serialize using protocol buffers (true). Monitor.enable_protobuf if true, sets this to true + * + * .enable_monitor_ephemeris - enable the ephemeris monitor (false) + * .monitor_ephemeris_client_addresses - ("127.0.0.1") + * .monitor_ephemeris_udp_port - DO NOT USE THE DEFAULT (1234) + * + * .show_local_time_zone - (false) + * .enable_rx_clock_correction - (false) + * .max_clock_offset_ms - (40) */ class Rtklib_Pvt : public PvtInterface { diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 6ccbb01f9..aacc65fe4 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -53,6 +53,7 @@ #include "pvt_conf.h" #include "rinex_printer.h" #include "rtcm_printer.h" +#include "rtklib_rtkcmn.h" #include "rtklib_solver.h" #include // for any_cast, any #include // for xml_iarchive @@ -538,6 +539,9 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_beidou_dnav_almanac_sptr_type_hash_code = typeid(std::shared_ptr).hash_code(); d_galileo_has_data_sptr_type_hash_code = typeid(std::shared_ptr).hash_code(); + // set the RTKLIB trace (debug) level + tracelevel(conf_.rtk_trace_level); + d_start = std::chrono::system_clock::now(); } diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 21f49d2d2..3047b1e95 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -9,7 +9,6 @@ protobuf_generate_cpp(PROTO_SRCS2 PROTO_HDRS2 ${CMAKE_SOURCE_DIR}/docs/protobuf/ protobuf_generate_cpp(PROTO_SRCS3 PROTO_HDRS3 ${CMAKE_SOURCE_DIR}/docs/protobuf/galileo_ephemeris.proto) set(PVT_LIB_SOURCES - pvt_conf.cc pvt_solution.cc geojson_printer.cc gpx_printer.cc diff --git a/src/algorithms/PVT/libs/pvt_conf.cc b/src/algorithms/PVT/libs/pvt_conf.cc deleted file mode 100644 index f5c73401a..000000000 --- a/src/algorithms/PVT/libs/pvt_conf.cc +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * \file pvt_conf.cc - * \brief Class that contains all the configuration parameters for a PVT block - * \author Carles Fernandez, 2018. cfernandez(at)cttc.es - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "pvt_conf.h" - -Pvt_Conf::Pvt_Conf() -{ - type_of_receiver = 0U; - observable_interval_ms = 20U; - output_rate_ms = 0; - display_rate_ms = 0; - kml_rate_ms = 1000; - gpx_rate_ms = 1000; - geojson_rate_ms = 1000; - nmea_rate_ms = 1000; - - max_obs_block_rx_clock_offset_ms = 40; - rinex_version = 0; - rinexobs_rate_ms = 0; - rinex_name = std::string("-"); - - dump = false; - dump_mat = true; - - flag_nmea_tty_port = false; - - flag_rtcm_server = false; - flag_rtcm_tty_port = false; - rtcm_tcp_port = 0U; - rtcm_station_id = 0U; - - output_enabled = true; - rinex_output_enabled = true; - gpx_output_enabled = true; - geojson_output_enabled = true; - nmea_output_file_enabled = true; - kml_output_enabled = true; - xml_output_enabled = true; - rtcm_output_file_enabled = true; - - output_path = std::string("."); - rinex_output_path = std::string("."); - gpx_output_path = std::string("."); - geojson_output_path = std::string("."); - nmea_output_file_path = std::string("."); - kml_output_path = std::string("."); - xml_output_path = std::string("."); - rtcm_output_file_path = std::string("."); - - enable_rx_clock_correction = true; - monitor_enabled = false; - monitor_ephemeris_enabled = false; - protobuf_enabled = true; - udp_port = 0; - udp_eph_port = 0; - pre_2009_file = false; - show_local_time_zone = false; -} diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index bd92de550..bf6271417 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -27,66 +27,64 @@ * \{ */ -class Pvt_Conf +struct Pvt_Conf { -public: - Pvt_Conf(); - std::map rtcm_msg_rate_ms; - std::string rinex_name; + std::string rinex_name = std::string("-"); std::string dump_filename; std::string nmea_dump_filename; std::string nmea_dump_devname; std::string rtcm_dump_devname; - std::string output_path; - std::string rinex_output_path; - std::string gpx_output_path; - std::string geojson_output_path; - std::string nmea_output_file_path; - std::string kml_output_path; - std::string xml_output_path; - std::string rtcm_output_file_path; + std::string output_path = std::string("."); + std::string rinex_output_path = std::string("."); + std::string gpx_output_path = std::string("."); + std::string geojson_output_path = std::string("."); + std::string nmea_output_file_path = std::string("."); + std::string kml_output_path = std::string("."); + std::string xml_output_path = std::string("."); + std::string rtcm_output_file_path = std::string("."); std::string udp_addresses; std::string udp_eph_addresses; - uint32_t type_of_receiver; - uint32_t observable_interval_ms; + uint32_t type_of_receiver = 0; + uint32_t observable_interval_ms = 20; - int32_t output_rate_ms; - int32_t display_rate_ms; - int32_t kml_rate_ms; - int32_t gpx_rate_ms; - int32_t geojson_rate_ms; - int32_t nmea_rate_ms; - int32_t rinex_version; - int32_t rinexobs_rate_ms; - int32_t max_obs_block_rx_clock_offset_ms; - int udp_port; - int udp_eph_port; + int32_t output_rate_ms = 0; + int32_t display_rate_ms = 0; + int32_t kml_rate_ms = 1000; + int32_t gpx_rate_ms = 1000; + int32_t geojson_rate_ms = 1000; + int32_t nmea_rate_ms = 1000; + int32_t rinex_version = 0; + int32_t rinexobs_rate_ms = 0; + int32_t max_obs_block_rx_clock_offset_ms = 40; + int udp_port = 0; + int udp_eph_port = 0; + int rtk_trace_level = 0; - uint16_t rtcm_tcp_port; - uint16_t rtcm_station_id; + uint16_t rtcm_tcp_port = 0; + uint16_t rtcm_station_id = 0; - bool flag_nmea_tty_port; - bool flag_rtcm_server; - bool flag_rtcm_tty_port; - bool output_enabled; - bool rinex_output_enabled; - bool gpx_output_enabled; - bool geojson_output_enabled; - bool nmea_output_file_enabled; - bool kml_output_enabled; - bool xml_output_enabled; - bool rtcm_output_file_enabled; - bool monitor_enabled; - bool monitor_ephemeris_enabled; - bool protobuf_enabled; - bool enable_rx_clock_correction; - bool show_local_time_zone; - bool pre_2009_file; - bool dump; - bool dump_mat; + bool flag_nmea_tty_port = false; + bool flag_rtcm_server = false; + bool flag_rtcm_tty_port = false; + bool output_enabled = true; + bool rinex_output_enabled = true; + bool gpx_output_enabled = true; + bool geojson_output_enabled = true; + bool nmea_output_file_enabled = true; + bool kml_output_enabled = true; + bool xml_output_enabled = true; + bool rtcm_output_file_enabled = true; + bool monitor_enabled = false; + bool monitor_ephemeris_enabled = false; + bool protobuf_enabled = true; + bool enable_rx_clock_correction = true; + bool show_local_time_zone = false; + bool pre_2009_file = false; + bool dump = false; + bool dump_mat = true; };