From d127f6adb8bb727659e6bb36e1ab0d005b9db9d4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 30 Apr 2017 16:06:01 +0200 Subject: [PATCH] Pass rtk struct to PVT block instead of opt_t --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 45 ++++++++++++++++++- src/algorithms/PVT/adapters/rtklib_pvt.h | 30 ++++++++++++- .../PVT/gnuradio_blocks/rtklib_pvt_cc.cc | 8 ++-- .../PVT/gnuradio_blocks/rtklib_pvt_cc.h | 6 +-- 4 files changed, 78 insertions(+), 11 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 177f16f7f..e575c202a 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -308,10 +308,51 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration, {} /* char pppopt[256] ppp option */ }; - rtklib_options = rtklib_configuration_options; + sol_t sol_ = {{0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, '0', '0', '0', 0, 0, 0 }; + + ambc_t ambc_ = { {{0,0}, {0,0}, {0,0}, {0,0}}, {0, 0, 0, 0}, {}, {}, 0, {'0'}}; + + ssat_t ssat_ = { '0', /* navigation system */ + '0', /* valid satellite flag single */ + {0.0}, /* azel[2] azimuth/elevation angles {az,el} (rad) */ + {0.0}, /* residuals of pseudorange (m) */ + {0.0}, /* residuals of carrier-phase (m) */ + {'0'}, /* valid satellite flag */ + {'0'}, /* signal strength (0.25 dBHz) */ + {'0'}, /* ambiguity fix flag (1:fix,2:float,3:hold) */ + {'0'}, /* cycle-slip flag */ + {'0'}, /* half-cycle valid flag */ + {}, /* lock counter of phase */ + {}, /* obs outage counter of phase */ + {}, /* cycle-slip counter */ + {}, /* reject counter */ + 0.0, /* geometry-free phase L1-L2 (m) */ + 0.0, /* geometry-free phase L1-L5 (m) */ + 0.0, /* MW-LC (m) */ + 0.0, /* phase windup (cycle) */ + {{{0,0}},{{0,0}}}, /* previous carrier-phase time */ + {{},{}} /* previous carrier-phase observable (cycle) */ + }; + + rtk = { sol_, /* RTK solution */ + {}, /* base position/velocity (ecef) (m|m/s) */ + 0, /* number of float states */ + 0, /* number of fixed states */ + output_rate_ms / 1000.0, /* time difference between current and previous (s) */ + {}, /* float states */ + {}, /* float states covariance */ + {}, /* fixed states */ + {}, /* fixed states covariance */ + 3, /* number of continuous fixes of ambiguity */ + {ambc_}, /* ambiguity control */ + {ssat_}, /* satellite status */ + 0, /* bytes in error message buffer */ + {'0'}, /* error message buffer */ + rtklib_configuration_options /* processing options */ + }; // make PVT object - pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtklib_options); + pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtk); DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; } diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.h b/src/algorithms/PVT/adapters/rtklib_pvt.h index 96719c741..0397b46ee 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.h +++ b/src/algorithms/PVT/adapters/rtklib_pvt.h @@ -58,7 +58,7 @@ public: return role_; } - //! Returns "Hybrid_Pvt" + //! Returns "RTKLIB_Pvt" std::string implementation() { return "RTKLIB_PVT"; @@ -82,7 +82,33 @@ public: private: rtklib_pvt_cc_sptr pvt_; - prcopt_t rtklib_options; + + sol_t sol_ = {{0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, '0', '0', '0', 0, 0, 0 }; + ambc_t ambc_ = { {{0,0}, {0,0}, {0,0}, {0,0}}, {0, 0, 0, 0}, {}, {}, 0, {'0'}}; + ssat_t ssat_ = { '0', /* navigation system */ + '0', /* valid satellite flag single */ + {0.0}, /* azel[2] azimuth/elevation angles {az,el} (rad) */ + {0.0}, /* residuals of pseudorange (m) */ + {0.0}, /* residuals of carrier-phase (m) */ + {'0'}, /* valid satellite flag */ + {'0'}, /* signal strength (0.25 dBHz) */ + {'0'}, /* ambiguity fix flag (1:fix,2:float,3:hold) */ + {'0'}, /* cycle-slip flag */ + {'0'}, /* half-cycle valid flag */ + {}, /* lock counter of phase */ + {}, /* obs outage counter of phase */ + {}, /* cycle-slip counter */ + {}, /* reject counter */ + 0.0, /* geometry-free phase L1-L2 (m) */ + 0.0, /* geometry-free phase L1-L5 (m) */ + 0.0, /* MW-LC (m) */ + 0.0, /* phase windup (cycle) */ + {{{0,0}},{{0,0}}}, /* previous carrier-phase time */ + {{},{}} /* previous carrier-phase observable (cycle) */ + }; + + rtk_t rtk; + bool dump_; std::string dump_filename_; std::string role_; diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index d1d031ec0..50055d8bf 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -60,7 +60,7 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int nchannels, std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, - const prcopt_t rtklib_opt) + rtk_t & rtk) { return rtklib_pvt_cc_sptr(new rtklib_pvt_cc(nchannels, dump, @@ -78,7 +78,7 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int nchannels, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, - rtklib_opt)); + rtk)); } @@ -202,7 +202,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version, bool flag_rtcm_server, bool flag_rtcm_tty_port, unsigned short rtcm_tcp_port, - unsigned short rtcm_station_id, std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, const prcopt_t rtklib_opt) : + unsigned short rtcm_station_id, std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, rtk_t & rtk) : gr::sync_block("rtklib_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), gr::io_signature::make(0, 0, 0)) { @@ -214,7 +214,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump std::string dump_ls_pvt_filename = dump_filename; type_of_rx = type_of_receiver; - rtklib_options = rtklib_opt; + rtklib_options = rtk.opt; // GPS Ephemeris data message port in this->message_port_register_in(pmt::mp("telemetry")); diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h index f6bda20bb..b1692412d 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h @@ -67,7 +67,7 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int n_channels, std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, - prcopt_t rtklib_opt); + rtk_t & rtk); /*! * \brief This class implements a block that computes the PVT solution with Galileo E1 signals @@ -91,7 +91,7 @@ private: std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, - const prcopt_t rtklib_opt); + rtk_t & rtk); void msg_handler_telemetry(pmt::pmt_t msg); @@ -162,7 +162,7 @@ public: std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, - const prcopt_t rtklib_opt); + rtk_t & rtk); /*! * \brief Get latest set of GPS L1 ephemeris from PVT block