From 757414dc9e8c61aa8a3658f956e1d713f271fcf2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Oct 2023 12:52:14 +0200 Subject: [PATCH] Add geohash to monitor_pvt and remove it from logs --- docs/protobuf/monitor_pvt.proto | 71 ++++++++++--------- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 3 +- src/algorithms/PVT/libs/monitor_pvt.h | 2 + src/algorithms/PVT/libs/serdes_monitor_pvt.h | 3 + 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/docs/protobuf/monitor_pvt.proto b/docs/protobuf/monitor_pvt.proto index 3e8e46df9..9b297bae7 100644 --- a/docs/protobuf/monitor_pvt.proto +++ b/docs/protobuf/monitor_pvt.proto @@ -7,48 +7,49 @@ package gnss_sdr; /* MonitorPvt represents a search query, with pagination options to * indicate which results to include in the response. */ message MonitorPvt { -uint32 tow_at_current_symbol_ms = 1; // Time of week of the current symbol, in ms -uint32 week = 2; // PVT GPS week -double rx_time = 3; // PVT GPS time -double user_clk_offset = 4; // User clock offset, in s + uint32 tow_at_current_symbol_ms = 1; // Time of week of the current symbol, in ms + uint32 week = 2; // PVT GPS week + double rx_time = 3; // PVT GPS time + double user_clk_offset = 4; // User clock offset, in s -double pos_x = 5; // Position X component in ECEF, expressed in m -double pos_y = 6; // Position Y component in ECEF, expressed in m -double pos_z = 7; // Position Z component in ECEF, expressed in m -double vel_x = 8; // Velocity X component in ECEF, in m/s -double vel_y = 9; // Velocity Y component in ECEF, in m/s -double vel_z = 10; // Velocity Z component in ECEF, in m/s + double pos_x = 5; // Position X component in ECEF, expressed in m + double pos_y = 6; // Position Y component in ECEF, expressed in m + double pos_z = 7; // Position Z component in ECEF, expressed in m + double vel_x = 8; // Velocity X component in ECEF, in m/s + double vel_y = 9; // Velocity Y component in ECEF, in m/s + double vel_z = 10; // Velocity Z component in ECEF, in m/s -double cov_xx = 11; // Position variance in the Y component, in m2 -double cov_yy = 12; // Position variance in the Y component, in m2 -double cov_zz = 13; // Position variance in the Z component, in m2 -double cov_xy = 14; // Position XY covariance, in m2 -double cov_yz = 15; // Position YZ covariance, in m2 -double cov_zx = 16; // Position ZX covariance, in m2 + double cov_xx = 11; // Position variance in the Y component, in m2 + double cov_yy = 12; // Position variance in the Y component, in m2 + double cov_zz = 13; // Position variance in the Z component, in m2 + double cov_xy = 14; // Position XY covariance, in m2 + double cov_yz = 15; // Position YZ covariance, in m2 + double cov_zx = 16; // Position ZX covariance, in m2 -double latitude = 17; // Latitude, in deg. Positive: North -double longitude = 18; // Longitude, in deg. Positive: East -double height = 19; // Height, in m + double latitude = 17; // Latitude, in deg. Positive: North + double longitude = 18; // Longitude, in deg. Positive: East + double height = 19; // Height, in m -uint32 valid_sats = 20; // Number of valid satellites -uint32 solution_status = 21; // RTKLIB solution status -uint32 solution_type = 22; // RTKLIB solution type (0: xyz-ecef, 1: enu-baseline) -float ar_ratio_factor = 23; // Ambiguity resolution ratio factor for validation -float ar_ratio_threshold = 24; // Ambiguity resolution ratio threshold for validation + uint32 valid_sats = 20; // Number of valid satellites + uint32 solution_status = 21; // RTKLIB solution status + uint32 solution_type = 22; // RTKLIB solution type (0: xyz-ecef, 1: enu-baseline) + float ar_ratio_factor = 23; // Ambiguity resolution ratio factor for validation + float ar_ratio_threshold = 24; // Ambiguity resolution ratio threshold for validation -double gdop = 25; // Geometric Dilution of Precision -double pdop = 26; // Position (3D) Dilution of Precision -double hdop = 27; // Horizontal Dilution of Precision -double vdop = 28; // Vertical Dilution of Precision + double gdop = 25; // Geometric Dilution of Precision + double pdop = 26; // Position (3D) Dilution of Precision + double hdop = 27; // Horizontal Dilution of Precision + double vdop = 28; // Vertical Dilution of Precision -double user_clk_drift_ppm = 29; // User clock drift [ppm] -string utc_time = 30; // PVT UTC time (rfc 3339 datetime string) + double user_clk_drift_ppm = 29; // User clock drift [ppm] + string utc_time = 30; // PVT UTC time (rfc 3339 datetime string) -double vel_e = 31; // Velocity East component in the local frame, in m/s -double vel_n = 32; // Velocity North component in the local frame, in m/s -double vel_u = 33; // Velocity Up component in the local frame, in m/s + double vel_e = 31; // Velocity East component in the local frame, in m/s + double vel_n = 32; // Velocity North component in the local frame, in m/s + double vel_u = 33; // Velocity Up component in the local frame, in m/s -double cog = 34; // Course Over Ground (cog) [deg] + double cog = 34; // Course Over Ground, in deg -uint32 galhas_status = 35; // Galileo HAS status: 1- HAS messages decoded and applied, 0 - HAS not avaliable + uint32 galhas_status = 35; // Galileo HAS status: 1- HAS messages decoded and applied, 0 - HAS not available + string geohash = 36; // Encoded geographic location. See https://en.wikipedia.org/wiki/Geohash } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index f39ff0867..61847b705 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -2430,7 +2430,6 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item LOG(INFO) << "Position at " << boost::posix_time::to_simple_string(d_user_pvt_solver->get_position_UTC_time()) << " UTC using " << d_user_pvt_solver->get_num_valid_observations() << " observations is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude() << " [deg], Height = " << d_user_pvt_solver->get_height() << " [m]"; - LOG(INFO) << "geohash=" << d_geohash->encode(d_user_pvt_solver->get_latitude(), d_user_pvt_solver->get_longitude()); /* std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_user_pvt_solver->get_position_UTC_time()) << " UTC using "<< d_user_pvt_solver->get_num_valid_observations() <<" observations is HDOP = " << d_user_pvt_solver->get_hdop() << " VDOP = " << d_user_pvt_solver->get_vdop() @@ -2441,7 +2440,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item if (d_user_pvt_solver->is_valid_position() && flag_compute_pvt_output == true) { const std::shared_ptr monitor_pvt = std::make_shared(d_user_pvt_solver->get_monitor_pvt()); - + monitor_pvt->geohash = d_geohash->encode(d_user_pvt_solver->get_latitude(), d_user_pvt_solver->get_longitude()); // publish new position to the gnss_flowgraph channel status monitor if (current_RX_time_ms % d_report_rate_ms == 0) { diff --git a/src/algorithms/PVT/libs/monitor_pvt.h b/src/algorithms/PVT/libs/monitor_pvt.h index 97be9e0a4..e70f681de 100644 --- a/src/algorithms/PVT/libs/monitor_pvt.h +++ b/src/algorithms/PVT/libs/monitor_pvt.h @@ -98,6 +98,7 @@ public: // PVT UTC Time (rfc 3339 datetime string) std::string utc_time; + std::string geohash; // See https://en.wikipedia.org/wiki/Geohash /*! * \brief This member function serializes and restores @@ -153,6 +154,7 @@ public: ar& BOOST_SERIALIZATION_NVP(vel_u); ar& BOOST_SERIALIZATION_NVP(cog); + ar& BOOST_SERIALIZATION_NVP(geohash); } }; diff --git a/src/algorithms/PVT/libs/serdes_monitor_pvt.h b/src/algorithms/PVT/libs/serdes_monitor_pvt.h index e03d06b72..f7ac8e72e 100644 --- a/src/algorithms/PVT/libs/serdes_monitor_pvt.h +++ b/src/algorithms/PVT/libs/serdes_monitor_pvt.h @@ -118,6 +118,8 @@ public: monitor_.set_vel_u(monitor->vel_u); monitor_.set_cog(monitor->cog); monitor_.set_galhas_status(monitor->galhas_status); + monitor_.set_geohash(monitor->geohash); + monitor_.SerializeToString(&data); return data; } @@ -161,6 +163,7 @@ public: monitor.vel_u = mon.vel_u(); monitor.cog = mon.cog(); monitor.galhas_status = mon.galhas_status(); + monitor.geohash = mon.geohash(); return monitor; }