diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 9cb569618..073cc343f 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -52,10 +52,10 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) endif(LIBIIO_FOUND) endif(ENABLE_FMCOMMS2 OR ENABLE_AD9361) -if(ENABLE_FPGA) +if(ENABLE_FPGA OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_switch.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_switch.h) -endif(ENABLE_FPGA) +endif(ENABLE_FPGA OR ENABLE_AD9361) include_directories( ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 9121d7fa7..aba3c0272 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -110,7 +110,15 @@ ControlThread::~ControlThread() void ControlThread::run() { // Connect the flowgraph - flowgraph_->connect(); + try + { + flowgraph_->connect(); + } + catch (const std::exception e) + { + LOG(ERROR) << e.what(); + return; + } if (flowgraph_->connected()) { LOG(INFO) << "Flowgraph connected"; @@ -141,9 +149,9 @@ void ControlThread::run() bool enable_FPGA = configuration_->property("Channel.enable_FPGA", false); if (enable_FPGA == true) - { - flowgraph_->start_acquisition_helper(); - } + { + flowgraph_->start_acquisition_helper(); + } // Main loop to read and process the control messages while (flowgraph_->running() && !stop_) @@ -271,6 +279,7 @@ bool ControlThread::read_assistance_from_XML() return ret; } + void ControlThread::assist_GNSS() { //######### GNSS Assistance ################################# diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 09d396b36..329f2e168 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -148,7 +148,6 @@ #include "gps_l1_ca_dll_pll_tracking_gpu.h" #endif -#include #include #include #include @@ -169,9 +168,16 @@ std::unique_ptr GNSSBlockFactory::GetSignalSource( { std::string default_implementation = "File_Signal_Source"; std::string role = "SignalSource"; //backwards compatibility for old conf files - if (ID != -1) + try { - role = "SignalSource" + boost::lexical_cast(ID); + if (ID != -1) + { + role = "SignalSource" + std::to_string(ID); + } + } + catch (const std::exception &e) + { + LOG(WARNING) << e.what(); } std::string implementation = configuration->property(role + ".implementation", default_implementation); LOG(INFO) << "Getting SignalSource with implementation " << implementation; @@ -188,15 +194,20 @@ std::unique_ptr GNSSBlockFactory::GetSignalConditioner( std::string role_datatypeadapter = "DataTypeAdapter"; std::string role_inputfilter = "InputFilter"; std::string role_resampler = "Resampler"; - - if (ID != -1) + try { - role_conditioner = "SignalConditioner" + boost::lexical_cast(ID); - role_datatypeadapter = "DataTypeAdapter" + boost::lexical_cast(ID); - role_inputfilter = "InputFilter" + boost::lexical_cast(ID); - role_resampler = "Resampler" + boost::lexical_cast(ID); + if (ID != -1) + { + role_conditioner = "SignalConditioner" + std::to_string(ID); + role_datatypeadapter = "DataTypeAdapter" + std::to_string(ID); + role_inputfilter = "InputFilter" + std::to_string(ID); + role_resampler = "Resampler" + std::to_string(ID); + } + } + catch (const std::exception &e) + { + LOG(WARNING) << e.what(); } - std::string signal_conditioner = configuration->property(role_conditioner + ".implementation", default_implementation); std::string data_type_adapter; @@ -293,31 +304,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1C( LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; - std::string aux = configuration->property("Acquisition_1C" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_1C" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_1C" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_1C" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_1C" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_1C" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -358,31 +369,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2S( { LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; - std::string aux = configuration->property("Acquisition_2S" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_2S" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_2S" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_2S" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_2S" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_2S" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -426,31 +437,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1B( std::string id = stream.str(); LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; - std::string aux = configuration->property("Acquisition_1B" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_1B" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_1B" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_1B" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_1B" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_1B" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -494,31 +505,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( std::string id = stream.str(); LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; - std::string aux = configuration->property("Acquisition_5X" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_5X" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_5X" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_5X" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_5X" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_5X" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -563,31 +574,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm; - std::string aux = configuration->property("Acquisition_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_1G" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_1G" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_1G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_1G" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -632,31 +643,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2G( LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder Implementation: " << tlm; - std::string aux = configuration->property("Acquisition_2G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_2G" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_2G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_2G" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_2G" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_2G" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -700,31 +711,31 @@ std::unique_ptr GNSSBlockFactory::GetChannel_L5( std::string id = stream.str(); LOG(INFO) << "Instantiating Channel " << id << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; - std::string aux = configuration->property("Acquisition_L5" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + std::string aux = configuration->property("Acquisition_L5" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix1; if (aux.compare("W") != 0) { - appendix1 = boost::lexical_cast(channel); + appendix1 = std::to_string(channel); } else { appendix1 = ""; } - aux = configuration->property("Tracking_L5" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("Tracking_L5" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix2; if (aux.compare("W") != 0) { - appendix2 = boost::lexical_cast(channel); + appendix2 = std::to_string(channel); } else { appendix2 = ""; } - aux = configuration->property("TelemetryDecoder_L5" + boost::lexical_cast(channel) + ".implementation", std::string("W")); + aux = configuration->property("TelemetryDecoder_L5" + std::to_string(channel) + ".implementation", std::string("W")); std::string appendix3; if (aux.compare("W") != 0) { - appendix3 = boost::lexical_cast(channel); + appendix3 = std::to_string(channel); } else { @@ -768,227 +779,233 @@ std::unique_ptr>> GNSSBlockFacto unsigned int channel_absolute_id = 0; unsigned int Channels_1C_count = configuration->property("Channels_1C.count", 0); - unsigned int Channels_2S_count = configuration->property("Channels_2S.count", 0); unsigned int Channels_1B_count = configuration->property("Channels_1B.count", 0); - unsigned int Channels_5X_count = configuration->property("Channels_5X.count", 0); unsigned int Channels_1G_count = configuration->property("Channels_1G.count", 0); unsigned int Channels_2G_count = configuration->property("Channels_2G.count", 0); + unsigned int Channels_2S_count = configuration->property("Channels_2S.count", 0); + unsigned int Channels_5X_count = configuration->property("Channels_5X.count", 0); unsigned int Channels_L5_count = configuration->property("Channels_L5.count", 0); unsigned int total_channels = Channels_1C_count + - Channels_2S_count + Channels_1B_count + - Channels_5X_count + Channels_1G_count + + Channels_2S_count + Channels_2G_count + + Channels_5X_count + Channels_L5_count; std::unique_ptr>> channels(new std::vector>(total_channels)); - - //**************** GPS L1 C/A CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_1C_count << " GPS L1 C/A channels"; - acquisition_implementation = configuration->property("Acquisition_1C.implementation", default_implementation); - tracking_implementation = configuration->property("Tracking_1C.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1C.implementation", default_implementation); - - for (unsigned int i = 0; i < Channels_1C_count; i++) + try { - //(i.e. Acquisition_1C0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_1C" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_1C0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_1C" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_1C" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); + //**************** GPS L1 C/A CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_1C_count << " GPS L1 C/A channels"; + acquisition_implementation = configuration->property("Acquisition_1C.implementation", default_implementation); + tracking_implementation = configuration->property("Tracking_1C.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1C.implementation", default_implementation); - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_1C(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; + for (unsigned int i = 0; i < Channels_1C_count; i++) + { + //(i.e. Acquisition_1C0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_1C" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1C0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_1C" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_1C" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_1C(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + + //**************** GPS L2C (M) CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_2S_count << " GPS L2C (M) channels"; + tracking_implementation = configuration->property("Tracking_2S.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_2S.implementation", default_implementation); + acquisition_implementation = configuration->property("Acquisition_2S.implementation", default_implementation); + for (unsigned int i = 0; i < Channels_2S_count; i++) + { + //(i.e. Acquisition_1C0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_2S" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1C0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_2S" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_2S" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_2S(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + + //**************** GPS L5 CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_L5_count << " GPS L5 channels"; + tracking_implementation = configuration->property("Tracking_L5.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_L5.implementation", default_implementation); + acquisition_implementation = configuration->property("Acquisition_L5.implementation", default_implementation); + for (unsigned int i = 0; i < Channels_L5_count; i++) + { + //(i.e. Acquisition_1C0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_L5" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1C0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_L5" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_L5" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_L5(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + + //**************** GALILEO E1 B (I/NAV OS) CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_1B_count << " GALILEO E1 B (I/NAV OS) channels"; + tracking_implementation = configuration->property("Tracking_1B.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1B.implementation", default_implementation); + acquisition_implementation = configuration->property("Acquisition_1B.implementation", default_implementation); + for (unsigned int i = 0; i < Channels_1B_count; i++) + { + //(i.e. Acquisition_1C0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_1B" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1C0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_1B" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_1B" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_1B(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + + //**************** GALILEO E5a I (F/NAV OS) CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_5X_count << " GALILEO E5a I (F/NAV OS) channels"; + tracking_implementation = configuration->property("Tracking_5X.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_5X.implementation", default_implementation); + acquisition_implementation = configuration->property("Acquisition_5X.implementation", default_implementation); + for (unsigned int i = 0; i < Channels_5X_count; i++) + { + //(i.e. Acquisition_1C0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_5X" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1C0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_5X" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_5X" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_5X(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + + //**************** GLONASS L1 C/A CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_1G_count << " GLONASS L1 C/A channels"; + acquisition_implementation = configuration->property("Acquisition_1G.implementation", default_implementation); + tracking_implementation = configuration->property("Tracking_1G.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1G.implementation", default_implementation); + + for (unsigned int i = 0; i < Channels_1G_count; i++) + { + //(i.e. Acquisition_1G0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_1G" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_1G0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_1G" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_1G" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_1G(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } + + //**************** GLONASS L2 C/A CHANNELS ********************** + LOG(INFO) << "Getting " << Channels_2G_count << " GLONASS L2 C/A channels"; + acquisition_implementation = configuration->property("Acquisition_2G.implementation", default_implementation); + tracking_implementation = configuration->property("Tracking_2G.implementation", default_implementation); + telemetry_decoder_implementation = configuration->property("TelemetryDecoder_2G.implementation", default_implementation); + + for (unsigned int i = 0; i < Channels_2G_count; i++) + { + //(i.e. Acquisition_2G0.implementation=xxxx) + std::string acquisition_implementation_specific = configuration->property( + "Acquisition_2G" + std::to_string(channel_absolute_id) + ".implementation", + acquisition_implementation); + //(i.e. Tracking_2G0.implementation=xxxx) + std::string tracking_implementation_specific = configuration->property( + "Tracking_2G" + std::to_string(channel_absolute_id) + ".implementation", + tracking_implementation); + std::string telemetry_decoder_implementation_specific = configuration->property( + "TelemetryDecoder_2G" + std::to_string(channel_absolute_id) + ".implementation", + telemetry_decoder_implementation); + + // Push back the channel to the vector of channels + channels->at(channel_absolute_id) = std::move(GetChannel_2G(configuration, + acquisition_implementation_specific, + tracking_implementation_specific, + telemetry_decoder_implementation_specific, + channel_absolute_id, + queue)); + channel_absolute_id++; + } } - - //**************** GPS L2C (M) CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_2S_count << " GPS L2C (M) channels"; - tracking_implementation = configuration->property("Tracking_2S.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_2S.implementation", default_implementation); - acquisition_implementation = configuration->property("Acquisition_2S.implementation", default_implementation); - for (unsigned int i = 0; i < Channels_2S_count; i++) + catch (const std::exception &e) { - //(i.e. Acquisition_1C0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_2S" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_1C0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_2S" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_2S" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); - - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_2S(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; - } - - //**************** GPS L5 CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_L5_count << " GPS L5 channels"; - tracking_implementation = configuration->property("Tracking_L5.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_L5.implementation", default_implementation); - acquisition_implementation = configuration->property("Acquisition_L5.implementation", default_implementation); - for (unsigned int i = 0; i < Channels_L5_count; i++) - { - //(i.e. Acquisition_1C0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_L5" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_1C0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_L5" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_L5" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); - - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_L5(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; - } - - //**************** GALILEO E1 B (I/NAV OS) CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_1B_count << " GALILEO E1 B (I/NAV OS) channels"; - tracking_implementation = configuration->property("Tracking_1B.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1B.implementation", default_implementation); - acquisition_implementation = configuration->property("Acquisition_1B.implementation", default_implementation); - for (unsigned int i = 0; i < Channels_1B_count; i++) - { - //(i.e. Acquisition_1C0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_1B" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_1C0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_1B" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_1B" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); - - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_1B(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; - } - - //**************** GALILEO E5a I (F/NAV OS) CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_5X_count << " GALILEO E5a I (F/NAV OS) channels"; - tracking_implementation = configuration->property("Tracking_5X.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_5X.implementation", default_implementation); - acquisition_implementation = configuration->property("Acquisition_5X.implementation", default_implementation); - for (unsigned int i = 0; i < Channels_5X_count; i++) - { - //(i.e. Acquisition_1C0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_5X" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_1C0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_5X" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_5X" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); - - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_5X(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; - } - - //**************** GLONASS L1 C/A CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_1G_count << " GLONASS L1 C/A channels"; - acquisition_implementation = configuration->property("Acquisition_1G.implementation", default_implementation); - tracking_implementation = configuration->property("Tracking_1G.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_1G.implementation", default_implementation); - - for (unsigned int i = 0; i < Channels_1G_count; i++) - { - //(i.e. Acquisition_1G0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_1G" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_1G0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_1G" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_1G" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); - - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_1G(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; - } - - //**************** GLONASS L2 C/A CHANNELS ********************** - LOG(INFO) << "Getting " << Channels_2G_count << " GLONASS L2 C/A channels"; - acquisition_implementation = configuration->property("Acquisition_2G.implementation", default_implementation); - tracking_implementation = configuration->property("Tracking_2G.implementation", default_implementation); - telemetry_decoder_implementation = configuration->property("TelemetryDecoder_2G.implementation", default_implementation); - - for (unsigned int i = 0; i < Channels_2G_count; i++) - { - //(i.e. Acquisition_2G0.implementation=xxxx) - std::string acquisition_implementation_specific = configuration->property( - "Acquisition_2G" + boost::lexical_cast(channel_absolute_id) + ".implementation", - acquisition_implementation); - //(i.e. Tracking_2G0.implementation=xxxx) - std::string tracking_implementation_specific = configuration->property( - "Tracking_2G" + boost::lexical_cast(channel_absolute_id) + ".implementation", - tracking_implementation); - std::string telemetry_decoder_implementation_specific = configuration->property( - "TelemetryDecoder_2G" + boost::lexical_cast(channel_absolute_id) + ".implementation", - telemetry_decoder_implementation); - - // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_2G(configuration, - acquisition_implementation_specific, - tracking_implementation_specific, - telemetry_decoder_implementation_specific, - channel_absolute_id, - queue)); - channel_absolute_id++; + LOG(WARNING) << e.what(); } return channels; diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 17cb2205a..c12c126ae 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -310,7 +310,6 @@ void GNSSFlowgraph::connect() return; } } - #else // connect the signal source to sample counter // connect the sample counter to Observables @@ -341,7 +340,14 @@ void GNSSFlowgraph::connect() { if (FPGA_enabled == false) { - selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0); + try + { + selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } try { top_block_->connect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, @@ -376,7 +382,15 @@ void GNSSFlowgraph::connect() std::vector vector_of_channels; for (unsigned int i = 0; i < channels_count_; i++) { - unsigned int sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); + unsigned int sat = 0; + try + { + sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } if (sat == 0) { vector_of_channels.push_back(i); @@ -392,7 +406,15 @@ void GNSSFlowgraph::connect() for (unsigned int& i : vector_of_channels) { std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str(); // use channel's implicit signal - unsigned int sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); + unsigned int sat = 0; + try + { + sat = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } if (sat == 0) { channels_.at(i)->set_signal(search_next_signal(gnss_signal, true)); @@ -459,7 +481,7 @@ void GNSSFlowgraph::disconnect() LOG(INFO) << "flowgraph was not connected"; return; } - + connected_ = false; // Signal Source (i) > Signal conditioner (i) > int RF_Channels = 0; int signal_conditioner_ID = 0; @@ -511,24 +533,77 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect signal source " << i << " to signal conditioner " << i << ": " << e.what(); + top_block_->disconnect_all(); + return; } } + bool FPGA_enabled = configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false); + +#if ENABLE_FPGA + if (FPGA_enabled == false) + { + // disconnect the signal source to sample counter + // disconnect the sample counter to Observables + try + { + top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0); + top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); // extra port for the sample counter pulse + } + catch (const std::exception& e) + { + LOG(WARNING) << "Can't disconnect sample counter"; + LOG(ERROR) << e.what(); + top_block_->disconnect_all(); + return; + } + } + else + { + try + { + top_block_->disconnect(null_source_, 0, throttle_, 0); + top_block_->disconnect(throttle_, 0, time_counter_, 0); + top_block_->disconnect(time_counter_, 0, observables_->get_left_block(), channels_count_); + } + catch (const std::exception& e) + { + LOG(WARNING) << "Can't connect sample counter"; + LOG(ERROR) << e.what(); + top_block_->disconnect_all(); + return; + } + } +#else + // disconnect the signal source to sample counter + // disconnect the sample counter to Observables try { top_block_->disconnect(sig_conditioner_.at(0)->get_right_block(), 0, ch_out_sample_counter, 0); - top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); //extra port for the sample counter pulse + top_block_->disconnect(ch_out_sample_counter, 0, observables_->get_left_block(), channels_count_); // extra port for the sample counter pulse } catch (const std::exception& e) { - LOG(INFO) << "Can't disconnect sample counter: " << e.what(); + LOG(WARNING) << "Can't connect sample counter"; + LOG(ERROR) << e.what(); + top_block_->disconnect_all(); + return; } - +#endif // Signal conditioner (selected_signal_source) >> channels (i) (dependent of their associated SignalSource_ID) int selected_signal_conditioner_ID; for (unsigned int i = 0; i < channels_count_; i++) { - selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0); + try + { + selected_signal_conditioner_ID = configuration_->property("Channel" + std::to_string(i) + ".RF_channel_ID", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + top_block_->disconnect_all(); + return; + } try { top_block_->disconnect(sig_conditioner_.at(selected_signal_conditioner_ID)->get_right_block(), 0, @@ -537,6 +612,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect signal conditioner " << selected_signal_conditioner_ID << " to channel " << i << ": " << e.what(); + top_block_->disconnect_all(); + return; } // Signal Source > Signal conditioner >> Channels >> Observables @@ -548,6 +625,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect channel " << i << " to observables: " << e.what(); + top_block_->disconnect_all(); + return; } } @@ -562,6 +641,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect observables to PVT: " << e.what(); + top_block_->disconnect_all(); + return; } for (int i = 0; i < sources_count_; i++) @@ -573,6 +654,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect signal source block " << i << " internally: " << e.what(); + top_block_->disconnect_all(); + return; } } @@ -586,6 +669,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect signal conditioner block " << i << " internally: " << e.what(); + top_block_->disconnect_all(); + return; } } @@ -598,6 +683,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect channel " << i << " internally: " << e.what(); + top_block_->disconnect_all(); + return; } } @@ -608,6 +695,8 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect observables block internally: " << e.what(); + top_block_->disconnect_all(); + return; } // Signal Source > Signal conditioner >> Channels >> Observables > PVT @@ -618,11 +707,11 @@ void GNSSFlowgraph::disconnect() catch (const std::exception& e) { LOG(INFO) << "Can't disconnect PVT block internally: " << e.what(); + top_block_->disconnect_all(); + return; } DLOG(INFO) << "blocks disconnected internally"; - - connected_ = false; LOG(INFO) << "Flowgraph disconnected"; } @@ -658,7 +747,15 @@ bool GNSSFlowgraph::send_telemetry_msg(pmt::pmt_t msg) void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_; - unsigned int sat = configuration_->property("Channel" + boost::lexical_cast(who) + ".satellite", 0); + unsigned int sat = 0; + try + { + sat = configuration_->property("Channel" + std::to_string(who) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } switch (what) { case 0: @@ -679,7 +776,15 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) acq_channels_count_--; for (unsigned int i = 0; i < channels_count_; i++) { - unsigned int sat_ = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); + unsigned int sat_ = 0; + try + { + sat_ = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) { channels_state_[i] = 1; @@ -828,7 +933,7 @@ void GNSSFlowgraph::init() std::cout << "Please update your configuration file." << std::endl; } - std::shared_ptr > > channels = block_factory_->GetChannels(configuration_, queue_); + std::shared_ptr>> channels = block_factory_->GetChannels(configuration_, queue_); channels_count_ = channels->size(); for (unsigned int i = 0; i < channels_count_; i++)