diff --git a/CMakeLists.txt b/CMakeLists.txt index 265e79ec5..042f386db 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, requires gr-iio" OFF) # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) @@ -214,15 +216,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..6935a4067 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: @@ -368,7 +368,63 @@ $ 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 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 +$ 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` and `Plutosdr_Signal_Source`: +~~~~~~ +$ cmake -DENABLE_FMCOMMS2=ON ../ +$ 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 those devices. ###### Build OpenCL support (OPTIONAL): @@ -413,7 +469,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: diff --git a/cmake/Modules/Findiio.cmake b/cmake/Modules/Findiio.cmake new file mode 100644 index 000000000..817e9f9f7 --- /dev/null +++ b/cmake/Modules/Findiio.cmake @@ -0,0 +1,29 @@ +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(PC_IIO gnuradio-iio) + +FIND_PATH( + IIO_INCLUDE_DIRS + NAMES gnuradio/iio/api.h + HINTS $ENV{IIO_DIR}/include + ${PC_IIO_INCLUDEDIR} + PATHS ${CMAKE_INSTALL_PREFIX}/include + /usr/local/include + /usr/include +) + +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/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf new file mode 100644 index 000000000..ae832f901 --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -0,0 +1,141 @@ +; 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_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_sps=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=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +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/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf new file mode 100644 index 000000000..97c9deded --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf @@ -0,0 +1,101 @@ +; 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_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_sps=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=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +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/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 diff --git a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 0c2aabedf..9026c5db2 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -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]; 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; diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 388b2ed59..822b483d4 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -21,6 +21,36 @@ 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") + 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) + ############################################### + # 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") + 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) + endif(NOT IIO_FOUND) +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..26640d840 --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -0,0 +1,179 @@ +/*! + * \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-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 "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: " << uri_ << std::endl; + std::cout << "LO frequency : " << freq_ << "Hz" << std::endl; + std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl; + + 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() << ")"; + } +} + + +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..35c1e2541 --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -0,0 +1,116 @@ +/*! + * \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-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_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(); + + inline std::string role() override + { + return role_; + } + + /*! + * \brief Returns "fmcomms2_Signal_Source" + */ + inline std::string implementation() override + { + return "Fmcomms2_Signal_Source"; + } + + inline size_t item_size() override + { + return item_size_; + } + + 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_; + + 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..d0926dc56 --- /dev/null +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -0,0 +1,169 @@ +/*! + * \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 +#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!!" << std::endl; + LOG(FATAL) << "Exception: item type must be gr_complex!"; + } + + item_size_ = sizeof(gr_complex); + + std::cout << "device address: " << uri_ << std::endl; + std::cout << "frequency : " << freq_ << "Hz" << std::endl; + std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl; + std::cout << "gain mode: " << gain_mode_ << std::endl; + std::cout << "item type: " << item_type_ << std::endl; + + 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() << ")"; + } +} + + +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..9bbdb4511 --- /dev/null +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -0,0 +1,111 @@ +/*! + * \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_ + +#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() override + { + return role_; + } + + /*! + * \brief Returns "Plutosdr_Signal_Source" + */ + std::string implementation() override + { + return "Plutosdr_Signal_Source"; + } + size_t item_size() override + { + return item_size_; + } + + 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_; + + 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..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,46 +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) - -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") 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) {