mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-31 07:13:03 +00:00 
			
		
		
		
	Completing UDP GPS and Galileo ephemeris server
This commit is contained in:
		| @@ -50,4 +50,6 @@ message MonitorGalileoEphemeris { | ||||
|  | ||||
|     double BGD_E1E5a_5=34;  //!< E1-E5a Broadcast Group Delay [s] | ||||
|     double BGD_E1E5b_5=35;  //!< E1-E5b Broadcast Group Delay [s] | ||||
|      | ||||
|     int32 i_satellite_PRN=36; //!< SV PRN NUMBER | ||||
| } | ||||
|   | ||||
| @@ -804,6 +804,11 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, | ||||
|             pvt_output_parameters.protobuf_enabled = true; | ||||
|         } | ||||
|  | ||||
|     // Read EPHEMERIS MONITOR Configuration | ||||
|     pvt_output_parameters.monitor_ephemeris_enabled = configuration->property(role + ".enable_monitor_ephemeris", false); | ||||
|     pvt_output_parameters.udp_eph_addresses = configuration->property(role + ".monitor_ephemeris_client_addresses", std::string("127.0.0.1")); | ||||
|     pvt_output_parameters.udp_eph_port = configuration->property(role + ".monitor_ephemeris_udp_port", 1234); | ||||
|  | ||||
|     // Show time in local zone | ||||
|     pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false); | ||||
|  | ||||
|   | ||||
| @@ -1099,11 +1099,12 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) | ||||
|                                     std::map<int32_t, Gps_Ephemeris> new_eph; | ||||
|                                     new_eph[gps_eph->i_satellite_PRN] = *gps_eph; | ||||
|                                     d_rp->log_rinex_nav_gps_nav(d_type_of_rx, new_eph); | ||||
|                                     //send the new eph to the eph monitor (if enabled) | ||||
|                                     if (d_flag_monitor_ephemeris_enabled) | ||||
|                                         { | ||||
|                                             d_eph_udp_sink_ptr->write_gps_ephemeris(gps_eph); | ||||
|                                         } | ||||
|                                 } | ||||
|                             // todo: Send only new sets of ephemeris (new TOE), not sent to the client | ||||
|                             // send the new eph to the eph monitor (if enabled) | ||||
|                             if (d_flag_monitor_ephemeris_enabled) | ||||
|                                 { | ||||
|                                     d_eph_udp_sink_ptr->write_gps_ephemeris(gps_eph); | ||||
|                                 } | ||||
|                         } | ||||
|                     d_internal_pvt_solver->gps_ephemeris_map[gps_eph->i_satellite_PRN] = *gps_eph; | ||||
| @@ -1233,6 +1234,12 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) | ||||
|                                     new_gal_eph[galileo_eph->i_satellite_PRN] = *galileo_eph; | ||||
|                                     d_rp->log_rinex_nav_gal_nav(d_type_of_rx, new_gal_eph); | ||||
|                                 } | ||||
|                             // todo: Send only new sets of ephemeris (new TOE), not sent to the client | ||||
|                             // send the new eph to the eph monitor (if enabled) | ||||
|                             if (d_flag_monitor_ephemeris_enabled) | ||||
|                                 { | ||||
|                                     d_eph_udp_sink_ptr->write_galileo_ephemeris(galileo_eph); | ||||
|                                 } | ||||
|                         } | ||||
|                     d_internal_pvt_solver->galileo_ephemeris_map[galileo_eph->i_satellite_PRN] = *galileo_eph; | ||||
|                     if (d_enable_rx_clock_correction == true) | ||||
|   | ||||
| @@ -61,7 +61,7 @@ if(USE_CMAKE_TARGET_SOURCES) | ||||
|     ) | ||||
| else() | ||||
|     source_group(Headers FILES ${PVT_LIB_HEADERS} ${PROTO_HDRS} ${PROTO_HDRS2} ${PROTO_HDRS3}) | ||||
|     add_library(pvt_libs ${PVT_LIB_SOURCES} ${PROTO_SRCS} ${PVT_LIB_HEADERS} ${PROTO_HDRS} ${PROTO_HDRS2} ${PROTO_HDRS3}) | ||||
|     add_library(pvt_libs ${PVT_LIB_SOURCES} ${PROTO_SRCS} ${PROTO_SRCS2} ${PROTO_SRCS3} ${PVT_LIB_HEADERS} ${PROTO_HDRS} ${PROTO_HDRS2} ${PROTO_HDRS3}) | ||||
| endif() | ||||
|  | ||||
| target_link_libraries(pvt_libs | ||||
|   | ||||
| @@ -38,7 +38,7 @@ Monitor_Ephemeris_Udp_Sink::Monitor_Ephemeris_Udp_Sink(const std::vector<std::st | ||||
| } | ||||
|  | ||||
|  | ||||
| bool Monitor_Ephemeris_Udp_Sink::write_galileo_ephemeris(const Galileo_Ephemeris* const monitor_gal_eph) | ||||
| bool Monitor_Ephemeris_Udp_Sink::write_galileo_ephemeris(const std::shared_ptr<Galileo_Ephemeris> monitor_gal_eph) | ||||
| { | ||||
|     std::string outbound_data; | ||||
|     if (use_protobuf == false) | ||||
|   | ||||
| @@ -44,7 +44,7 @@ class Monitor_Ephemeris_Udp_Sink | ||||
| public: | ||||
|     Monitor_Ephemeris_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled); | ||||
|     bool write_gps_ephemeris(const std::shared_ptr<Gps_Ephemeris> monitor_gps_eph); | ||||
|     bool write_galileo_ephemeris(const Galileo_Ephemeris* const monitor_gal_eph); | ||||
|     bool write_galileo_ephemeris(const std::shared_ptr<Galileo_Ephemeris> monitor_gal_eph); | ||||
|  | ||||
|  | ||||
| private: | ||||
|   | ||||
| @@ -61,8 +61,10 @@ Pvt_Conf::Pvt_Conf() | ||||
|  | ||||
|     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; | ||||
| } | ||||
|   | ||||
| @@ -74,12 +74,13 @@ public: | ||||
|         return *this; | ||||
|     } | ||||
|  | ||||
|     inline std::string createProtobuffer(const Galileo_Ephemeris* const monitor)  //!< Serialization into a string | ||||
|     inline std::string createProtobuffer(const std::shared_ptr<Galileo_Ephemeris> monitor)  //!< Serialization into a string | ||||
|     { | ||||
|         monitor_.Clear(); | ||||
|  | ||||
|         std::string data; | ||||
|  | ||||
|         monitor_.set_i_satellite_prn(monitor->i_satellite_PRN); | ||||
|         monitor_.set_iod_ephemeris(monitor->IOD_ephemeris); | ||||
|         monitor_.set_iod_nav_1(monitor->IOD_nav_1); | ||||
|         monitor_.set_m0_1(monitor->M0_1);                //!< Mean anomaly at reference time [semi-circles] | ||||
| @@ -132,6 +133,7 @@ public: | ||||
|     { | ||||
|         Galileo_Ephemeris monitor; | ||||
|  | ||||
|         monitor.i_satellite_PRN = mon.i_satellite_prn(); | ||||
|  | ||||
|         monitor.IOD_ephemeris = mon.iod_ephemeris(); | ||||
|         monitor.IOD_nav_1 = mon.iod_nav_1(); | ||||
|   | ||||
| @@ -128,47 +128,47 @@ public: | ||||
|     { | ||||
|         Gps_Ephemeris monitor; | ||||
|  | ||||
|         monitor.i_satellite_PRN = monitor_.i_satellite_prn();    // SV PRN NUMBER | ||||
|         monitor.d_TOW = monitor_.d_tow();                        //!< time of gps week of the ephemeris set (taken from subframes tow) [s] | ||||
|         monitor.d_Crs = monitor_.d_crs();                        //!< amplitude of the sine harmonic correction term to the orbit radius [m] | ||||
|         monitor.d_Delta_n = monitor_.d_delta_n();                //!< mean motion difference from computed value [semi-circles/s] | ||||
|         monitor.d_M_0 = monitor_.d_m_0();                        //!< mean anomaly at reference time [semi-circles] | ||||
|         monitor.d_Cuc = monitor_.d_cuc();                        //!< amplitude of the cosine harmonic correction term to the argument of latitude [rad] | ||||
|         monitor.d_e_eccentricity = monitor_.d_e_eccentricity();  //!< eccentricity [dimensionless] | ||||
|         monitor.d_Cus = monitor_.d_cus();                        //!< amplitude of the sine harmonic correction term to the argument of latitude [rad] | ||||
|         monitor.d_sqrt_A = monitor_.d_sqrt_a();                  //!< square root of the semi-major axis [sqrt(m)] | ||||
|         monitor.d_Toe = monitor_.d_toe();                        //!< ephemeris data reference time of week (ref. 20.3.3.4.3 is-gps-200k) [s] | ||||
|         monitor.d_Toc = monitor_.d_toc();                        //!< clock data reference time (ref. 20.3.3.3.3.1 is-gps-200k) [s] | ||||
|         monitor.d_Cic = monitor_.d_cic();                        //!< amplitude of the cosine harmonic correction term to the angle of inclination [rad] | ||||
|         monitor.d_OMEGA0 = monitor_.d_omega0();                  //!< longitude of ascending node of orbit plane at weekly epoch [semi-circles] | ||||
|         monitor.d_Cis = monitor_.d_cis();                        //!< amplitude of the sine harmonic correction term to the angle of inclination [rad] | ||||
|         monitor.d_i_0 = monitor_.d_i_0();                        //!< inclination angle at reference time [semi-circles] | ||||
|         monitor.d_Crc = monitor_.d_crc();                        //!< amplitude of the cosine harmonic correction term to the orbit radius [m] | ||||
|         monitor.d_OMEGA = monitor_.d_omega();                    //!< argument of perigee [semi-cicles] | ||||
|         monitor.d_OMEGA_DOT = monitor_.d_omega_dot();            //!< rate of right ascension [semi-circles/s] | ||||
|         monitor.d_IDOT = monitor_.d_idot();                      //!< rate of inclination angle [semi-circles/s] | ||||
|         monitor.i_code_on_L2 = monitor_.i_code_on_l2();          //!< if 1, p code on in l2;  if 2, c/a code on in l2; | ||||
|         monitor.i_GPS_week = monitor_.i_gps_week();              //!< gps week number, aka wn [week] | ||||
|         monitor.b_L2_P_data_flag = monitor_.b_l2_p_data_flag();  //!< when true, indicates that the nav data stream was commanded off on the p-code of the l2 channel | ||||
|         monitor.i_SV_accuracy = monitor_.i_sv_accuracy();        //!< user range accuracy (ura) index of the sv (reference paragraph 6.2.1) for the standard positioning service user (ref 20.3.3.3.1.3 is-gps-200k) | ||||
|         monitor.i_SV_health = monitor_.i_sv_health(); | ||||
|         monitor.d_TGD = monitor_.d_tgd();            //!< estimated group delay differential: l1-l2 correction term only for the benefit of "l1 p(y)" or "l2 p(y)" s users [s] | ||||
|         monitor.d_IODC = monitor_.d_iodc();          //!< issue of data, clock | ||||
|         monitor.d_IODE_SF2 = monitor_.d_iode_sf2();  //!< issue of data, ephemeris (iode), subframe 2 | ||||
|         monitor.d_IODE_SF3 = monitor_.d_iode_sf3();  //!< issue of data, ephemeris(iode), subframe 3 | ||||
|         monitor.i_AODO = monitor_.i_aodo();          //!< age of data offset (aodo) term for the navigation message correction table (nmct) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] | ||||
|         monitor.i_satellite_PRN = mon.i_satellite_prn();    // SV PRN NUMBER | ||||
|         monitor.d_TOW = mon.d_tow();                        //!< time of gps week of the ephemeris set (taken from subframes tow) [s] | ||||
|         monitor.d_Crs = mon.d_crs();                        //!< amplitude of the sine harmonic correction term to the orbit radius [m] | ||||
|         monitor.d_Delta_n = mon.d_delta_n();                //!< mean motion difference from computed value [semi-circles/s] | ||||
|         monitor.d_M_0 = mon.d_m_0();                        //!< mean anomaly at reference time [semi-circles] | ||||
|         monitor.d_Cuc = mon.d_cuc();                        //!< amplitude of the cosine harmonic correction term to the argument of latitude [rad] | ||||
|         monitor.d_e_eccentricity = mon.d_e_eccentricity();  //!< eccentricity [dimensionless] | ||||
|         monitor.d_Cus = mon.d_cus();                        //!< amplitude of the sine harmonic correction term to the argument of latitude [rad] | ||||
|         monitor.d_sqrt_A = mon.d_sqrt_a();                  //!< square root of the semi-major axis [sqrt(m)] | ||||
|         monitor.d_Toe = mon.d_toe();                        //!< ephemeris data reference time of week (ref. 20.3.3.4.3 is-gps-200k) [s] | ||||
|         monitor.d_Toc = mon.d_toc();                        //!< clock data reference time (ref. 20.3.3.3.3.1 is-gps-200k) [s] | ||||
|         monitor.d_Cic = mon.d_cic();                        //!< amplitude of the cosine harmonic correction term to the angle of inclination [rad] | ||||
|         monitor.d_OMEGA0 = mon.d_omega0();                  //!< longitude of ascending node of orbit plane at weekly epoch [semi-circles] | ||||
|         monitor.d_Cis = mon.d_cis();                        //!< amplitude of the sine harmonic correction term to the angle of inclination [rad] | ||||
|         monitor.d_i_0 = mon.d_i_0();                        //!< inclination angle at reference time [semi-circles] | ||||
|         monitor.d_Crc = mon.d_crc();                        //!< amplitude of the cosine harmonic correction term to the orbit radius [m] | ||||
|         monitor.d_OMEGA = mon.d_omega();                    //!< argument of perigee [semi-cicles] | ||||
|         monitor.d_OMEGA_DOT = mon.d_omega_dot();            //!< rate of right ascension [semi-circles/s] | ||||
|         monitor.d_IDOT = mon.d_idot();                      //!< rate of inclination angle [semi-circles/s] | ||||
|         monitor.i_code_on_L2 = mon.i_code_on_l2();          //!< if 1, p code on in l2;  if 2, c/a code on in l2; | ||||
|         monitor.i_GPS_week = mon.i_gps_week();              //!< gps week number, aka wn [week] | ||||
|         monitor.b_L2_P_data_flag = mon.b_l2_p_data_flag();  //!< when true, indicates that the nav data stream was commanded off on the p-code of the l2 channel | ||||
|         monitor.i_SV_accuracy = mon.i_sv_accuracy();        //!< user range accuracy (ura) index of the sv (reference paragraph 6.2.1) for the standard positioning service user (ref 20.3.3.3.1.3 is-gps-200k) | ||||
|         monitor.i_SV_health = mon.i_sv_health(); | ||||
|         monitor.d_TGD = mon.d_tgd();            //!< estimated group delay differential: l1-l2 correction term only for the benefit of "l1 p(y)" or "l2 p(y)" s users [s] | ||||
|         monitor.d_IODC = mon.d_iodc();          //!< issue of data, clock | ||||
|         monitor.d_IODE_SF2 = mon.d_iode_sf2();  //!< issue of data, ephemeris (iode), subframe 2 | ||||
|         monitor.d_IODE_SF3 = mon.d_iode_sf3();  //!< issue of data, ephemeris(iode), subframe 3 | ||||
|         monitor.i_AODO = mon.i_aodo();          //!< age of data offset (aodo) term for the navigation message correction table (nmct) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s] | ||||
|  | ||||
|         monitor.b_fit_interval_flag = monitor_.b_fit_interval_flag();  //!< indicates the curve-fit interval used by the cs (block ii/iia/iir/iir-m/iif) and ss (block iiia) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. | ||||
|         monitor.d_spare1 = monitor_.d_spare1(); | ||||
|         monitor.d_spare2 = monitor_.d_spare2(); | ||||
|         monitor.b_fit_interval_flag = mon.b_fit_interval_flag();  //!< indicates the curve-fit interval used by the cs (block ii/iia/iir/iir-m/iif) and ss (block iiia) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours. | ||||
|         monitor.d_spare1 = mon.d_spare1(); | ||||
|         monitor.d_spare2 = mon.d_spare2(); | ||||
|  | ||||
|         monitor.d_A_f0 = monitor_.d_a_f0();  //!< coefficient 0 of code phase offset model [s] | ||||
|         monitor.d_A_f1 = monitor_.d_a_f1();  //!< coefficient 1 of code phase offset model [s/s] | ||||
|         monitor.d_A_f2 = monitor_.d_a_f2();  //!< coefficient 2 of code phase offset model [s/s^2] | ||||
|         monitor.d_A_f0 = mon.d_a_f0();  //!< coefficient 0 of code phase offset model [s] | ||||
|         monitor.d_A_f1 = mon.d_a_f1();  //!< coefficient 1 of code phase offset model [s/s] | ||||
|         monitor.d_A_f2 = mon.d_a_f2();  //!< coefficient 2 of code phase offset model [s/s^2] | ||||
|  | ||||
|         monitor.b_integrity_status_flag = monitor_.b_integrity_status_flag(); | ||||
|         monitor.b_alert_flag = monitor_.b_alert_flag();                //!< if true, indicates  that the sv ura may be worse than indicated in d_sv_accuracy, use that sv at our own risk. | ||||
|         monitor.b_antispoofing_flag = monitor_.b_antispoofing_flag();  //!<  if true, the antispoofing mode is on in that sv | ||||
|         monitor.b_integrity_status_flag = mon.b_integrity_status_flag(); | ||||
|         monitor.b_alert_flag = mon.b_alert_flag();                //!< if true, indicates  that the sv ura may be worse than indicated in d_sv_accuracy, use that sv at our own risk. | ||||
|         monitor.b_antispoofing_flag = mon.b_antispoofing_flag();  //!<  if true, the antispoofing mode is on in that sv | ||||
|  | ||||
|         return monitor; | ||||
|     } | ||||
|   | ||||
| @@ -14,6 +14,7 @@ | ||||
|  * ----------------------------------------------------------------------------- | ||||
|  */ | ||||
|  | ||||
| #include "serdes_galileo_eph.h" | ||||
| #include "serdes_monitor_pvt.h" | ||||
| #include <memory> | ||||
|  | ||||
| @@ -29,6 +30,12 @@ TEST(Serdes_Monitor_Pvt_Test, Simpletest) | ||||
|     gnss_sdr::MonitorPvt mon; | ||||
|     mon.ParseFromString(serialized_data); | ||||
|  | ||||
|     serdes.readProtobuffer(mon); | ||||
|  | ||||
|     gnss_sdr::MonitorGalileoEphemeris ephgal; | ||||
|     Serdes_Galileo_Eph gal_serdes = Serdes_Galileo_Eph(); | ||||
|     gal_serdes.readProtobuffer(ephgal); | ||||
|  | ||||
|     double read_latitude = mon.latitude(); | ||||
|     EXPECT_NEAR(true_latitude, read_latitude, 0.000001); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Javier Arribas
					Javier Arribas