From 23fa911dd5f35a094ce1c4609da78defe3bcfae7 Mon Sep 17 00:00:00 2001 From: lmne Date: Sun, 29 Oct 2017 02:51:22 -0300 Subject: [PATCH 01/12] 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 02/12] 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 03/12] 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 f92c910e05aae63cc8950994896eae1d1b9f3d81 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 30 Oct 2017 20:15:12 +0100 Subject: [PATCH 04/12] Detect and document macOS High Sierra Fix old CMAKE flag for Eclipse (from ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT to ECLIPSE_GENERATE_SOURCE_PROJECT) --- CMakeLists.txt | 10 ++++++++-- README.md | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 265e79ec5..cbf6b9805 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,15 +214,21 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${LINUX_DISTRIBUTION} GNU/Linux Release ${LINUX_VER} ${ARCH_}") endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") -# Detect Mac OS X Version +# Detect macOS / Mac OS X Version if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(OperatingSystem "Mac OS X") set(OS_IS_MACOSX TRUE) exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION) string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) + if(${DARWIN_VERSION} MATCHES "17") + set(MACOS_HIGH_SIERRA TRUE) + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") + message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS High Sierra 10.13") + endif(${DARWIN_VERSION} MATCHES "17") if(${DARWIN_VERSION} MATCHES "16") set(MACOS_SIERRA TRUE) - set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14") set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Sierra 10.12") endif(${DARWIN_VERSION} MATCHES "16") diff --git a/README.md b/README.md index 9a14d8343..e11172b02 100644 --- a/README.md +++ b/README.md @@ -291,7 +291,7 @@ GNSS-SDR comes with a library which is a module of the Vector-Optimized Library If you are using Eclipse as your development environment, CMake can create the project for you. Type: ~~~~~~ -$ cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_VERSION=3.7 -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 ../ +$ cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_VERSION=4.5 . ~~~~~~ and then import the created project file into Eclipse: @@ -413,7 +413,7 @@ More details can be found in our tutorial about [GNSS-SDR configuration options --------- -### macOS Sierra, Mac OS X 10.11 (El Capitan), 10.10 (Yosemite) and 10.9 (Mavericks). +### macOS 10.13 (High Sierra) and 10.12 (Sierra), Mac OS X 10.11 (El Capitan), 10.10 (Yosemite) and 10.9 (Mavericks). If you still have not installed [Xcode](http://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type: From cc3ed4c672d98e88c5bcd50ecb03395709f63039 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 30 Oct 2017 22:31:20 +0100 Subject: [PATCH 05/12] 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_; From 16c0d5a2c8b19c3d1318472ab00d84f6e1099aa1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Oct 2017 07:23:43 +0100 Subject: [PATCH 06/12] Small fix --- src/algorithms/libs/rtklib/rtklib_rtksvr.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 0c2aabedf..23d1c188a 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -357,7 +357,7 @@ void decodefile(rtksvr_t *svr, int index) sbsigp_t sbsigp0[MAXNIGP] = {{{0, 0.0}, 0, 0, 0, 0.0 }}; sbsion_t sbsion0[MAXBAND+1] = {{0, 0, {*sbsigp0} }}; dgps_t dgps0[MAXSAT] = { {{0, 0.0}, 0.0, 0.0, 0, 0.0 }}; - ssr_t ssr0[MAXSAT] = {{ {{0, 0.0}}, {0.0}, {0}, 0, 0, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, {0.0}, {0.0}, {0.0}, 0.0, 0.0, '0' }}; + ssr_t ssr0[MAXSAT] = {{ {{0, 0.0}}, {0.0}, {0}, 0, 0, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, {0.0}, {0.0}, {0.0}, 0.0, 0.0, {'0'} }}; lexeph_t lexeph0[MAXSAT] = {{ {0,0.0}, {0,0.0}, 0, 0, 0, {0.0}, {0.0}, {0.0}, {0.0}, 0.0, 0.0, 0.0, {0.0} }}; stec_t stec0[MAXSTA] = {{ {0,0.0}, 0, 0.0, 0.0, {0.0}, 0}}; trop_t trop0[MAXSTA] = {{ {0, 0.0}, {0.0}, {0.0}}}; @@ -365,8 +365,8 @@ void decodefile(rtksvr_t *svr, int index) nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, - {0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0},{0.0}}, {{0.0},{0.0}}, {{0.0},{0.0},{0.0}}, - {0.0}, {0.0}, '0', {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0}, + {0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0},{0.0}}, {{0.0},{0.0}}, {{0.0}, {0.0}, {0.0}}, + {0.0}, {0.0}, {'0'}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0}, {{0,0.0}, 0.0, {0.0}, {{0.0},{0.0}} }, pppcorr0} ; char file[1024]; From 3ad5a99d0ab5413ebdee86f987a1074c27d5d7fb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Oct 2017 07:24:23 +0100 Subject: [PATCH 07/12] Use const iterators instead of iterators --- .../gnuradio_blocks/hybrid_observables_cc.cc | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index 45cc3a3fc..9bc7f7e00 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -179,12 +179,11 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused { channel_history_ok = false; } - } if (channel_history_ok == true) { - std::map::iterator gnss_synchro_map_iter; - std::deque::iterator gnss_synchro_deque_iter; + std::map::const_iterator gnss_synchro_map_iter; + std::deque::const_iterator gnss_synchro_deque_iter; // 1. If the RX time is not set, set the Rx time if (T_rx_s == 0) @@ -196,8 +195,8 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused gnss_synchro_map.insert(std::pair(d_gnss_synchro_history_queue[i].front().Channel_ID, d_gnss_synchro_history_queue[i].front())); } - gnss_synchro_map_iter = min_element(gnss_synchro_map.begin(), - gnss_synchro_map.end(), + gnss_synchro_map_iter = min_element(gnss_synchro_map.cbegin(), + gnss_synchro_map.cend(), Hybrid_pairCompare_gnss_synchro_sample_counter); T_rx_s = static_cast(gnss_synchro_map_iter->second.Tracking_sample_counter) / static_cast(gnss_synchro_map_iter->second.fs); T_rx_s = floor(T_rx_s * 1000.0) / 1000.0; // truncate to ms @@ -210,11 +209,11 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused // shift channels history to match the reference TOW for (unsigned int i = 0; i < d_nchannels; i++) { - gnss_synchro_deque_iter = std::lower_bound(d_gnss_synchro_history_queue[i].begin(), - d_gnss_synchro_history_queue[i].end(), + gnss_synchro_deque_iter = std::lower_bound(d_gnss_synchro_history_queue[i].cbegin(), + d_gnss_synchro_history_queue[i].cend(), T_rx_s, Hybrid_valueCompare_gnss_synchro_receiver_time); - if (gnss_synchro_deque_iter != d_gnss_synchro_history_queue[i].end()) + if (gnss_synchro_deque_iter != d_gnss_synchro_history_queue[i].cend()) { if (gnss_synchro_deque_iter->Flag_valid_word == true) { @@ -226,10 +225,10 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused { // record the word structure in a map for pseudorange computation // save the previous observable - int distance = std::distance(d_gnss_synchro_history_queue[i].begin(), gnss_synchro_deque_iter); + int distance = std::distance(d_gnss_synchro_history_queue[i].cbegin(), gnss_synchro_deque_iter); if (distance > 0) { - if (d_gnss_synchro_history_queue[i].at(distance-1).Flag_valid_word) + if (d_gnss_synchro_history_queue[i].at(distance - 1).Flag_valid_word) { double T_rx_channel_prev = static_cast(d_gnss_synchro_history_queue[i].at(distance - 1).Tracking_sample_counter) / static_cast(gnss_synchro_deque_iter->fs); double delta_T_rx_s_prev = T_rx_channel_prev - T_rx_s; @@ -268,8 +267,8 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused * common RX time algorithm */ // what is the most recent symbol TOW in the current set? -> this will be the reference symbol - gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.begin(), - realigned_gnss_synchro_map.end(), + gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.cbegin(), + realigned_gnss_synchro_map.cend(), Hybrid_pairCompare_gnss_synchro_d_TOW); double ref_fs_hz = static_cast(gnss_synchro_map_iter->second.fs); @@ -292,7 +291,7 @@ int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused double channel_T_rx_s; double channel_fs_hz; double channel_TOW_s; - for(gnss_synchro_map_iter = realigned_gnss_synchro_map.begin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.end(); gnss_synchro_map_iter++) + for(gnss_synchro_map_iter = realigned_gnss_synchro_map.cbegin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.cend(); gnss_synchro_map_iter++) { channel_fs_hz = static_cast(gnss_synchro_map_iter->second.fs); channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s; From ffde1309b9f3267236a21e7e77209f3a23d71683 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Oct 2017 11:23:41 +0100 Subject: [PATCH 08/12] Fix compilation error --- src/algorithms/libs/rtklib/rtklib_rtksvr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 23d1c188a..9026c5db2 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -357,7 +357,7 @@ void decodefile(rtksvr_t *svr, int index) sbsigp_t sbsigp0[MAXNIGP] = {{{0, 0.0}, 0, 0, 0, 0.0 }}; sbsion_t sbsion0[MAXBAND+1] = {{0, 0, {*sbsigp0} }}; dgps_t dgps0[MAXSAT] = { {{0, 0.0}, 0.0, 0.0, 0, 0.0 }}; - ssr_t ssr0[MAXSAT] = {{ {{0, 0.0}}, {0.0}, {0}, 0, 0, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, {0.0}, {0.0}, {0.0}, 0.0, 0.0, {'0'} }}; + ssr_t ssr0[MAXSAT] = {{ {{0, 0.0}}, {0.0}, {0}, 0, 0, 0, 0, {0.0}, {0.0}, {0.0}, 0.0, {0.0}, {0.0}, {0.0}, 0.0, 0.0, '0' }}; lexeph_t lexeph0[MAXSAT] = {{ {0,0.0}, {0,0.0}, 0, 0, 0, {0.0}, {0.0}, {0.0}, {0.0}, 0.0, 0.0, 0.0, {0.0} }}; stec_t stec0[MAXSTA] = {{ {0,0.0}, 0, 0.0, 0.0, {0.0}, 0}}; trop_t trop0[MAXSTA] = {{ {0, 0.0}, {0.0}, {0.0}}}; From e7143f932a5950346924fdb754b499b99f4cb9cc Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Tue, 31 Oct 2017 12:36:35 +0100 Subject: [PATCH 09/12] Add includes for gnuradio-iio in block factory --- src/core/receiver/CMakeLists.txt | 102 ++++++++++++++++--------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index ae6908495..623a0dc39 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -41,6 +41,58 @@ if(ENABLE_FPGA) endif(ENABLE_FPGA) +if(Boost_VERSION LESS 105000) + add_definitions(-DOLD_BOOST=1) +endif(Boost_VERSION LESS 105000) + +if(OPENSSL_FOUND) + add_definitions( -DUSE_OPENSSL_FALLBACK=1 ) +endif(OPENSSL_FOUND) + +if(ENABLE_GN3S) + add_definitions(-DGN3S_DRIVER=1) +endif(ENABLE_GN3S) + +if(ENABLE_ARRAY) + add_definitions(-DRAW_ARRAY_DRIVER=1) +endif(ENABLE_ARRAY) + +if(ENABLE_FLEXIBAND) + add_definitions(-DFLEXIBAND_DRIVER=1) +endif(ENABLE_FLEXIBAND) + +if(ENABLE_OSMOSDR) + if(GROSMOSDR_FOUND) + add_definitions(-DOSMOSDR_DRIVER=1) + endif(GROSMOSDR_FOUND) +endif(ENABLE_OSMOSDR) + +if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd) + add_definitions(-DUHD_DRIVER=1) +endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd) + +#Enable OpenCL if found in the system +if(OPENCL_FOUND) + message(STATUS "Adding processing blocks implemented using OpenCL" ) + add_definitions(-DOPENCL_BLOCKS=1) +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) + set(OPT_RECEIVER_INCLUDE_DIRS ${OPT_RECEIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) +endif(ENABLE_PLUTOSDR) + +if(ENABLE_FMCOMMS2) + add_definitions(-DFMCOMMS2_DRIVER=1) + set(OPT_RECEIVER_INCLUDE_DIRS ${OPT_RECEIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) +endif(ENABLE_FMCOMMS2) + +add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}") + + include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/core/system_parameters @@ -86,56 +138,6 @@ include_directories( ${VOLK_GNSSSDR_INCLUDE_DIRS} ) -if(Boost_VERSION LESS 105000) - add_definitions(-DOLD_BOOST=1) -endif(Boost_VERSION LESS 105000) - -if(OPENSSL_FOUND) - add_definitions( -DUSE_OPENSSL_FALLBACK=1 ) -endif(OPENSSL_FOUND) - -if(ENABLE_GN3S) - add_definitions(-DGN3S_DRIVER=1) -endif(ENABLE_GN3S) - -if(ENABLE_ARRAY) - add_definitions(-DRAW_ARRAY_DRIVER=1) -endif(ENABLE_ARRAY) - -if(ENABLE_FLEXIBAND) - add_definitions(-DFLEXIBAND_DRIVER=1) -endif(ENABLE_FLEXIBAND) - -if(ENABLE_OSMOSDR) - if(GROSMOSDR_FOUND) - add_definitions(-DOSMOSDR_DRIVER=1) - endif(GROSMOSDR_FOUND) -endif(ENABLE_OSMOSDR) - -if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd) - add_definitions(-DUHD_DRIVER=1) -endif(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd) - -#Enable OpenCL if found in the system -if(OPENCL_FOUND) - message(STATUS "Adding processing blocks implemented using OpenCL" ) - add_definitions(-DOPENCL_BLOCKS=1) -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") list(SORT GNSS_RECEIVER_HEADERS) file(GLOB GNSS_RECEIVER_INTERFACE_HEADERS "../interfaces/*.h") From 0054f1c5f8e9c7dde703bb5e2ce828d960adf464 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Oct 2017 12:45:09 +0100 Subject: [PATCH 10/12] Fix compilation --- cmake/Modules/Findiio.cmake | 32 +++++++++++++++++++ .../signal_source/adapters/CMakeLists.txt | 2 +- .../adapters/plutosdr_signal_source.cc | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 cmake/Modules/Findiio.cmake diff --git a/cmake/Modules/Findiio.cmake b/cmake/Modules/Findiio.cmake new file mode 100644 index 000000000..1daf4d12e --- /dev/null +++ b/cmake/Modules/Findiio.cmake @@ -0,0 +1,32 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(PC_IIO gnuradio-iio) + +FIND_PATH( + IIO_INCLUDE_DIRS + NAMES iio/api.h + HINTS $ENV{IIO_DIR}/include + ${PC_IIO_INCLUDEDIR} + PATHS ${CMAKE_INSTALL_PREFIX}/include + /usr/local/include + /usr/include + ${CMAKE_INSTALL_PREFIX}/include/gnuradio + /usr/local/include/gnuradio + /usr/include/gnuradio +) + +FIND_LIBRARY( + IIO_LIBRARIES + NAMES gnuradio-iio + HINTS $ENV{IIO_DIR}/lib + ${PC_IIO_LIBDIR} + PATHS ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 + /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(IIO DEFAULT_MSG IIO_LIBRARIES IIO_INCLUDE_DIRS) +MARK_AS_ADVANCED(IIO_LIBRARIES IIO_INCLUDE_DIRS) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 009f56433..822b483d4 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -47,7 +47,7 @@ if(ENABLE_FMCOMMS2) 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) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc) endif(NOT IIO_FOUND) endif(ENABLE_FMCOMMS2) diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index 64d59a113..d0926dc56 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -51,7 +51,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration 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); + 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); From 462de44be4c6b5cedb7138527f1d994e1d3eb958 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Oct 2017 13:05:15 +0100 Subject: [PATCH 11/12] Fix compilation --- cmake/Modules/Findiio.cmake | 5 +---- .../signal_source/adapters/fmcomms2_signal_source.h | 4 ++-- .../signal_source/adapters/plutosdr_signal_source.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmake/Modules/Findiio.cmake b/cmake/Modules/Findiio.cmake index 1daf4d12e..817e9f9f7 100644 --- a/cmake/Modules/Findiio.cmake +++ b/cmake/Modules/Findiio.cmake @@ -3,15 +3,12 @@ PKG_CHECK_MODULES(PC_IIO gnuradio-iio) FIND_PATH( IIO_INCLUDE_DIRS - NAMES iio/api.h + NAMES gnuradio/iio/api.h HINTS $ENV{IIO_DIR}/include ${PC_IIO_INCLUDEDIR} PATHS ${CMAKE_INSTALL_PREFIX}/include /usr/local/include /usr/include - ${CMAKE_INSTALL_PREFIX}/include/gnuradio - /usr/local/include/gnuradio - /usr/include/gnuradio ) FIND_LIBRARY( diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index 0672770f5..35c1e2541 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -1,6 +1,6 @@ /*! * \file fmcomms2_signal_source.h - * \brief Interface to use SDR hardware based in FMCOMMS2 driver from analog + * \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 * @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include "gnss_block_interface.h" class ConfigurationInterface; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index 79a310089..9bbdb4511 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include "gnss_block_interface.h" class ConfigurationInterface; From c70f7b504add41674b8566828cd96f33a3cf5f6a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 31 Oct 2017 15:40:14 +0100 Subject: [PATCH 12/12] Fix RINEX version --- CMakeLists.txt | 2 +- src/algorithms/PVT/libs/rinex_printer.cc | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30d4f6eaf..042f386db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Tele 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) +option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware, requires gr-iio" OFF) # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 4631270d2..7de3391c9 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -182,8 +182,15 @@ Rinex_Printer::Rinex_Printer(int conf_version) if(conf_version != 0) { if(conf_version == 2) - version = 2; - stringVersion = "2.11"; + { + version = 2; + stringVersion = "2.11"; + } + if(conf_version == 3) + { + version = 3; + stringVersion = "3.02"; + } } numberTypesObservations = 4; // Number of available types of observable in the system