gnss-sdr/src/core/receiver/gnss_block_factory.cc

343 lines
12 KiB
C++
Raw Normal View History

/*!
* \file gnss_block_factory.cc
* \brief This class implements a factory that returns instances of GNSS blocks.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2012. luis(at)epsilon-formacion.com
- Major changes: - The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively. - Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature. - Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file. - Tracking blocks now uses DOUBLE values in their outputs. - Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT - Temporarily disabled the RINEX output (I am working on that!) - GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file. - Bug fixes: - FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file. - GPS_L1_CA_DLL_PLL now computes correctly the PRN start values. - GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values. - Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation. - New features - Tracking blocks perform a signal integrity check against NaN outliers before the correlation process. - Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs" - Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms. - GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file. - Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth. - We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
* Javier Arribas, 2011. jarribas(at)cttc.es
*
* This class encapsulates the complexity behind the instantiation
* of GNSS blocks.
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2012 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "gnss_block_factory.h"
#include <string>
#include <sstream>
#include <iostream>
#include <boost/lexical_cast.hpp>
#include <glog/log_severity.h>
#include <glog/logging.h>
#include "configuration_interface.h"
#include "gnss_block_interface.h"
#include "pass_through.h"
#include "file_signal_source.h"
#include "null_sink_output_filter.h"
#include "file_output_filter.h"
#include "channel.h"
#include "uhd_signal_source.h"
#include "signal_conditioner.h"
#include "direct_resampler_conditioner.h"
#include "fir_filter.h"
#include "gps_l1_ca_pcps_acquisition.h"
#include "gps_l1_ca_dll_pll_tracking.h"
GNSS-SDR Major changes: New tracking libraries: - tracking_discriminators: Library with a set of code tracking and carrier tracking discriminators that is used by the tracking algorithms. (fully documented, including math algorithms using doxygen!) - tracking_2rd_DLL_filter: Class that implements 2 order DLL filter for code tracking loop. - tracking_2rd_PLL_filter: Class that implements 2 order PLL filter for carrier tracking loop. - tracking_FLL_PLL_filter: Class that implements hybrid FLL and PLL filter for tracking carrier loop. - CN_estimators: Library with a set of Carrier to Noise estimators and lock detectors. (fully documented, including math algorithms using doxygen!) Tracking: - gps_l1_ca_dll_pll_tracking: The existing DLL + PLL tracking module, which is the K.Borre and D.Akos one, is now completely re-factored. Now uses the above described libraries. - gps_l1_ca_dll_fll_pll_tracking: This is a brand new tracking module, which implements the FLL assisted PLL described in Kaplan (2nd edition). (also documentedwith references) Configuration options: - The following tracking parameters are added: ;######### TRACKING CONFIG ############ ; Tracking.implementation=GPS_L1_CA_DLL_PLL_Tracking or GPS_L1_CA_DLL_FLL_PLL_Tracking Tracking.implementation=GPS_L1_CA_DLL_FLL_PLL_Tracking ;PLL filter bandwidth in Hz. Tracking.pll_bw_hz=50.0; ;DLL filter bandwidth in Hz. Tracking.dll_bw_hz=2.0; ;FLL filter bandwidth in Hz. Tracking.fll_bw_hz=50; ;filter order: choice between 2 or 3 at this moment, only for FLL assisted PLL Tracking.order=2; ;Correlator space in chips units Tracking.early_late_space_chips=0.5; Other files have also been modified with minor changes to adapt to new modules or minor bug fixes. git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@80 64b25241-fba3-4117-9849-534c7e92360d
2011-11-22 17:21:54 +00:00
#include "gps_l1_ca_dll_fll_pll_tracking.h"
#include "gps_l1_ca_tcp_connector_tracking.h"
#include "gps_l1_ca_telemetry_decoder.h"
#include "gps_l1_ca_observables.h"
- Major changes: - The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively. - Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature. - Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file. - Tracking blocks now uses DOUBLE values in their outputs. - Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT - Temporarily disabled the RINEX output (I am working on that!) - GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file. - Bug fixes: - FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file. - GPS_L1_CA_DLL_PLL now computes correctly the PRN start values. - GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values. - Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation. - New features - Tracking blocks perform a signal integrity check against NaN outliers before the correlation process. - Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs" - Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms. - GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file. - Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth. - We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
#include "gps_l1_ca_pvt.h"
using google::LogMessage;
GNSSBlockFactory::GNSSBlockFactory()
{
}
GNSSBlockFactory::~GNSSBlockFactory()
{
}
GNSSBlockInterface* GNSSBlockFactory::GetSignalSource(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
{
std::string default_implementation = "File_Signal_Source";
std::string implementation = configuration->property(
"SignalSource.implementation", default_implementation);
DLOG(INFO) << "Getting SignalSource with implementation "
<< implementation;
return GetBlock(configuration, "SignalSource", implementation, 0, 1,
queue);
}
GNSSBlockInterface* GNSSBlockFactory::GetSignalConditioner(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
{
std::string default_implementation = "Pass_Through";
std::string data_type_adapter = configuration->property(
"DataTypeAdapter.implementation", default_implementation);
std::string input_filter = configuration->property(
"InputFilter.implementation", default_implementation);
std::string resampler = configuration->property(
"Resampler.implementation", default_implementation);
DLOG(INFO) << "Getting SignalConditioner with DataTypeAdapter implementation: "
<< data_type_adapter << ", InputFilter implementation: "
<< input_filter << ", and Resampler implementation: "
<< resampler;
return new SignalConditioner(configuration, GetBlock(configuration,
"DataTypeAdapter", data_type_adapter, 1, 1, queue), GetBlock(
configuration,"InputFilter", input_filter, 1, 1, queue),
GetBlock(configuration,"Resampler", resampler, 1, 1, queue),
"SignalConditioner", "Signal_Conditioner", queue);
}
GNSSBlockInterface* GNSSBlockFactory::GetObservables(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
{
std::string default_implementation = "GPS_L1_CA_Observables";
std::string implementation = configuration->property(
"Observables.implementation", default_implementation);
DLOG(INFO) << "Getting Observables with implementation "
<< implementation;
unsigned int channel_count =
configuration->property("Channels.count", 12);
return GetBlock(configuration, "Observables", implementation,
channel_count, channel_count, queue);
}
GNSSBlockInterface* GNSSBlockFactory::GetPVT(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
{
std::string default_implementation = "Pass_Through";
std::string implementation = configuration->property(
"PVT.implementation", default_implementation);
DLOG(INFO) << "Getting PVT with implementation " << implementation;
unsigned int channel_count =
configuration->property("Channels.count", 12);
return GetBlock(configuration, "PVT", implementation, channel_count, 1,
queue);
}
GNSSBlockInterface* GNSSBlockFactory::GetOutputFilter(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
{
std::string default_implementation = "Null_Sink_Output_Filter";
std::string implementation = configuration->property(
"OutputFilter.implementation", default_implementation);
DLOG(INFO) << "Getting OutputFilter with implementation "
<< implementation;
return GetBlock(configuration, "OutputFilter", implementation, 1, 0,
queue);
}
GNSSBlockInterface* GNSSBlockFactory::GetChannel(
ConfigurationInterface *configuration, std::string acq,
std::string trk, std::string tlm, int channel,
gr_msg_queue_sptr queue)
{
std::stringstream stream;
stream << channel;
std::string id = stream.str();
DLOG(INFO) << "Instantiating channel " << id;
return new Channel(configuration, channel, GetBlock(configuration,
"Channel", "Pass_Through", 1, 1, queue),
(AcquisitionInterface*)GetBlock(configuration, "Acquisition",
acq, 1, 1, queue), (TrackingInterface*)GetBlock(
configuration, "Tracking", trk, 1, 1, queue),
(TelemetryDecoderInterface*)GetBlock(configuration,
"TelemetryDecoder", tlm, 1, 1, queue), "Channel",
"Channel", queue);
}
std::vector<GNSSBlockInterface*>* GNSSBlockFactory::GetChannels(
ConfigurationInterface *configuration, gr_msg_queue_sptr queue)
{
std::string default_implementation = "Pass_Through";
unsigned int channel_count =
configuration->property("Channels.count", 12);
std::vector<GNSSBlockInterface*>* channels = new std::vector<
GNSSBlockInterface*>();
std::string tracking = configuration->property("Tracking.implementation",
default_implementation);
std::string telemetry_decoder = configuration->property(
"TelemetryDecoder.implementation", default_implementation);
for (unsigned int i = 0; i < channel_count; i++)
{
std::string acquisition_implementation_name = "Acquisition"
+ boost::lexical_cast<std::string>(i) + ".implementation";
std::string acquisition_implementation = configuration->property(
acquisition_implementation_name, default_implementation);
channels->push_back(GetChannel(configuration,
acquisition_implementation, tracking, telemetry_decoder, i,
queue));
// std::cout << "getchannel_" << i << ", acq_implementation_name: "
// << acquisition_implementation_name << ", implementation: "
// << acquisition_implementation << std::endl;
}
DLOG(INFO) << "Getting " << channel_count << " channels";
return channels;
}
/*
* Returns the block with the required configuration and implementation
*
* PLEASE ADD YOUR NEW BLOCK HERE!!
*/
GNSSBlockInterface* GNSSBlockFactory::GetBlock(
ConfigurationInterface *configuration, std::string role,
std::string implementation, unsigned int in_streams,
unsigned int out_streams, gr_msg_queue_sptr queue)
{
GNSSBlockInterface* block = NULL; //Change to nullptr when available in compilers (C++11)
//PASS THROUGH ----------------------------------------------------------------
if (implementation.compare("Pass_Through") == 0)
{
block = new Pass_Through(configuration, role, in_streams, out_streams);
}
// SIGNAL SOURCES -------------------------------------------------------------
else if (implementation.compare("File_Signal_Source") == 0)
{
block = new FileSignalSource(configuration, role, in_streams,
out_streams, queue);
}
else if (implementation.compare("UHD_Signal_Source") == 0)
{
block = new UhdSignalSource(configuration, role, in_streams,
out_streams, queue);
}
// DATA TYPE ADAPTER -----------------------------------------------------------
// INPUT FILTER ----------------------------------------------------------------
else if (implementation.compare("Fir_Filter") == 0)
{
block = new FirFilter(configuration, role, in_streams,
out_streams, queue);
}
// RESAMPLER -------------------------------------------------------------------
else if (implementation.compare("Direct_Resampler") == 0)
{
block = new DirectResamplerConditioner(configuration, role,
in_streams, out_streams);
}
// ACQUISITION BLOCKS ---------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_PCPS_Acquisition") == 0)
{
block = new GpsL1CaPcpsAcquisition(configuration, role, in_streams,
out_streams, queue);
}
// TRACKING BLOCKS -------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_DLL_PLL_Tracking") == 0)
{
block = new GpsL1CaDllPllTracking(configuration, role, in_streams,
out_streams, queue);
}
GNSS-SDR Major changes: New tracking libraries: - tracking_discriminators: Library with a set of code tracking and carrier tracking discriminators that is used by the tracking algorithms. (fully documented, including math algorithms using doxygen!) - tracking_2rd_DLL_filter: Class that implements 2 order DLL filter for code tracking loop. - tracking_2rd_PLL_filter: Class that implements 2 order PLL filter for carrier tracking loop. - tracking_FLL_PLL_filter: Class that implements hybrid FLL and PLL filter for tracking carrier loop. - CN_estimators: Library with a set of Carrier to Noise estimators and lock detectors. (fully documented, including math algorithms using doxygen!) Tracking: - gps_l1_ca_dll_pll_tracking: The existing DLL + PLL tracking module, which is the K.Borre and D.Akos one, is now completely re-factored. Now uses the above described libraries. - gps_l1_ca_dll_fll_pll_tracking: This is a brand new tracking module, which implements the FLL assisted PLL described in Kaplan (2nd edition). (also documentedwith references) Configuration options: - The following tracking parameters are added: ;######### TRACKING CONFIG ############ ; Tracking.implementation=GPS_L1_CA_DLL_PLL_Tracking or GPS_L1_CA_DLL_FLL_PLL_Tracking Tracking.implementation=GPS_L1_CA_DLL_FLL_PLL_Tracking ;PLL filter bandwidth in Hz. Tracking.pll_bw_hz=50.0; ;DLL filter bandwidth in Hz. Tracking.dll_bw_hz=2.0; ;FLL filter bandwidth in Hz. Tracking.fll_bw_hz=50; ;filter order: choice between 2 or 3 at this moment, only for FLL assisted PLL Tracking.order=2; ;Correlator space in chips units Tracking.early_late_space_chips=0.5; Other files have also been modified with minor changes to adapt to new modules or minor bug fixes. git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@80 64b25241-fba3-4117-9849-534c7e92360d
2011-11-22 17:21:54 +00:00
else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0)
{
block = new GpsL1CaDllFllPllTracking(configuration, role, in_streams,
out_streams, queue);
}
else if (implementation.compare("GPS_L1_CA_TCP_CONNECTOR_Tracking") == 0)
{
block = new GpsL1CaTcpConnectorTracking(configuration, role, in_streams,
out_streams, queue);
}
// TELEMETRY DECODERS ----------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_Telemetry_Decoder") == 0)
{
block = new GpsL1CaTelemetryDecoder(configuration, role, in_streams,
out_streams, queue);
}
// OBSERVABLES -----------------------------------------------------------------
else if (implementation.compare("GPS_L1_CA_Observables") == 0)
{
block = new GpsL1CaObservables(configuration, role, in_streams,
out_streams, queue);
}
// PVT -------------------------------------------------------------------------
- Major changes: - The executable file and the default configuration file is now changed from "./install/mercurio" and "./conf/mercurio.conf" to "./install/gnss-sdr" and "./conf/gnss-sdr.conf", respectively. - Configuration file structure changed to define in a single entry the internal sampling frequency (after the signal conditioner). NOTICE that this change affects the all the adapters (acquisition, tracking, telemetry_decoder, observables, and PVT). All the adapters are now modified to work with this feature. - Moved several in-line GPS L1 CA parameters (a.k.a magic numbers..) to ./src/core/system_parameters/GPS_L1_CA.h definition file. - Tracking blocks now uses DOUBLE values in their outputs. - Observables and PVT now are separated. PVT and their associated libraries are moved to ./src/algorithms/PVT - Temporarily disabled the RINEX output (I am working on that!) - GNSS-SDR screen output now gives extended debug information of the receiver status and events. In the future, this output will be redirected to a log file. - Bug fixes: - FILE_SIGNAL_SOURCE now works correctly when the user configures GNSS-SDR to process the entire file. - GPS_L1_CA_DLL_PLL now computes correctly the PRN start values. - GPS_L1_CA_DLL_FLL_PLL now computes correctly the PRN start values. - Several modifications in GPS_L1_CA_Telemetry_Decoder, GPS_L1_CA_Observables, and GPS_L1_CA_PVT modules to fix the GPS position computation. - New features - Tracking blocks perform a signal integrity check against NaN outliers before the correlation process. - Tracking and PVT binary dump options are now documented and we provide MATLAB libraries and sample files to read it. Available in ./utils/matlab" and "./utils/matlab/libs" - Observables output rate can be configured. This option enables the GPS L1 CA PVT computation at a maximum rate of 1ms. - GPS_L1_CA_PVT now can perform a moving average Latitude, Longitude, and Altitude output for each of the Observables output. It is configurable using the configuration file. - Added Google Earth compatible Keyhole Markup Language (KML) output writer class (./src/algorithms/PVT/libs/kml_printer.h and ./src/algorithms/PVT/libs/kml_printer.cc ). You can see the receiver position directly using Google Earth. - We provide a master configuration file which includes an in-line documentation with all the new (and old) options. It can be found in ./conf/master.conf git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@84 64b25241-fba3-4117-9849-534c7e92360d
2011-12-07 17:59:34 +00:00
else if (implementation.compare("GPS_L1_CA_PVT") == 0)
{
block = new GpsL1CaPvt(configuration, role, in_streams,
out_streams, queue);
}
// OUTPUT FILTERS --------------------------------------------------------------
else if (implementation.compare("Null_Sink_Output_Filter") == 0)
{
block = new NullSinkOutputFilter(configuration, role, in_streams,
out_streams);
}
else if (implementation.compare("File_Output_Filter") == 0)
{
block = new FileOutputFilter(configuration, role, in_streams,
out_streams);
}
else
{
// Log fatal. This causes execution to stop.
LOG_AT_LEVEL(ERROR) << implementation
<< ": Undefined implementation for block";
}
return block;
}