From bd37a64260451bba86bf226913d60f750ca8782e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 11 Jun 2018 00:05:07 +0200 Subject: [PATCH 01/14] Fix RTCM server Replace private member name from io_service to io_context, remove socket as private member in Tcp_Server class Improve messages printed in terminal --- src/core/system_parameters/rtcm.cc | 12 +++---- src/core/system_parameters/rtcm.h | 51 +++++++++++++++++++----------- 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 6fb5666bf..b255b5fb9 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -53,7 +53,7 @@ Rtcm::Rtcm(unsigned short port) reserved_field = std::bitset<6>("000000"); rtcm_message_queue = std::make_shared >(); boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), RTCM_port); - servers.emplace_back(io_service, endpoint); + servers.emplace_back(io_context, endpoint); server_is_running = false; } @@ -85,13 +85,13 @@ Rtcm::~Rtcm() // ***************************************************************************************************** void Rtcm::run_server() { - std::cout << "Starting a TCP Server on port " << RTCM_port << std::endl; + std::cout << "Starting a TCP/IP server of RTCM messages on port " << RTCM_port << std::endl; try { - std::thread tq([&] { std::make_shared(io_service, rtcm_message_queue, RTCM_port)->do_read_queue(); }); + std::thread tq([&] { std::make_shared(io_context, rtcm_message_queue, RTCM_port)->do_read_queue(); }); tq.detach(); - std::thread t([&] { io_service.run(); }); + std::thread t([&] { io_context.run(); }); server_is_running = true; t.detach(); } @@ -104,13 +104,13 @@ void Rtcm::run_server() void Rtcm::stop_service() { - io_service.stop(); + io_context.stop(); } void Rtcm::stop_server() { - std::cout << "Stopping TCP Server on port " << RTCM_port << std::endl; + std::cout << "Stopping TCP/IP server on port " << RTCM_port << std::endl; rtcm_message_queue->push("Goodbye"); // this terminates tq Rtcm::stop_service(); servers.front().close_server(); diff --git a/src/core/system_parameters/rtcm.h b/src/core/system_parameters/rtcm.h index 703d6a065..4cb7ff9df 100644 --- a/src/core/system_parameters/rtcm.h +++ b/src/core/system_parameters/rtcm.h @@ -749,21 +749,21 @@ private: : public std::enable_shared_from_this { public: - Tcp_Internal_Client(boost::asio::io_service& io_service, + Tcp_Internal_Client(boost::asio::io_service& io_context, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) - : io_service_(io_service), socket_(io_service) + : io_context_(io_context), socket_(io_context) { do_connect(endpoint_iterator); } inline void close() { - io_service_.post([this]() { socket_.close(); }); + io_context_.post([this]() { socket_.close(); }); } inline void write(const Rtcm_Message& msg) { - io_service_.post( + io_context_.post( [this, msg]() { bool write_in_progress = !write_msgs_.empty(); write_msgs_.push_back(msg); @@ -827,7 +827,7 @@ private: }); } - boost::asio::io_service& io_service_; + boost::asio::io_service& io_context_; boost::asio::ip::tcp::socket socket_; Rtcm_Message read_msg_; std::deque write_msgs_; @@ -837,13 +837,13 @@ private: class Queue_Reader { public: - Queue_Reader(boost::asio::io_service& io_service, std::shared_ptr >& queue, int port) : queue_(queue) + Queue_Reader(boost::asio::io_service& io_context, std::shared_ptr >& queue, int port) : queue_(queue) { - boost::asio::ip::tcp::resolver resolver(io_service); + boost::asio::ip::tcp::resolver resolver(io_context); std::string host("localhost"); std::string port_str = std::to_string(port); auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()}); - c = std::make_shared(io_service, queue_endpoint_iterator); + c = std::make_shared(io_context, queue_endpoint_iterator); } inline void do_read_queue() @@ -871,8 +871,8 @@ private: class Tcp_Server { public: - Tcp_Server(boost::asio::io_service& io_service, const boost::asio::ip::tcp::endpoint& endpoint) - : acceptor_(io_service), socket_(io_service) + Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint) + : acceptor_(io_context) { acceptor_.open(endpoint.protocol()); acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); @@ -883,44 +883,57 @@ private: inline void close_server() { - socket_.close(); acceptor_.close(); } private: inline void do_accept() { - acceptor_.async_accept(socket_, [this](boost::system::error_code ec) { + acceptor_.async_accept([this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket_) { if (!ec) { if (first_client) { - std::cout << "The TCP Server is up and running. Accepting connections ..." << std::endl; + std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ..." << std::endl; first_client = false; } else { - std::cout << "Starting RTCM TCP server session..." << std::endl; - std::cout << "Serving client from " << socket_.remote_endpoint().address() << std::endl; - LOG(INFO) << "Serving client from " << socket_.remote_endpoint().address(); + std::cout << "Starting RTCM TCP/IP server session..." << std::endl; + boost::system::error_code ec2; + boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2); + if (ec2) + { + // Error creating remote_endpoint + std::cout << "Error getting remote IP address, closing session." << std::endl; + LOG(INFO) << "Error getting remote IP address"; + start_session = false; + } + else + { + std::string remote_addr = endpoint.address().to_string(); + std::cout << "Serving client from " << remote_addr << std::endl; + LOG(INFO) << "Serving client from " << remote_addr; + } } - std::make_shared(std::move(socket_), room_)->start(); + if (start_session) std::make_shared(std::move(socket_), room_)->start(); } else { std::cout << "Error when invoking a RTCM session. " << ec << std::endl; } + start_session = true; do_accept(); }); } boost::asio::ip::tcp::acceptor acceptor_; - boost::asio::ip::tcp::socket socket_; Rtcm_Listener_Room room_; bool first_client = true; + bool start_session = true; }; - boost::asio::io_service io_service; + boost::asio::io_service io_context; std::shared_ptr > rtcm_message_queue; std::thread t; std::thread tq; From f10ea80c6199678218bdb4357c9ccf809c4d1d2e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 11 Jun 2018 11:00:08 +0200 Subject: [PATCH 02/14] More fixes for the RTCM server --- src/core/system_parameters/rtcm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/rtcm.h b/src/core/system_parameters/rtcm.h index 4cb7ff9df..c30c2b76a 100644 --- a/src/core/system_parameters/rtcm.h +++ b/src/core/system_parameters/rtcm.h @@ -677,10 +677,10 @@ private: { if (first == true) { - std::cout << "Client from " << socket_.remote_endpoint().address() << " says "; + LOG(INFO) << "Client says:"; first = false; } - std::cout << client_says.substr(0, 80) << std::endl; + LOG(INFO) << client_says; client_says = client_says.substr(80, client_says.length() - 80); } do_read_message_header(); From 36ac696a4612906583945adc8d74428558d0f38a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 11 Jun 2018 11:13:02 +0200 Subject: [PATCH 03/14] More fixes --- src/core/system_parameters/rtcm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/rtcm.h b/src/core/system_parameters/rtcm.h index c30c2b76a..d97ed6e24 100644 --- a/src/core/system_parameters/rtcm.h +++ b/src/core/system_parameters/rtcm.h @@ -872,7 +872,7 @@ private: { public: Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint) - : acceptor_(io_context) + : acceptor_(io_context), socket_(io_context) { acceptor_.open(endpoint.protocol()); acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); @@ -883,13 +883,14 @@ private: inline void close_server() { + socket_.close(); acceptor_.close(); } private: inline void do_accept() { - acceptor_.async_accept([this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket_) { + acceptor_.async_accept(socket_, [this](boost::system::error_code ec) { if (!ec) { if (first_client) @@ -928,6 +929,7 @@ private: } boost::asio::ip::tcp::acceptor acceptor_; + boost::asio::ip::tcp::socket socket_; Rtcm_Listener_Room room_; bool first_client = true; bool start_session = true; From 5b2040ae50cf81e93b2d839f3e1d9670d30f04b1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 13 Jun 2018 21:01:40 +0200 Subject: [PATCH 04/14] Improve channel state management in multisystem configurations --- src/core/receiver/gnss_flowgraph.cc | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 83ad6807a..c8a59e106 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -763,10 +763,35 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { std::lock_guard lock(signal_list_mutex); available_GNSS_signals_.push_back(channels_[who]->get_signal()); - channels_[who]->set_signal(search_next_signal(channels_[who]->get_signal().get_signal_str(), true)); } - DLOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); - channels_[who]->start_acquisition(); + channels_state_[who] = 0; + acq_channels_count_--; + for (unsigned int i = 0; i < channels_count_; i++) + { + unsigned int ii = (i + 1) % channels_count_; + unsigned int sat_ = 0; + try + { + sat_ = configuration_->property("Channel" + std::to_string(ii) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } + if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[ii] == 0)) + { + channels_state_[ii] = 1; + if (sat_ == 0) + { + std::lock_guard lock(signal_list_mutex); + channels_[ii]->set_signal(search_next_signal(channels_[ii]->get_signal().get_signal_str(), true)); + } + acq_channels_count_++; + DLOG(INFO) << "Channel " << ii << " Starting acquisition " << channels_[ii]->get_signal().get_satellite() << ", Signal " << channels_[ii]->get_signal().get_signal_str(); + channels_[ii]->start_acquisition(); + } + DLOG(INFO) << "Channel " << ii << " in state " << channels_state_[ii]; + } break; case 1: From 4506bed859bcbbced0e02d966047edcd94db8655 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 14 Jun 2018 23:10:43 +0200 Subject: [PATCH 05/14] Smarter flowgraph for multi-system and multi-band configurations --- src/core/receiver/gnss_flowgraph.cc | 414 ++++++++++++++++++++++++---- src/core/receiver/gnss_flowgraph.h | 26 +- 2 files changed, 378 insertions(+), 62 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index c8a59e106..b84d35063 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -422,11 +422,59 @@ void GNSSFlowgraph::connect() else { std::string gnss_system; - if ((gnss_signal.compare("1C") == 0) or (gnss_signal.compare("2S") == 0) or (gnss_signal.compare("L5") == 0)) gnss_system = "GPS"; - if ((gnss_signal.compare("1B") == 0) or (gnss_signal.compare("5X") == 0)) gnss_system = "Galileo"; - if ((gnss_signal.compare("1G") == 0) or (gnss_signal.compare("2G") == 0)) gnss_system = "Glonass"; - Gnss_Signal signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); - available_GNSS_signals_.remove(signal_value); + Gnss_Signal signal_value; + switch (mapStringValues_[gnss_signal]) + { + case evGPS_1C: + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_1C_signals_.remove(signal_value); + break; + + case evGPS_2S: + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_2S_signals_.remove(signal_value); + break; + + case evGPS_L5: + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_L5_signals_.remove(signal_value); + break; + + case evGAL_1B: + gnss_system = "Galileo"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GAL_1B_signals_.remove(signal_value); + break; + + case evGAL_5X: + gnss_system = "Galileo"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GAL_5X_signals_.remove(signal_value); + break; + + case evGLO_1G: + gnss_system = "Glonass"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GLO_1G_signals_.remove(signal_value); + break; + + case evGLO_2G: + gnss_system = "Glonass"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GLO_2G_signals_.remove(signal_value); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_1C_signals_.remove(signal_value); + break; + } + channels_.at(i)->set_signal(signal_value); } } @@ -762,35 +810,68 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) if (sat == 0) { std::lock_guard lock(signal_list_mutex); - available_GNSS_signals_.push_back(channels_[who]->get_signal()); + switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) + { + case evGPS_1C: + available_GPS_1C_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_2S: + available_GPS_2S_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_L5: + available_GPS_L5_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_1B: + available_GAL_1B_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_5X: + available_GAL_5X_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_1G: + available_GLO_1G_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_2G: + available_GLO_2G_signals_.push_back(channels_[who]->get_signal()); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + break; + } } channels_state_[who] = 0; acq_channels_count_--; for (unsigned int i = 0; i < channels_count_; i++) { - unsigned int ii = (i + 1) % channels_count_; + unsigned int ch_index = (who + i + 1) % channels_count_; unsigned int sat_ = 0; try { - sat_ = configuration_->property("Channel" + std::to_string(ii) + ".satellite", 0); + sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0); } catch (const std::exception& e) { LOG(WARNING) << e.what(); } - if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[ii] == 0)) + if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) { - channels_state_[ii] = 1; + channels_state_[ch_index] = 1; if (sat_ == 0) { std::lock_guard lock(signal_list_mutex); - channels_[ii]->set_signal(search_next_signal(channels_[ii]->get_signal().get_signal_str(), true)); + channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); } acq_channels_count_++; - DLOG(INFO) << "Channel " << ii << " Starting acquisition " << channels_[ii]->get_signal().get_satellite() << ", Signal " << channels_[ii]->get_signal().get_signal_str(); - channels_[ii]->start_acquisition(); + DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); + channels_[ch_index]->start_acquisition(); } - DLOG(INFO) << "Channel " << ii << " in state " << channels_state_[ii]; + DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; } break; @@ -809,13 +890,13 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { LOG(WARNING) << e.what(); } - if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) + if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) { channels_state_[i] = 1; if (sat_ == 0) { std::lock_guard lock(signal_list_mutex); - channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true)); + channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true)); } acq_channels_count_++; DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); @@ -843,7 +924,40 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) if (sat == 0) { std::lock_guard lock(signal_list_mutex); - available_GNSS_signals_.push_back(channels_[who]->get_signal()); + switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) + { + case evGPS_1C: + available_GPS_1C_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_2S: + available_GPS_2S_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_L5: + available_GPS_L5_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_1B: + available_GAL_1B_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_5X: + available_GAL_5X_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_1G: + available_GLO_1G_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_2G: + available_GLO_2G_signals_.push_back(channels_[who]->get_signal()); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + break; + } } } break; @@ -851,7 +965,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) default: break; } - DLOG(INFO) << "Number of available signals: " << available_GNSS_signals_.size(); applied_actions_++; } @@ -968,7 +1081,15 @@ void GNSSFlowgraph::init() top_block_ = gr::make_top_block("GNSSFlowgraph"); - // fill the available_GNSS_signals_ queue with the satellites ID's to be searched by the acquisition + mapStringValues_["1C"] = evGPS_1C; + mapStringValues_["2S"] = evGPS_2S; + mapStringValues_["L5"] = evGPS_L5; + mapStringValues_["1B"] = evGAL_1B; + mapStringValues_["5X"] = evGAL_5X; + mapStringValues_["1G"] = evGLO_1G; + mapStringValues_["2G"] = evGLO_2G; + + // fill the signals queue with the satellites ID's to be searched by the acquisition set_signals_list(); set_channels_state(); applied_actions_ = 0; @@ -1061,14 +1182,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_1C.count", 0) > 0) { - /* - * Loop to create GPS L1 C/A signals - */ + // Loop to create GPS L1 C/A signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); available_gnss_prn_iter != available_gps_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GPS_1C_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), std::string("1C"))); } @@ -1076,14 +1195,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_2S.count", 0) > 0) { - /* - * Loop to create GPS L2C M signals - */ + // Loop to create GPS L2C M signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); available_gnss_prn_iter != available_gps_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GPS_2S_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), std::string("2S"))); } @@ -1091,14 +1208,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_L5.count", 0) > 0) { - /* - * Loop to create GPS L5 signals - */ + // Loop to create GPS L5 signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); available_gnss_prn_iter != available_gps_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GPS_L5_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), std::string("L5"))); } @@ -1106,14 +1221,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_SBAS.count", 0) > 0) { - /* - * Loop to create SBAS L1 C/A signals - */ + // Loop to create SBAS L1 C/A signals for (available_gnss_prn_iter = available_sbas_prn.cbegin(); available_gnss_prn_iter != available_sbas_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_SBAS_1C_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("SBAS"), *available_gnss_prn_iter), std::string("1C"))); } @@ -1121,14 +1234,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_1B.count", 0) > 0) { - /* - * Loop to create the list of Galileo E1B signals - */ + // Loop to create the list of Galileo E1B signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); available_gnss_prn_iter != available_galileo_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GAL_1B_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), std::string("1B"))); } @@ -1136,14 +1247,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_5X.count", 0) > 0) { - /* - * Loop to create the list of Galileo E5a signals - */ + // Loop to create the list of Galileo E5a signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); available_gnss_prn_iter != available_galileo_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GAL_5X_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), std::string("5X"))); } @@ -1151,14 +1260,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_1G.count", 0) > 0) { - /* - * Loop to create the list of GLONASS L1 C/A signals - */ + // Loop to create the list of GLONASS L1 C/A signals for (available_gnss_prn_iter = available_glonass_prn.begin(); available_gnss_prn_iter != available_glonass_prn.end(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GLO_1G_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter), std::string("1G"))); } @@ -1166,14 +1273,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_2G.count", 0) > 0) { - /* - * Loop to create the list of GLONASS L2 C/A signals - */ + // Loop to create the list of GLONASS L2 C/A signals for (available_gnss_prn_iter = available_glonass_prn.begin(); available_gnss_prn_iter != available_glonass_prn.end(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GLO_2G_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter), std::string("2G"))); } @@ -1207,17 +1312,206 @@ void GNSSFlowgraph::set_channels_state() } -Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop) +Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop, bool tracked) { - while (searched_signal.compare(available_GNSS_signals_.front().get_signal_str()) != 0) + Gnss_Signal result; + bool untracked_satellite = true; + switch (mapStringValues_[searched_signal]) { - available_GNSS_signals_.push_back(available_GNSS_signals_.front()); - available_GNSS_signals_.pop_front(); - } - Gnss_Signal result = available_GNSS_signals_.front(); - if (pop) - { - available_GNSS_signals_.pop_front(); + case evGPS_1C: + result = available_GPS_1C_signals_.front(); + if (pop) + { + available_GPS_1C_signals_.pop_front(); + } + if (tracked) + { + if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + available_GPS_2S_signals_.push_front(gs); + available_GPS_2S_signals_.unique(); + } + if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + available_GPS_L5_signals_.push_front(gs); + available_GPS_L5_signals_.unique(); + } + } + } + break; + + case evGPS_2S: + result = available_GPS_2S_signals_.front(); + if (pop) + { + available_GPS_2S_signals_.pop_front(); + } + if (tracked) + { + if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + available_GPS_1C_signals_.push_front(gs); + available_GPS_1C_signals_.unique(); + } + if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + available_GPS_L5_signals_.push_front(gs); + available_GPS_L5_signals_.unique(); + } + } + } + break; + + case evGPS_L5: + result = available_GPS_L5_signals_.front(); + if (pop) + { + available_GPS_L5_signals_.pop_front(); + } + if (tracked) + { + if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_2S.count", 0) > 0)) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + available_GPS_1C_signals_.push_front(gs); + available_GPS_1C_signals_.unique(); + } + if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + available_GPS_2S_signals_.push_front(gs); + available_GPS_2S_signals_.unique(); + } + } + } + break; + + case evGAL_1B: + result = available_GAL_1B_signals_.front(); + if (pop) + { + available_GAL_1B_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_5X.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X"); + available_GAL_5X_signals_.push_front(gs); + available_GAL_5X_signals_.unique(); + } + } + } + break; + + case evGAL_5X: + result = available_GAL_5X_signals_.front(); + if (pop) + { + available_GAL_5X_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_1B.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B"); + available_GAL_1B_signals_.push_front(gs); + available_GAL_1B_signals_.unique(); + } + } + } + break; + + case evGLO_1G: + result = available_GLO_1G_signals_.front(); + if (pop) + { + available_GLO_1G_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_2G.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G"); + available_GLO_2G_signals_.push_front(gs); + available_GLO_2G_signals_.unique(); + } + } + } + break; + + case evGLO_2G: + result = available_GLO_2G_signals_.front(); + if (pop) + { + available_GLO_2G_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_1G.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G"); + available_GLO_1G_signals_.push_front(gs); + available_GLO_1G_signals_.unique(); + } + } + } + break; + + default: + LOG(ERROR) << "This should not happen :-("; + result = available_GPS_1C_signals_.front(); + if (pop) + { + available_GPS_1C_signals_.pop_front(); + } + break; } return result; } diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index ff72eda88..638b81305 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +134,7 @@ private: void set_signals_list(); void set_channels_state(); // Initializes the channels state (start acquisition or keep standby) // using the configuration parameters (number of channels and max channels in acquisition) - Gnss_Signal search_next_signal(std::string searched_signal, bool pop); + Gnss_Signal search_next_signal(std::string searched_signal, bool pop, bool tracked = false); bool connected_; bool running_; int sources_count_; @@ -160,7 +161,28 @@ private: gr::blocks::throttle::sptr throttle_; gr::top_block_sptr top_block_; gr::msg_queue::sptr queue_; - std::list available_GNSS_signals_; + + std::list available_GPS_1C_signals_; + std::list available_GPS_2S_signals_; + std::list available_GPS_L5_signals_; + std::list available_SBAS_1C_signals_; + std::list available_GAL_1B_signals_; + std::list available_GAL_5X_signals_; + std::list available_GLO_1G_signals_; + std::list available_GLO_2G_signals_; + enum StringValue + { + evGPS_1C, + evGPS_2S, + evGPS_L5, + evSBAS_1C, + evGAL_1B, + evGAL_5X, + evGLO_1G, + evGLO_2G + }; + std::map mapStringValues_; + std::vector channels_state_; std::mutex signal_list_mutex; }; From 84813228cf953952b3bac2e13e2348a6877d238c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 08:24:07 +0200 Subject: [PATCH 06/14] Add missing header --- src/algorithms/PVT/libs/hybrid_ls_pvt.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index 25898e195..ede8a9f83 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -33,6 +33,7 @@ #include "Galileo_E1.h" #include "GPS_L1_CA.h" #include "GPS_L2C.h" +#include #include From 453c3f99f929a0faf30f5d43a22660cdf6e169bd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 08:34:33 +0200 Subject: [PATCH 07/14] Describe flowgraph improvement in the changelog --- docs/changelog | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog b/docs/changelog index 7c8d1918e..4edaa9326 100644 --- a/docs/changelog +++ b/docs/changelog @@ -21,6 +21,7 @@ Next release will have several improvements in different dimensions, addition of ### Improvements in Efficiency: - Added the possibility of non-blocking acquisition, which works well when using real-time data from an RF front-end. +- Improved flowgraph in multiband and multisystem configurations. Satellites acquired in one band are immediately searched in others. The flowgraph does not get stalled anymore if no signal is found from the first system. - Complex local codes have been replaced by real codes, alleviating the computational burden. - New volk_gnsssdr kernels: volk_gnsssdr_16i_xn_resampler_16i_xn.h, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn.h, volk_gnsssdr_32f_xn_resampler_32f_xn.h, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h - Some AVX2 implementations added to the volk_gnsssdr library. From 935f71655397824f6238ac658ef208c28d449b5c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 08:59:52 +0200 Subject: [PATCH 08/14] Describe flowgraph improvement in the changelog --- docs/changelog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog b/docs/changelog index 4edaa9326..dece16401 100644 --- a/docs/changelog +++ b/docs/changelog @@ -14,6 +14,7 @@ Next release will have several improvements in different dimensions, addition of - Internal Finite State Machines rewritten for improved continuity in delivering position fixes. This fixes a bug that was stalling the receiver after about six hours of continuous operation. - Redesign of the time counter for enhanced continuity. +- Improved flow graph in multisystem configurations: the receiver does not get stalled anymore if no signal is found from the first system. - Improved acquisition and tracking sensitivity. - Other minor bug fixes. @@ -21,7 +22,7 @@ Next release will have several improvements in different dimensions, addition of ### Improvements in Efficiency: - Added the possibility of non-blocking acquisition, which works well when using real-time data from an RF front-end. -- Improved flowgraph in multiband and multisystem configurations. Satellites acquired in one band are immediately searched in others. The flowgraph does not get stalled anymore if no signal is found from the first system. +- Improved flow graph in multiband configurations: satellites acquired in one band are immediately searched in others. - Complex local codes have been replaced by real codes, alleviating the computational burden. - New volk_gnsssdr kernels: volk_gnsssdr_16i_xn_resampler_16i_xn.h, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn.h, volk_gnsssdr_32f_xn_resampler_32f_xn.h, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h - Some AVX2 implementations added to the volk_gnsssdr library. From 576694c5b372c6551a01e8ae0bd39d4d4e3d6714 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 14:35:53 +0200 Subject: [PATCH 09/14] Enhance protection with concurrent channels --- src/core/receiver/gnss_flowgraph.cc | 39 +++++++++++++---------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index b84d35063..8733ee9ed 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -803,13 +803,13 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { LOG(WARNING) << e.what(); } + std::lock_guard lock(signal_list_mutex); switch (what) { case 0: DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); if (sat == 0) { - std::lock_guard lock(signal_list_mutex); switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) { case evGPS_1C: @@ -864,7 +864,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_state_[ch_index] = 1; if (sat_ == 0) { - std::lock_guard lock(signal_list_mutex); channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); } acq_channels_count_++; @@ -895,7 +894,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_state_[i] = 1; if (sat_ == 0) { - std::lock_guard lock(signal_list_mutex); channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true)); } acq_channels_count_++; @@ -923,7 +921,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) LOG(INFO) << "Channel " << who << " Idle state"; if (sat == 0) { - std::lock_guard lock(signal_list_mutex); switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) { case evGPS_1C: @@ -1330,19 +1327,19 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1C") != 0)) untracked_satellite = false; } if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + available_GPS_2S_signals_.remove(gs); available_GPS_2S_signals_.push_front(gs); - available_GPS_2S_signals_.unique(); } if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + available_GPS_L5_signals_.remove(gs); available_GPS_L5_signals_.push_front(gs); - available_GPS_L5_signals_.unique(); } } } @@ -1360,19 +1357,19 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2S") != 0)) untracked_satellite = false; } if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + available_GPS_1C_signals_.remove(gs); available_GPS_1C_signals_.push_front(gs); - available_GPS_1C_signals_.unique(); } if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + available_GPS_L5_signals_.remove(gs); available_GPS_L5_signals_.push_front(gs); - available_GPS_L5_signals_.unique(); } } } @@ -1390,19 +1387,19 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("L5") != 0)) untracked_satellite = false; } if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + available_GPS_1C_signals_.remove(gs); available_GPS_1C_signals_.push_front(gs); - available_GPS_1C_signals_.unique(); } if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + available_GPS_2S_signals_.remove(gs); available_GPS_2S_signals_.push_front(gs); - available_GPS_2S_signals_.unique(); } } } @@ -1420,13 +1417,13 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1B") != 0)) untracked_satellite = false; } if (untracked_satellite) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X"); + available_GAL_5X_signals_.remove(gs); available_GAL_5X_signals_.push_front(gs); - available_GAL_5X_signals_.unique(); } } } @@ -1444,13 +1441,13 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("5X") != 0)) untracked_satellite = false; } if (untracked_satellite) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B"); + available_GAL_1B_signals_.remove(gs); available_GAL_1B_signals_.push_front(gs); - available_GAL_1B_signals_.unique(); } } } @@ -1468,13 +1465,13 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1G") != 0)) untracked_satellite = false; } if (untracked_satellite) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G"); + available_GLO_2G_signals_.remove(gs); available_GLO_2G_signals_.push_front(gs); - available_GLO_2G_signals_.unique(); } } } @@ -1492,13 +1489,13 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool { for (unsigned int ch = 0; ch < channels_count_; ch++) { - if (channels_[ch]->get_signal().get_satellite() == result.get_satellite()) untracked_satellite = false; + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2G") != 0)) untracked_satellite = false; } if (untracked_satellite) { Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G"); + available_GLO_1G_signals_.remove(gs); available_GLO_1G_signals_.push_front(gs); - available_GLO_1G_signals_.unique(); } } } From c26022a1d6664c5be54bd007d05e3de6569110e9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 17:07:40 +0200 Subject: [PATCH 10/14] Fix building with Boost 1.67 --- src/algorithms/PVT/libs/hybrid_ls_pvt.cc | 2 +- src/algorithms/PVT/libs/rinex_printer.cc | 8 ++++---- src/core/system_parameters/rtcm.cc | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index ede8a9f83..b6b2f93ad 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -339,7 +339,7 @@ bool hybrid_ls_pvt::get_PVT(std::map gnss_observables_map, do } // get time string Gregorian calendar - boost::posix_time::time_duration t = boost::posix_time::seconds(utc); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast(utc * 1000000)); // 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2) boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); this->set_position_UTC_time(p_time); diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 859239096..61e02cfb6 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -8247,7 +8247,7 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Gps_Navigation_Me // if we are processing a file -> wait to leap second to resolve the ambiguity else take the week from the local system time //: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm const double utc_t = nav_msg.utc_time(nav_msg.d_TOW); - boost::posix_time::time_duration t = boost::posix_time::millisec((utc_t + 604800 * static_cast(nav_msg.i_GPS_week)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((utc_t + 604800 * static_cast(nav_msg.i_GPS_week)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -8260,7 +8260,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -8273,7 +8273,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeri // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -8285,7 +8285,7 @@ boost::posix_time::ptime Rinex_Printer::compute_Galileo_time(const Galileo_Ephem // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf) // --??? No time correction here, since it will be done in the RINEX processor double galileo_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000); // + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000)); // boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index b255b5fb9..8f337f802 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -3313,7 +3313,7 @@ std::map Rtcm::galileo_signal_map = [] { boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -3322,7 +3322,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -3331,7 +3331,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const { double galileo_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -4058,7 +4058,7 @@ int Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro) int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); std::string now_ptime = to_iso_string(p_time); std::string today_ptime = now_ptime.substr(0, 8); @@ -4072,7 +4072,7 @@ int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) int Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time) { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); std::string now_ptime = to_iso_string(p_time); std::string hours = now_ptime.substr(9, 2); From cc4fd07c7615992e509f3dea541fc7e0a4a0e383 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 17:11:04 +0200 Subject: [PATCH 11/14] Fix building with Boost 1.67 --- src/algorithms/PVT/libs/rinex_printer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 61e02cfb6..d4a228b4e 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -8260,7 +8260,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::milliseconds((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } From 1d5d74e12e10fdd50ac2379591326a4a90884f1c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 17:20:01 +0200 Subject: [PATCH 12/14] Fix building with Boost 1.67 --- src/algorithms/PVT/libs/rtklib_solver.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 436ff9aaf..7f3606051 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -538,7 +538,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ gtime_t rtklib_time = gpst2time(adjgpsweek(nav_data.eph[0].week), gnss_observables_map.begin()->second.RX_time); gtime_t rtklib_utc_time = gpst2utc(rtklib_time); p_time = boost::posix_time::from_time_t(rtklib_utc_time.time); - p_time += boost::posix_time::microseconds(round(rtklib_utc_time.sec * 1e6)); + p_time += boost::posix_time::microseconds(static_cast(round(rtklib_utc_time.sec * 1e6))); this->set_position_UTC_time(p_time); cart2geo(static_cast(rx_position_and_time(0)), static_cast(rx_position_and_time(1)), static_cast(rx_position_and_time(2)), 4); From 0ca454e1ee12e87568e0bdde9f70dea8d8c783ad Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 17:21:31 +0200 Subject: [PATCH 13/14] Small fix --- src/algorithms/PVT/libs/hybrid_ls_pvt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index b6b2f93ad..6f269b7c7 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -339,7 +339,7 @@ bool hybrid_ls_pvt::get_PVT(std::map gnss_observables_map, do } // get time string Gregorian calendar - boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast(utc * 1000000)); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast(utc * 1000.0)); // 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2) boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); this->set_position_UTC_time(p_time); From f3b07090e2bc157641163b16b731f93709877660 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 15 Jun 2018 17:22:40 +0200 Subject: [PATCH 14/14] Replace deprecated boost/math/common_factor_rt.hpp header by boost/integer/common_factor_rt.hpp --- .../PVT/gnuradio_blocks/rtklib_pvt_cc.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index 1fc243cb3..8a5ee4e8a 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -30,9 +30,9 @@ #include "rtklib_pvt_cc.h" #include -#include #include #include +#include #include #include #include @@ -304,7 +304,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, } else { - d_rtcm_MT1019_rate_ms = boost::math::lcm(5000, d_output_rate_ms); // default value if not set + d_rtcm_MT1019_rate_ms = boost::integer::lcm(5000, d_output_rate_ms); // default value if not set } if (rtcm_msg_rate_ms.find(1020) != rtcm_msg_rate_ms.end()) { @@ -312,7 +312,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, } else { - d_rtcm_MT1020_rate_ms = boost::math::lcm(5000, d_output_rate_ms); // default value if not set + d_rtcm_MT1020_rate_ms = boost::integer::lcm(5000, d_output_rate_ms); // default value if not set } if (rtcm_msg_rate_ms.find(1045) != rtcm_msg_rate_ms.end()) { @@ -320,7 +320,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, } else { - d_rtcm_MT1045_rate_ms = boost::math::lcm(5000, d_output_rate_ms); // default value if not set + d_rtcm_MT1045_rate_ms = boost::integer::lcm(5000, d_output_rate_ms); // default value if not set } if (rtcm_msg_rate_ms.find(1077) != rtcm_msg_rate_ms.end()) // whatever between 1071 and 1077 { @@ -328,7 +328,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, } else { - d_rtcm_MT1077_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set + d_rtcm_MT1077_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set } if (rtcm_msg_rate_ms.find(1087) != rtcm_msg_rate_ms.end()) // whatever between 1081 and 1087 { @@ -336,7 +336,7 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, } else { - d_rtcm_MT1087_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set + d_rtcm_MT1087_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set } if (rtcm_msg_rate_ms.find(1097) != rtcm_msg_rate_ms.end()) // whatever between 1091 and 1097 { @@ -345,8 +345,8 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, } else { - d_rtcm_MT1097_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set - d_rtcm_MSM_rate_ms = boost::math::lcm(1000, d_output_rate_ms); // default value if not set + d_rtcm_MT1097_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set + d_rtcm_MSM_rate_ms = boost::integer::lcm(1000, d_output_rate_ms); // default value if not set } b_rtcm_writing_started = false;