1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-07-16 08:34:21 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2018-05-01 23:38:34 +02:00
commit aef72772e9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
9 changed files with 462 additions and 355 deletions

View File

@ -29,7 +29,7 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
message(FATAL_ERROR "gnuradio-iio is required for building gnss-sdr with this option enabled.")
endif(NOT IIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
@ -38,12 +38,12 @@ endif(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2)
if(ENABLE_AD9361)
find_package(libiio REQUIRED)
if(NOT LIBIIO_FOUND)
message(STATUS "gnuradio-iio not found, its installation is required.")
message(STATUS "libiio not found, its installation is required.")
message(STATUS "Please build and install the following projects:")
message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio")
message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio")
message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio")
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
message(FATAL_ERROR "libiio is required for building gnss-sdr with this option enabled.")
endif(NOT LIBIIO_FOUND)
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES})
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS})

View File

@ -35,10 +35,8 @@
#include "ad9361_manager.h"
#include "GPS_L1_CA.h"
#include "GPS_L2C.h"
#include <signal.h>
#include <stdio.h>
#include <glog/logging.h>
#include <iostream>
#include <iostream> // for cout, endl
#ifdef __APPLE__
#include <iio/iio.h>
@ -48,9 +46,7 @@
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream,
boost::shared_ptr<gr::msg_queue> queue) :
role_(role), in_stream_(in_stream), out_stream_(out_stream),
queue_(queue)
boost::shared_ptr<gr::msg_queue> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
{
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/signal_source.dat";

View File

@ -34,7 +34,6 @@
#include "gnss_block_interface.h"
#include "fpga_switch.h"
#include <boost/shared_ptr.hpp>
#include <gnuradio/msg_queue.h>
#include <string>
@ -48,7 +47,7 @@ public:
std::string role, unsigned int in_stream,
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
virtual ~Ad9361FpgaSignalSource();
~Ad9361FpgaSignalSource();
inline std::string role() override
{
@ -78,7 +77,7 @@ private:
// Front-end settings
std::string uri_; // device direction
unsigned long freq_; //frequency of local oscilator
unsigned long freq_; // frequency of local oscillator
unsigned long sample_rate_;
unsigned long bandwidth_;
unsigned long buffer_size_; // reception buffer

View File

@ -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}

View File

@ -35,52 +35,33 @@
*/
#include "fpga_switch.h"
#include <cmath>
// FPGA stuff
#include <new>
// libraries used by DMA test code and GIPO test code
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
// libraries used by DMA test code
#include <sys/stat.h>
#include <stdint.h>
#include <unistd.h>
#include <assert.h>
// libraries used by GPIO test code
#include <stdlib.h>
#include <signal.h>
#include <sys/mman.h>
// logging
#include <glog/logging.h>
#include <fcntl.h> // for open, O_RDWR, O_SYNC
#include <iostream> // for cout, endl
#include <sys/mman.h> // for mmap
// string manipulation
#include <string>
// constants
#define PAGE_SIZE 0x10000
#define TEST_REGISTER_TRACK_WRITEVAL 0x55AA
const size_t PAGE_SIZE = 0x10000;
const unsigned int TEST_REGISTER_TRACK_WRITEVAL = 0x55AA;
fpga_switch::fpga_switch(std::string device_name)
{
if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1)
{
LOG(WARNING) << "Cannot open deviceio" << device_name;
printf("switch memory successfully mapped\n");
}
d_map_base = reinterpret_cast<volatile unsigned *>(mmap(NULL, PAGE_SIZE,
d_map_base = reinterpret_cast<volatile unsigned *>(mmap(nullptr, PAGE_SIZE,
PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0));
if (d_map_base == reinterpret_cast<void *>(-1))
{
LOG(WARNING) << "Cannot map the FPGA switch module into tracking memory";
printf("could not map switch memory\n");
std::cout << "Could not map switch memory." << std::endl;
}
else
{
std::cout << "Switch memory successfully mapped." << std::endl;
}
// sanity check : check test register
@ -130,7 +111,7 @@ void fpga_switch::close_device()
unsigned *aux = const_cast<unsigned *>(d_map_base);
if (munmap(static_cast<void *>(aux), PAGE_SIZE) == -1)
{
printf("Failed to unmap memory uio\n");
std::cout << "Failed to unmap memory uio" << std::endl;
}
close(d_device_descriptor);

View File

@ -37,7 +37,7 @@
#ifndef GNSS_SDR_FPGA_SWITCH_H_
#define GNSS_SDR_FPGA_SWITCH_H_
#include <gnuradio/block.h>
#include <string>
#define MAX_LENGTH_DEVICEIO_NAME 50

View File

@ -110,7 +110,15 @@ ControlThread::~ControlThread()
void ControlThread::run()
{
// Connect the flowgraph
try
{
flowgraph_->connect();
}
catch (const std::exception e)
{
LOG(ERROR) << e.what();
return;
}
if (flowgraph_->connected())
{
LOG(INFO) << "Flowgraph connected";
@ -271,6 +279,7 @@ bool ControlThread::read_assistance_from_XML()
return ret;
}
void ControlThread::assist_GNSS()
{
//######### GNSS Assistance #################################

View File

@ -148,7 +148,6 @@
#include "gps_l1_ca_dll_pll_tracking_gpu.h"
#endif
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <string>
#include <sstream>
@ -169,9 +168,16 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
{
std::string default_implementation = "File_Signal_Source";
std::string role = "SignalSource"; //backwards compatibility for old conf files
try
{
if (ID != -1)
{
role = "SignalSource" + boost::lexical_cast<std::string>(ID);
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<GNSSBlockInterface> GNSSBlockFactory::GetSignalConditioner(
std::string role_datatypeadapter = "DataTypeAdapter";
std::string role_inputfilter = "InputFilter";
std::string role_resampler = "Resampler";
try
{
if (ID != -1)
{
role_conditioner = "SignalConditioner" + boost::lexical_cast<std::string>(ID);
role_datatypeadapter = "DataTypeAdapter" + boost::lexical_cast<std::string>(ID);
role_inputfilter = "InputFilter" + boost::lexical_cast<std::string>(ID);
role_resampler = "Resampler" + boost::lexical_cast<std::string>(ID);
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<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_1C" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_1C" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -358,31 +369,31 @@ std::unique_ptr<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_2S" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_2S" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -426,31 +437,31 @@ std::unique_ptr<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_1B" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_1B" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -494,31 +505,31 @@ std::unique_ptr<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_5X" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_5X" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -563,31 +574,31 @@ std::unique_ptr<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_1G" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_1G" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -632,31 +643,31 @@ std::unique_ptr<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_2G" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_2G" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -700,31 +711,31 @@ std::unique_ptr<GNSSBlockInterface> 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<std::string>(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<std::string>(channel);
appendix1 = std::to_string(channel);
}
else
{
appendix1 = "";
}
aux = configuration->property("Tracking_L5" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix2 = std::to_string(channel);
}
else
{
appendix2 = "";
}
aux = configuration->property("TelemetryDecoder_L5" + boost::lexical_cast<std::string>(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<std::string>(channel);
appendix3 = std::to_string(channel);
}
else
{
@ -768,23 +779,24 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> 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<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels(new std::vector<std::unique_ptr<GNSSBlockInterface>>(total_channels));
try
{
//**************** 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);
@ -795,14 +807,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_1C" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_1C" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_1C" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_1C" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -824,14 +836,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_2S" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_2S" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_2S" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_2S" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -853,14 +865,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_L5" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_L5" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_L5" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_L5" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -882,14 +894,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_1B" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_1B" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_1B" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_1B" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -911,14 +923,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_1C0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_5X" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_5X" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_5X" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_5X" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -941,14 +953,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_1G0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_1G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_1G" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_1G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_1G" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -971,14 +983,14 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
{
//(i.e. Acquisition_2G0.implementation=xxxx)
std::string acquisition_implementation_specific = configuration->property(
"Acquisition_2G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"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" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"Tracking_2G" + std::to_string(channel_absolute_id) + ".implementation",
tracking_implementation);
std::string telemetry_decoder_implementation_specific = configuration->property(
"TelemetryDecoder_2G" + boost::lexical_cast<std::string>(channel_absolute_id) + ".implementation",
"TelemetryDecoder_2G" + std::to_string(channel_absolute_id) + ".implementation",
telemetry_decoder_implementation);
// Push back the channel to the vector of channels
@ -990,6 +1002,11 @@ std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GNSSBlockFacto
queue));
channel_absolute_id++;
}
}
catch (const std::exception &e)
{
LOG(WARNING) << e.what();
}
return channels;
}

View File

@ -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" + boost::lexical_cast<std::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<unsigned int> vector_of_channels;
for (unsigned int i = 0; i < channels_count_; i++)
{
unsigned int sat = configuration_->property("Channel" + boost::lexical_cast<std::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" + boost::lexical_cast<std::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,9 +533,18 @@ 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);
@ -521,14 +552,58 @@ void GNSSFlowgraph::disconnect()
}
catch (const std::exception& e)
{
LOG(INFO) << "Can't disconnect sample counter: " << e.what();
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
}
catch (const std::exception& e)
{
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" + boost::lexical_cast<std::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<std::string>(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" + boost::lexical_cast<std::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;