From 23fa911dd5f35a094ce1c4609da78defe3bcfae7 Mon Sep 17 00:00:00 2001 From: lmne Date: Sun, 29 Oct 2017 02:51:22 -0300 Subject: [PATCH 1/4] Add support to fmcomms2 SDR hardware --- README.md | 48 +++++ conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf | 145 ++++++++++++++ conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf | 89 +++++++++ .../signal_source/adapters/CMakeLists.txt | 28 +++ .../adapters/fmcomms2_signal_source.cc | 178 ++++++++++++++++++ .../adapters/fmcomms2_signal_source.h | 115 +++++++++++ .../adapters/plutosdr_signal_source.cc | 138 ++++++++++++++ .../adapters/plutosdr_signal_source.h | 81 ++++++++ src/core/receiver/CMakeLists.txt | 10 + src/core/receiver/gnss_block_factory.cc | 26 +++ 10 files changed, 858 insertions(+) create mode 100644 conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf create mode 100644 conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf create mode 100644 src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/fmcomms2_signal_source.h create mode 100644 src/algorithms/signal_source/adapters/plutosdr_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/plutosdr_signal_source.h diff --git a/README.md b/README.md index 9a14d8343..f15352cb1 100644 --- a/README.md +++ b/README.md @@ -368,7 +368,55 @@ $ sudo make install (in order to disable the `Osmosdr_Signal_Source` compilation, you can pass `DENABLE_OSMOSDR=OFF` to cmake and build GNSS-SDR again). +###### Build FMCOMMS2 based SDR Hardware support (OPTIONAL): +Install [libiio] (https://github.com/analogdevicesinc/libiio.git +), [libad9361] (clone https://github.com/analogdevicesinc/libad9361-iio.git) and [gr-iio] (clone https://github.com/analogdevicesinc/gr-iio.git) gnuradio block (based on https://www.plutosdr.com/viewtopic.php?t=5): + +~~~~~~ +$ git clone https://github.com/analogdevicesinc/libiio.git +$ cd libiio +$ mkdir build +$ cd build +$ cmake .. +$ make +$ sudo make install +$ sudo ldconfig +$ git clone https://github.com/analogdevicesinc/libad9361-iio.git +$ cd libad9361-iio +$ mkdir build +$ cd build +$ cmake .. +$ make +$ sudo make install +$ sudo ldconfig +$ git clone https://github.com/analogdevicesinc/gr-iio.git +$ cd gr-iio +$ mv include/gnuradio/iio include/iio +$ rm -r include/gnuradio +$ sed -i 's/gnuradio\/iio/iio/g' CMakeLists.txt +$ sed -i 's/gnuradio\/iio/iio/g' swig/* +$ sed -i 's/gnuradio\/iio/iio/g' include/iio/* +$ sed -i 's/gnuradio\/iio/iio/g' lib/* +$ sed -i 's/gnuradio\/iio/iio/g' python/iio/* +$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_pluto_sink.xml +$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_pluto_source.xml +$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_fmcomms2_sink.xml +$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_fmcomms2_source.xml +$ mkdir build +$ cd build +$ cmake .. +$ make +$ sudo make install +$ sudo ldconfig +~~~~~~ + +Then configure the gnss-sdr to build the `Fmcomms2_Signal_Source`: +~~~~~~ +$ cmake -DENABLE_FMCOMMS2=ON ../ +$ make +$ sudo make install +~~~~~~ ###### Build OpenCL support (OPTIONAL): diff --git a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf new file mode 100644 index 000000000..aecfad5cd --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -0,0 +1,145 @@ +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ +GNSS-SDR.internal_fs_hz=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check http://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNS=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fmcomms2_Signal_Source +;SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat +SignalSource.item_type=gr_complex +SignalSource.device_address=10.42.0.196 +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=2000000 +SignalSource.decimation=0 +SignalSource.rx1_enable=true +SignalSource.gain_mode_rx1=manual +SignalSource.rf_port_select=A_BALANCED +SignalSource.gain_rx1=64 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=2000000 +InputFilter.IF=0; IF deviation due to front-end LO inaccuracies [Hz] + +;######### RESAMPLER CONFIG ############ +;## Resamples the input data. +;# DISABLED IN THE RTL-SDR REALTIME +;#implementation: Use [Pass_Through] or [Direct_Resampler] +;#[Pass_Through] disables this block +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat +Acquisition_1C.item_type=gr_complex +Acquisition_1C.if=0 +Acquisition_1C.sampled_ms=1 +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.if=0 +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false +TelemetryDecoder_1C.decimation_factor=1; + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=GPS_L1_CA_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation algorithm: Use [GPS_L1_CA_PVT] in this version. +PVT.implementation=GPS_L1_CA_PVT + +;#averaging_depth: Number of PVT observations in the moving average algorithm +PVT.averaging_depth=10 + +;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false] +PVT.flag_averaging=true +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf new file mode 100644 index 000000000..5c6f4fdd6 --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf @@ -0,0 +1,89 @@ +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ +GNSS-SDR.internal_fs_hz=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check http://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNS=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Plutosdr_Signal_Source +;SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.2.1 +SignalSource.sampling_frequency=3000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=2600000 +SignalSource.decimation=0 +SignalSource.gain_mode=manual +SignalSource.gain=30 +SignalSource.samples=0 +SignalSource.buffer_size=65000 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./capture.dat +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.008 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=GPS_L1_CA_Observables + +;######### PVT CONFIG ############ +PVT.implementation=GPS_L1_CA_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 388b2ed59..2cc169ed9 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -21,6 +21,34 @@ list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS) # Optional drivers +if(ENABLE_PLUTOSDR) + ############################################## + # ADALM-PLUTO (Analog Devices Inc.) + ############################################## + find_package(iio REQUIRED) + if(NOT IIO_FOUND) + message("gnuradio-iio not found, installation is required") + message(FATAL_ERROR "gnuradio-iio 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}) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) +endif(ENABLE_PLUTOSDR) + +if(ENABLE_FMCOMMS2) + ############################################### + # FMCOMMS2 based SDR Hardware + ############################################### + find_package(iio REQUIRED) + if(NOT IIO_FOUND) + message("gnuradio-iio not found, installation is required") + message(FATAL_ERROR "gnuradio-iio 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}) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc plutosdr_signal_source.cc) +endif(ENABLE_FMCOMMS2) + if(ENABLE_GN3S) ############################################## # GN3S (USB dongle) diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc new file mode 100644 index 000000000..a77215327 --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -0,0 +1,178 @@ +/*! + * \filei fmcomms2_signal_source.cc + * \brief signal source for sdr hardware from analog devices based on + * fmcomms2 evaluation board. + * \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2015 (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 . + * + * ------------------------------------------------------------------------- + */ + +#include "fmcomms2_signal_source.h" +#include +#include +#include +#include +#include +#include "configuration_interface.h" +#include "gnss_sdr_valve.h" +#include "GPS_L1_CA.h" + +using google::LogMessage; + +Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, + std::string role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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"; + uri_= configuration->property(role+".device_address",std::string("192.168.2.1")); + freq_= configuration->property(role+".freq",GPS_L1_FREQ_HZ); + sample_rate_=configuration->property(role+".sampling_frequency",2600000); + bandwidth_= configuration->property(role+".bandwidth",2000000); + rx1_en_=configuration->property(role+".rx1_enable",true); + rx2_en_=configuration->property(role+".rx2_enable",false); + buffer_size_=configuration->property(role+".buffer_size",0xA0000); + decimation_=configuration->property(role+".decimation",1); + quadrature_=configuration->property(role+".quadrature",true); + rf_dc_=configuration->property(role+".rf_dc",true); + bb_dc_=configuration->property(role+".bb_dc",true); + gain_mode_rx1_=configuration->property(role+".gain_mode_rx1",std::string("manual")); + gain_mode_rx2_=configuration->property(role+".gain_mode_rx2",std::string("manual")); + rf_gain_rx1_=configuration->property(role+".gain_rx1",64.0); + rf_gain_rx2_=configuration->property(role+".gain_rx2",64.0); + rf_port_select_=configuration->property(role+".rf_port_select",std::string("A_BALANCED")); + filter_file_=configuration->property(role+".filter_file",std::string("")); + filter_auto_=configuration->property(role+".filter_auto",true); + item_type_=configuration->property(role+".item_type",default_item_type); + samples_=configuration->property(role+".samples",0); + dump_=configuration->property(role+".dump",false); + dump_filename_=configuration->property(role+".dump_filename",default_dump_file); + + item_size_=sizeof(gr_complex); + + std::cout<<"device address: "<unique_id() << ")"; + } + + if (dump_) + { + DLOG(INFO) << "Dumping output into file " << dump_filename_; + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); + DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; + } +} + +Fmcomms2SignalSource::~Fmcomms2SignalSource() +{ +} + +void Fmcomms2SignalSource::connect(gr::top_block_sptr top_block) +{ + if (samples_ != 0) + { + top_block->connect(fmcomms2_source_f32c_, 0, valve_, 0); + DLOG(INFO) << "connected fmcomms2 source to valve"; + if (dump_) + { + top_block->connect(valve_, 0, file_sink_, 0); + DLOG(INFO) << "connected valve to file sink"; + } + } + else + { + if (dump_) + { + + top_block->connect(fmcomms2_source_f32c_ , 0, file_sink_, 0); + DLOG(INFO) << "connected fmcomms2 source to file sink"; + } + } +} + + +void Fmcomms2SignalSource::disconnect(gr::top_block_sptr top_block) +{ + if (samples_ != 0) + { + top_block->disconnect(fmcomms2_source_f32c_, 0, valve_, 0); + if (dump_) + { + top_block->disconnect(valve_, 0, file_sink_, 0); + } + } + else + { + if (dump_) + { + top_block->disconnect(fmcomms2_source_f32c_, 0, file_sink_, 0); + } + } +} + + +gr::basic_block_sptr Fmcomms2SignalSource::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return gr::basic_block_sptr(); +} + + +gr::basic_block_sptr Fmcomms2SignalSource::get_right_block() +{ + if (samples_ != 0) + { + return valve_; + } + else + { + return (fmcomms2_source_f32c_); + } +} diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h new file mode 100644 index 000000000..c9b690cdd --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -0,0 +1,115 @@ +/*! + * \file fmcomms2_signal_source.h + * \brief Interface to use SDR hardware based in FMCOMMS2 driver from analog + * devices, for example FMCOMMS4 and ADALM-PLUTO (PlutoSdr) + * \author Rodrigo Muñoz, 2017. rmunozl(at)inacap.cl + * + * This class represent a fmcomms2 signal source. It use the gr_iio block + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2015 (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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_ +#define GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_ + +#include +#include +#include +#include +#include +#include "gnss_block_interface.h" + +class ConfigurationInterface; + +class Fmcomms2SignalSource: public GNSSBlockInterface +{ +public: + Fmcomms2SignalSource(ConfigurationInterface* configuration, + std::string role, unsigned int in_stream, + unsigned int out_stream, boost::shared_ptr queue); + + virtual ~Fmcomms2SignalSource(); + + std::string role() + { + return role_; + } + + /*! + * \brief Returns "fmcomms2_Signal_Source" + */ + std::string implementation() + { + return "Fmcomms2_Signal_Source"; + } + size_t item_size() + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); + +private: + std::string role_; + + // Front-end settings + std::string uri_;//device direction + unsigned long freq_; //frequency of local oscilator + unsigned long sample_rate_; + unsigned long bandwidth_; + unsigned long buffer_size_; //reception buffer + unsigned int decimation_; + bool rx1_en_; + bool rx2_en_; + bool quadrature_; + bool rf_dc_; + bool bb_dc_; + std::string gain_mode_rx1_; + std::string gain_mode_rx2_; + double rf_gain_rx1_; + double rf_gain_rx2_; + std::string rf_port_select_; + std::string filter_file_; + bool filter_auto_; + + unsigned int in_stream_; + unsigned int out_stream_; + + std::string item_type_; + size_t item_size_; + long samples_; + bool dump_; + std::string dump_filename_; + + gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_; + + boost::shared_ptr valve_; + gr::blocks::file_sink::sptr file_sink_; + boost::shared_ptr queue_; +}; + +#endif /*GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc new file mode 100644 index 000000000..45e0f3deb --- /dev/null +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -0,0 +1,138 @@ +#include "plutosdr_signal_source.h" +#include +#include +#include +#include +#include "configuration_interface.h" +#include "gnss_sdr_valve.h" +#include "GPS_L1_CA.h" + + +using google::LogMessage; + + +PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, + std::string role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr 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"; + uri_ = configuration->property(role+".device_address",std::string("192.168.2.1")); + freq_= configuration->property(role+".freq",GPS_L1_FREQ_HZ); + sample_rate_=configuration->property(role+".sampling_frequency",3000000); + bandwidth_ = configuration->property(role+".bandwidth",2000000); + buffer_size_=configuration->property(role+".buffer_size",0xA0000); + decimation_=configuration->property(role+".decimation",1); + quadrature_=configuration->property(role+".quadrature",true); + rf_dc_ =configuration->property(role+".rf_dc",true); + bb_dc_ =configuration->property(role+".bb_dc",true); + gain_mode_=configuration->property(role+".gain_mode",std::string("manual")); + rf_gain_=configuration->property(role+".gain",50.0); + filter_file_=configuration->property(role+".filter_file",std::string("")); + filter_auto_=configuration->property(role+".filter_auto",true); + + item_type_=configuration->property(role+".item_type",default_item_type); + samples_=configuration->property(role+".samples",0); + dump_=configuration->property(role+".dump",false); + dump_filename_=configuration->property(role+".dump_filename",default_dump_file); + + if(item_type_.compare("gr_complex") != 0) + { + std::cout<<"bad item_type!!"<unique_id() << ")"; + } + + if (dump_) + { + DLOG(INFO) << "Dumping output into file " << dump_filename_; + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); + DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; + } +} + +PlutosdrSignalSource::~PlutosdrSignalSource() +{} + +void PlutosdrSignalSource::connect(gr::top_block_sptr top_block) +{ + if (samples_ != 0) + { + top_block->connect(plutosdr_source_, 0, valve_, 0); + DLOG(INFO) << "connected plutosdr source to valve"; + if (dump_) + { + top_block->connect(valve_, 0, file_sink_, 0); + DLOG(INFO) << "connected valve to file sink"; + } + } + else + { + if (dump_) + { + top_block->connect(plutosdr_source_, 0, file_sink_, 0); + DLOG(INFO) << "connected plutosdr source to file sink"; + } + } +} + + +void PlutosdrSignalSource::disconnect(gr::top_block_sptr top_block) +{ + if (samples_ != 0) + { + top_block->disconnect(plutosdr_source_, 0, valve_, 0); + if (dump_) + { + top_block->disconnect(valve_, 0, file_sink_, 0); + } + } + else + { + if (dump_) + { + top_block->disconnect(plutosdr_source_, 0, file_sink_, 0); + } + } +} + + +gr::basic_block_sptr PlutosdrSignalSource::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return gr::basic_block_sptr(); +} + + +gr::basic_block_sptr PlutosdrSignalSource::get_right_block() +{ + if (samples_ != 0) + { + return valve_; + } + else + { + return plutosdr_source_; + } +} diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h new file mode 100644 index 000000000..eadee361d --- /dev/null +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -0,0 +1,81 @@ + +#ifndef GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_ +#define GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_ + +#include +#include +#include +#include +#include +#include "gnss_block_interface.h" + +class ConfigurationInterface; + +/*! + */ +class PlutosdrSignalSource: public GNSSBlockInterface +{ +public: + PlutosdrSignalSource(ConfigurationInterface* configuration, + std::string role, unsigned int in_stream, + unsigned int out_stream, boost::shared_ptr queue); + + virtual ~PlutosdrSignalSource(); + + std::string role() + { + return role_; + } + + /*! + * \brief Returns "Plutosdr_Signal_Source" + */ + std::string implementation() + { + return "Plutosdr_Signal_Source"; + } + size_t item_size() + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block); + void disconnect(gr::top_block_sptr top_block); + gr::basic_block_sptr get_left_block(); + gr::basic_block_sptr get_right_block(); + +private: + std::string role_; + + // Front-end settings + std::string uri_;//device direction + unsigned long freq_; //frequency of local oscilator + unsigned long sample_rate_; + unsigned long bandwidth_; + unsigned long buffer_size_; //reception buffer + unsigned int decimation_; + bool quadrature_; + bool rf_dc_; + bool bb_dc_; + std::string gain_mode_; + double rf_gain_; + std::string filter_file_; + bool filter_auto_; + + unsigned int in_stream_; + unsigned int out_stream_; + + std::string item_type_; + size_t item_size_; + long samples_; + bool dump_; + std::string dump_filename_; + + gr::iio::pluto_source::sptr plutosdr_source_; + + boost::shared_ptr valve_; + gr::blocks::file_sink::sptr file_sink_; + boost::shared_ptr queue_; +}; + +#endif /*GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_*/ diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 7c3992785..ae6908495 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -124,6 +124,16 @@ else(OPENCL_FOUND) add_definitions(-DOPENCL_BLOCKS=0) endif(OPENCL_FOUND) +#enable SDR Hardware based on fmcomms2 +if(ENABLE_PLUTOSDR) + add_definitions(-DPLUTOSDR_DRIVER=1) +endif(ENABLE_PLUTOSDR) + +if(ENABLE_FMCOMMS2) + add_definitions(-DFMCOMMS2_DRIVER=1) + add_definitions(-DPLUTOSDR_DRIVER=1) +endif(ENABLE_FMCOMMS2) + add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}") file(GLOB GNSS_RECEIVER_HEADERS "*.h") diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 4daad0c79..6ec273785 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -119,6 +119,14 @@ #include "uhd_signal_source.h" #endif +#if PLUTOSDR_DRIVER +#include "plutosdr_signal_source.h" +#endif + +#if FMCOMMS2_DRIVER +#include "fmcomms2_signal_source.h" +#endif + #if FLEXIBAND_DRIVER #include "flexiband_signal_source.h" #endif @@ -811,6 +819,24 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif +#if PLUTOSDR_DRIVER + else if (implementation.compare("Plutosdr_Signal_Source") == 0) + { + std::unique_ptr block_(new PlutosdrSignalSource(configuration.get(), role, in_streams, + out_streams, queue)); + block = std::move(block_); + } +#endif + +#if FMCOMMS2_DRIVER + else if (implementation.compare("Fmcomms2_Signal_Source") == 0) + { + std::unique_ptr block_(new Fmcomms2SignalSource(configuration.get(), role, in_streams, + out_streams, queue)); + block = std::move(block_); + } +#endif + #if FLEXIBAND_DRIVER else if (implementation.compare("Flexiband_Signal_Source") == 0) { From de7bdac26f31b2f0ec102f6ee51317413921637a Mon Sep 17 00:00:00 2001 From: lmne Date: Sun, 29 Oct 2017 03:01:12 -0300 Subject: [PATCH 2/4] Fixed links in README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index f15352cb1..a3d81f8af 100644 --- a/README.md +++ b/README.md @@ -370,8 +370,7 @@ $ sudo make install ###### Build FMCOMMS2 based SDR Hardware support (OPTIONAL): -Install [libiio] (https://github.com/analogdevicesinc/libiio.git -), [libad9361] (clone https://github.com/analogdevicesinc/libad9361-iio.git) and [gr-iio] (clone https://github.com/analogdevicesinc/gr-iio.git) gnuradio block (based on https://www.plutosdr.com/viewtopic.php?t=5): +Install [libiio](https://github.com/analogdevicesinc/libiio.git), [libad9361](https://github.com/analogdevicesinc/libad9361-iio.git) and [gr-iio](https://github.com/analogdevicesinc/gr-iio.git) gnuradio block (instructions based on https://www.plutosdr.com/viewtopic.php?t=5): ~~~~~~ $ git clone https://github.com/analogdevicesinc/libiio.git From 31b4228d8b45889b9013557bd3db13fa4313854a Mon Sep 17 00:00:00 2001 From: rmunozl Date: Mon, 30 Oct 2017 15:17:53 +0000 Subject: [PATCH 3/4] add better explanation in README.md and improve format of some files --- README.md | 15 ++++++++++++--- .../signal_source/adapters/CMakeLists.txt | 18 ++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a3d81f8af..4c938a0ad 100644 --- a/README.md +++ b/README.md @@ -370,7 +370,7 @@ $ sudo make install ###### Build FMCOMMS2 based SDR Hardware support (OPTIONAL): -Install [libiio](https://github.com/analogdevicesinc/libiio.git), [libad9361](https://github.com/analogdevicesinc/libad9361-iio.git) and [gr-iio](https://github.com/analogdevicesinc/gr-iio.git) gnuradio block (instructions based on https://www.plutosdr.com/viewtopic.php?t=5): +Install the [libiio](https://github.com/analogdevicesinc/libiio.git) (>=v0.11), [libad9361](https://github.com/analogdevicesinc/libad9361-iio.git) (>=v0.1-1) libraries and [gr-iio](https://github.com/analogdevicesinc/gr-iio.git) (>=v0.2) gnuradio block. For example in Ubuntu 16.04 follow these instructions (based on https://github.com/blurbdust/blurbdust.github.io): ~~~~~~ $ git clone https://github.com/analogdevicesinc/libiio.git @@ -410,13 +410,22 @@ $ sudo make install $ sudo ldconfig ~~~~~~ -Then configure the gnss-sdr to build the `Fmcomms2_Signal_Source`: +Then configure the gnss-sdr to build the `Fmcomms2_Signal_Source` and `Plutosdr_Signal_Source`: ~~~~~~ $ cmake -DENABLE_FMCOMMS2=ON ../ -$ make +$ make $ sudo make install ~~~~~~ +or configure only `Plutosdr_Signal_Source`: +~~~~~~ +$ cmake -DENABLE_PLUTOSDR=ON ../ +$ make +$ sudo make install +~~~~~~ + +With `Fmcomms2_Signal_Source` you can use any SDR hardware based on fmcomms2, including the ADALM-PLUTO (PlutoSdr) by configuring correctly the .conf file. The `Plutosdr_Signal_Source` offers a simplier manner to use the ADALM-PLUTO because implements only a subset of fmcomms2's parameters valid for it device. + ###### Build OpenCL support (OPTIONAL): In order to enable the building of blocks that use OpenCL, type: diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 2cc169ed9..009f56433 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -29,10 +29,11 @@ if(ENABLE_PLUTOSDR) if(NOT IIO_FOUND) message("gnuradio-iio not found, installation is required") message(FATAL_ERROR "gnuradio-iio 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}) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) + else(NOT IIO_FOUND) + set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES}) + set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) + endif(NOT IIO_FOUND) endif(ENABLE_PLUTOSDR) if(ENABLE_FMCOMMS2) @@ -43,10 +44,11 @@ if(ENABLE_FMCOMMS2) if(NOT IIO_FOUND) message("gnuradio-iio not found, installation is required") message(FATAL_ERROR "gnuradio-iio 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}) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc plutosdr_signal_source.cc) + else(NOT IIO_FOUND) + set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES}) + set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc plutosdr_signal_source.cc) + endif(NOT IIO_FOUND) endif(ENABLE_FMCOMMS2) if(ENABLE_GN3S) From cc3ed4c672d98e88c5bcd50ecb03395709f63039 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 30 Oct 2017 22:31:20 +0100 Subject: [PATCH 4/4] Apply project's coding style --- CMakeLists.txt | 2 + README.md | 2 +- conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf | 20 ++- conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf | 26 +++- .../adapters/fmcomms2_signal_source.cc | 129 +++++++++--------- .../adapters/fmcomms2_signal_source.h | 55 ++++---- .../adapters/plutosdr_signal_source.cc | 125 ++++++++++------- .../adapters/plutosdr_signal_source.h | 72 +++++++--- 8 files changed, 252 insertions(+), 179 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbf6b9805..30d4f6eaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,8 @@ option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF) option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) +option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF) +option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware" OFF) # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) diff --git a/README.md b/README.md index 77403cf92..6935a4067 100644 --- a/README.md +++ b/README.md @@ -424,7 +424,7 @@ $ make $ sudo make install ~~~~~~ -With `Fmcomms2_Signal_Source` you can use any SDR hardware based on fmcomms2, including the ADALM-PLUTO (PlutoSdr) by configuring correctly the .conf file. The `Plutosdr_Signal_Source` offers a simplier manner to use the ADALM-PLUTO because implements only a subset of fmcomms2's parameters valid for it device. +With `Fmcomms2_Signal_Source` you can use any SDR hardware based on fmcomms2, including the ADALM-PLUTO (PlutoSdr) by configuring correctly the .conf file. The `Plutosdr_Signal_Source` offers a simplier manner to use the ADALM-PLUTO because implements only a subset of fmcomms2's parameters valid for those devices. ###### Build OpenCL support (OPTIONAL): diff --git a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf index aecfad5cd..ae832f901 100644 --- a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -5,10 +5,10 @@ [GNSS-SDR] ;######### GLOBAL OPTIONS ################## -;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. ;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE ; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ -GNSS-SDR.internal_fs_hz=2000000 +GNSS-SDR.internal_fs_sps=2000000 ;######### SUPL RRLP GPS assistance configuration ##### @@ -119,27 +119,23 @@ TelemetryDecoder_1C.dump=false TelemetryDecoder_1C.decimation_factor=1; ;######### OBSERVABLES CONFIG ############ -Observables.implementation=GPS_L1_CA_Observables +Observables.implementation=Hybrid_Observables Observables.dump=false Observables.dump_filename=./observables.dat ;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation algorithm: Use [GPS_L1_CA_PVT] in this version. -PVT.implementation=GPS_L1_CA_PVT - -;#averaging_depth: Number of PVT observations in the moving average algorithm -PVT.averaging_depth=10 - -;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false] -PVT.flag_averaging=true +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad PVT.output_rate_ms=100 PVT.display_rate_ms=500 PVT.dump_filename=./PVT PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; PVT.flag_nmea_tty_port=false; PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf index 5c6f4fdd6..97c9deded 100644 --- a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf @@ -5,10 +5,10 @@ [GNSS-SDR] ;######### GLOBAL OPTIONS ################## -;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps]. ;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE ; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ -GNSS-SDR.internal_fs_hz=2000000 +GNSS-SDR.internal_fs_sps=2000000 ;######### SUPL RRLP GPS assistance configuration ##### @@ -79,11 +79,23 @@ Tracking_1C.dll_bw_hz=4.0; TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder ;######### OBSERVABLES CONFIG ############ -Observables.implementation=GPS_L1_CA_Observables +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + ;######### PVT CONFIG ############ -PVT.implementation=GPS_L1_CA_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index a77215327..26640d840 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -6,7 +6,7 @@ * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -44,93 +44,94 @@ using google::LogMessage; Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : - role_(role), in_stream_(in_stream), out_stream_(out_stream), - 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"; - uri_= configuration->property(role+".device_address",std::string("192.168.2.1")); - freq_= configuration->property(role+".freq",GPS_L1_FREQ_HZ); - sample_rate_=configuration->property(role+".sampling_frequency",2600000); - bandwidth_= configuration->property(role+".bandwidth",2000000); - rx1_en_=configuration->property(role+".rx1_enable",true); - rx2_en_=configuration->property(role+".rx2_enable",false); - buffer_size_=configuration->property(role+".buffer_size",0xA0000); - decimation_=configuration->property(role+".decimation",1); - quadrature_=configuration->property(role+".quadrature",true); - rf_dc_=configuration->property(role+".rf_dc",true); - bb_dc_=configuration->property(role+".bb_dc",true); - gain_mode_rx1_=configuration->property(role+".gain_mode_rx1",std::string("manual")); - gain_mode_rx2_=configuration->property(role+".gain_mode_rx2",std::string("manual")); - rf_gain_rx1_=configuration->property(role+".gain_rx1",64.0); - rf_gain_rx2_=configuration->property(role+".gain_rx2",64.0); - rf_port_select_=configuration->property(role+".rf_port_select",std::string("A_BALANCED")); - filter_file_=configuration->property(role+".filter_file",std::string("")); - filter_auto_=configuration->property(role+".filter_auto",true); - item_type_=configuration->property(role+".item_type",default_item_type); - samples_=configuration->property(role+".samples",0); - dump_=configuration->property(role+".dump",false); - dump_filename_=configuration->property(role+".dump_filename",default_dump_file); - - item_size_=sizeof(gr_complex); + std::string default_item_type = "gr_complex"; + std::string default_dump_file = "./data/signal_source.dat"; + uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1")); + freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ); + sample_rate_ = configuration->property(role + ".sampling_frequency", 2600000); + bandwidth_ = configuration->property(role + ".bandwidth", 2000000); + rx1_en_ = configuration->property(role + ".rx1_enable", true); + rx2_en_ = configuration->property(role + ".rx2_enable", false); + buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000); + decimation_ = configuration->property(role + ".decimation", 1); + quadrature_ = configuration->property(role + ".quadrature", true); + rf_dc_ = configuration->property(role + ".rf_dc", true); + bb_dc_ = configuration->property(role + ".bb_dc", true); + gain_mode_rx1_ = configuration->property(role + ".gain_mode_rx1", std::string("manual")); + gain_mode_rx2_ = configuration->property(role + ".gain_mode_rx2", std::string("manual")); + rf_gain_rx1_ = configuration->property(role + ".gain_rx1", 64.0); + rf_gain_rx2_ = configuration->property(role + ".gain_rx2", 64.0); + rf_port_select_ = configuration->property(role + ".rf_port_select", std::string("A_BALANCED")); + filter_file_ = configuration->property(role + ".filter_file", std::string("")); + filter_auto_ = configuration->property(role + ".filter_auto", true); + item_type_ = configuration->property(role + ".item_type", default_item_type); + samples_ = configuration->property(role + ".samples", 0); + dump_ = configuration->property(role + ".dump", false); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - std::cout<<"device address: "<unique_id() << ")"; - } + if(item_type_.compare("gr_complex")==0) + { + fmcomms2_source_f32c_ = gr::iio::fmcomms2_source_f32c::make( + uri_.c_str(), freq_, sample_rate_, + decimation_, bandwidth_, + rx1_en_, rx2_en_, + buffer_size_, quadrature_, rf_dc_, + bb_dc_, gain_mode_rx1_.c_str(), rf_gain_rx1_, + gain_mode_rx2_.c_str(), rf_gain_rx2_, + rf_port_select_.c_str(), filter_file_.c_str(), + filter_auto_); + } + else + { + LOG(FATAL) << "Exception: item type " << item_type_ << " not suported!"; + } + + if (samples_ != 0) + { + DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; + } if (dump_) - { - DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); - DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; - } + { + DLOG(INFO) << "Dumping output into file " << dump_filename_; + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); + DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; + } } + Fmcomms2SignalSource::~Fmcomms2SignalSource() -{ -} +{} + void Fmcomms2SignalSource::connect(gr::top_block_sptr top_block) { if (samples_ != 0) { - top_block->connect(fmcomms2_source_f32c_, 0, valve_, 0); + top_block->connect(fmcomms2_source_f32c_, 0, valve_, 0); DLOG(INFO) << "connected fmcomms2 source to valve"; if (dump_) { top_block->connect(valve_, 0, file_sink_, 0); DLOG(INFO) << "connected valve to file sink"; } - } + } else { if (dump_) { - + top_block->connect(fmcomms2_source_f32c_ , 0, file_sink_, 0); DLOG(INFO) << "connected fmcomms2 source to file sink"; } diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index c9b690cdd..0672770f5 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -7,7 +7,7 @@ * This class represent a fmcomms2 signal source. It use the gr_iio block * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -51,7 +51,7 @@ public: virtual ~Fmcomms2SignalSource(); - std::string role() + inline std::string role() override { return role_; } @@ -59,42 +59,43 @@ public: /*! * \brief Returns "fmcomms2_Signal_Source" */ - std::string implementation() + inline std::string implementation() override { return "Fmcomms2_Signal_Source"; } - size_t item_size() + + inline size_t item_size() override { return item_size_; } - void connect(gr::top_block_sptr top_block); - void disconnect(gr::top_block_sptr top_block); - gr::basic_block_sptr get_left_block(); - gr::basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; private: std::string role_; // Front-end settings - std::string uri_;//device direction - unsigned long freq_; //frequency of local oscilator - unsigned long sample_rate_; - unsigned long bandwidth_; - unsigned long buffer_size_; //reception buffer - unsigned int decimation_; - bool rx1_en_; - bool rx2_en_; - bool quadrature_; - bool rf_dc_; - bool bb_dc_; - std::string gain_mode_rx1_; - std::string gain_mode_rx2_; - double rf_gain_rx1_; - double rf_gain_rx2_; - std::string rf_port_select_; - std::string filter_file_; - bool filter_auto_; + std::string uri_;//device direction + unsigned long freq_; //frequency of local oscilator + unsigned long sample_rate_; + unsigned long bandwidth_; + unsigned long buffer_size_; //reception buffer + unsigned int decimation_; + bool rx1_en_; + bool rx2_en_; + bool quadrature_; + bool rf_dc_; + bool bb_dc_; + std::string gain_mode_rx1_; + std::string gain_mode_rx2_; + double rf_gain_rx1_; + double rf_gain_rx2_; + std::string rf_port_select_; + std::string filter_file_; + bool filter_auto_; unsigned int in_stream_; unsigned int out_stream_; @@ -105,7 +106,7 @@ private: bool dump_; std::string dump_filename_; - gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_; + gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_; boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index 45e0f3deb..64d59a113 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -1,3 +1,33 @@ +/*! + * \file plutosdr_signal_source.cc + * \brief Signal source for PlutoSDR + * \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (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 . + * + * ------------------------------------------------------------------------- + */ + #include "plutosdr_signal_source.h" #include #include @@ -14,67 +44,68 @@ using google::LogMessage; PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, unsigned int out_stream, boost::shared_ptr queue) : - role_(role), in_stream_(in_stream), out_stream_(out_stream), - 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"; - uri_ = configuration->property(role+".device_address",std::string("192.168.2.1")); - freq_= configuration->property(role+".freq",GPS_L1_FREQ_HZ); - sample_rate_=configuration->property(role+".sampling_frequency",3000000); - bandwidth_ = configuration->property(role+".bandwidth",2000000); - buffer_size_=configuration->property(role+".buffer_size",0xA0000); - decimation_=configuration->property(role+".decimation",1); - quadrature_=configuration->property(role+".quadrature",true); - rf_dc_ =configuration->property(role+".rf_dc",true); - bb_dc_ =configuration->property(role+".bb_dc",true); - gain_mode_=configuration->property(role+".gain_mode",std::string("manual")); - rf_gain_=configuration->property(role+".gain",50.0); - filter_file_=configuration->property(role+".filter_file",std::string("")); - filter_auto_=configuration->property(role+".filter_auto",true); + std::string default_item_type = "gr_complex"; + std::string default_dump_file = "./data/signal_source.dat"; + uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1")); + freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ); + sample_rate_ configuration->property(role + ".sampling_frequency", 3000000); + bandwidth_ = configuration->property(role + ".bandwidth", 2000000); + buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000); + decimation_ = configuration->property(role + ".decimation", 1); + quadrature_ = configuration->property(role + ".quadrature", true); + rf_dc_ = configuration->property(role + ".rf_dc", true); + bb_dc_ = configuration->property(role + ".bb_dc", true); + gain_mode_ = configuration->property(role + ".gain_mode", std::string("manual")); + rf_gain_ = configuration->property(role + ".gain", 50.0); + filter_file_ = configuration->property(role + ".filter_file", std::string("")); + filter_auto_ = configuration->property(role + ".filter_auto", true); - item_type_=configuration->property(role+".item_type",default_item_type); - samples_=configuration->property(role+".samples",0); - dump_=configuration->property(role+".dump",false); - dump_filename_=configuration->property(role+".dump_filename",default_dump_file); - - if(item_type_.compare("gr_complex") != 0) - { - std::cout<<"bad item_type!!"<property(role + ".item_type", default_item_type); + samples_ = configuration->property(role + ".samples", 0); + dump_ = configuration->property(role + ".dump", false); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + if(item_type_.compare("gr_complex") != 0) + { + std::cout << "bad item_type!!" << std::endl; + LOG(FATAL) << "Exception: item type must be gr_complex!"; + } - std::cout<<"device address: "<unique_id() << ")"; - } + plutosdr_source_ = gr::iio::pluto_source::make(uri_, freq_, sample_rate_, + decimation_, bandwidth_, buffer_size_, quadrature_, rf_dc_, bb_dc_, + gain_mode_.c_str(), rf_gain_,filter_file_.c_str(), filter_auto_); + + if (samples_ != 0) + { + DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; + valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_); + DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; + } if (dump_) - { - DLOG(INFO) << "Dumping output into file " << dump_filename_; - file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); - DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; + { + DLOG(INFO) << "Dumping output into file " << dump_filename_; + file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); + DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } } + PlutosdrSignalSource::~PlutosdrSignalSource() {} + void PlutosdrSignalSource::connect(gr::top_block_sptr top_block) { if (samples_ != 0) diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index eadee361d..79a310089 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -1,3 +1,33 @@ +/*! + * \file plutosdr_signal_source.h + * \brief Signal source for PlutoSDR + * \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2017 (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 . + * + * ------------------------------------------------------------------------- + */ + #ifndef GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_ #define GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_ @@ -22,7 +52,7 @@ public: virtual ~PlutosdrSignalSource(); - std::string role() + std::string role() override { return role_; } @@ -30,37 +60,37 @@ public: /*! * \brief Returns "Plutosdr_Signal_Source" */ - std::string implementation() + std::string implementation() override { return "Plutosdr_Signal_Source"; } - size_t item_size() + size_t item_size() override { return item_size_; } - void connect(gr::top_block_sptr top_block); - void disconnect(gr::top_block_sptr top_block); - gr::basic_block_sptr get_left_block(); - gr::basic_block_sptr get_right_block(); + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; private: std::string role_; // Front-end settings - std::string uri_;//device direction - unsigned long freq_; //frequency of local oscilator - unsigned long sample_rate_; - unsigned long bandwidth_; - unsigned long buffer_size_; //reception buffer - unsigned int decimation_; - bool quadrature_; - bool rf_dc_; - bool bb_dc_; - std::string gain_mode_; - double rf_gain_; - std::string filter_file_; - bool filter_auto_; + std::string uri_; // device direction + unsigned long freq_; // frequency of local oscilator + unsigned long sample_rate_; + unsigned long bandwidth_; + unsigned long buffer_size_; // reception buffer + unsigned int decimation_; + bool quadrature_; + bool rf_dc_; + bool bb_dc_; + std::string gain_mode_; + double rf_gain_; + std::string filter_file_; + bool filter_auto_; unsigned int in_stream_; unsigned int out_stream_; @@ -71,7 +101,7 @@ private: bool dump_; std::string dump_filename_; - gr::iio::pluto_source::sptr plutosdr_source_; + gr::iio::pluto_source::sptr plutosdr_source_; boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_;