From becc3426af44aeec876575e91484b686923b2f84 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Wed, 20 Oct 2021 11:23:58 +0200 Subject: [PATCH] Update gr.limesdr adapter to support gr3.8 --- conf/gnss-sdr_GPS_L1_LimeSDR.conf | 145 +++++++++++------- .../signal_source/adapters/CMakeLists.txt | 5 +- .../adapters/limesdr_signal_source.cc | 28 ++-- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 4 + 4 files changed, 111 insertions(+), 71 deletions(-) diff --git a/conf/gnss-sdr_GPS_L1_LimeSDR.conf b/conf/gnss-sdr_GPS_L1_LimeSDR.conf index f99fefc28..bdecb922f 100644 --- a/conf/gnss-sdr_GPS_L1_LimeSDR.conf +++ b/conf/gnss-sdr_GPS_L1_LimeSDR.conf @@ -1,111 +1,140 @@ ; This is a GNSS-SDR configuration file ; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; [GNSS-SDR] ;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;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=20000000 +GNSS-SDR.use_acquisition_resampler=true ;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.implementation=Limesdr_Signal_Source SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -;# LimeSDR RX1 antennas: NONE,LNAH,LNAL,LNAW -SignalSource.antenna=LNAW +SignalSource.sampling_frequency=20000000 SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.rf_gain=40 -SignalSource.if_gain=30 -SignalSource.AGC_enabled=false +SignalSource.gain=55; //0-73 dB//no agc in LimeSDR +;SignalSource.analog_bw //if not set, defaults to sample_rate/2 +;SignalSource.digital_bw // if not set, defaults to 0 (disabled filter) +SignalSource.limesdr_serial // if not set, its automatic +SignalSource.antenna=2 // None(0), LNAH(1), LNAL(2), LNAW(3), AUTO(255) +SignalSource.ext_clock_MHz_=0 //0 -> internal clock +SignalSource.PPS_mode=false; //requires special gr-limesdr +SignalSource.limechannel_mode = 0; //ChannelMode must be A(0), B(1) or (A+B) MIMO(2)" SignalSource.samples=0 SignalSource.repeat=false -;# Next line enables the LimeSDR -SignalSource.osmosdr_args=driver=lime,soapy=0 -SignalSource.enable_throttle_control=false SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false ;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner +SignalConditioner.implementation=Pass_Through ;######### DATA_TYPE_ADAPTER CONFIG ############ DataTypeAdapter.implementation=Pass_Through ;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.decimation_factor=1 -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.85 -InputFilter.band2_begin=0.9 -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.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.implementation=Pass_Through ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through ;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 +Channels_1C.count=7 +Channels_1B.count=0 Channels.in_acquisition=1 Channel.signal=1C + ;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition Acquisition_1C.item_type=gr_complex -Acquisition_1C.sampled_ms=1 -Acquisition_1C.threshold=0.015 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.use_CFAR_algorithm=false; +Acquisition_1C.threshold=2.4 +Acquisition_1C.doppler_max=6000 +Acquisition_1C.doppler_step=250 Acquisition_1C.dump=false Acquisition_1C.dump_filename=./acq_dump.dat +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=6000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + ;######### 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=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; Tracking_1C.dump=false Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.75; +Tracking_1C.extend_correlation_symbols=1; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.5 + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=5.0 +Tracking_1B.dll_bw_narrow_hz=0.5 +Tracking_1B.extend_correlation_symbols=1 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +;Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + ;######### TELEMETRY DECODER GPS CONFIG ############ TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder TelemetryDecoder_1C.dump=false +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + ;######### OBSERVABLES CONFIG ############ -Observables.implementation=GPS_L1_CA_Observables +Observables.implementation=Hybrid_Observables Observables.dump=false Observables.dump_filename=./observables.dat + ;######### PVT CONFIG ############ -;PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single +PVT.implementation=RTKLIB_PVT +PVT.enable_rx_clock_correction=false +PVT.positioning_mode=Single ; 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.rinexobs_rate_ms=100 PVT.display_rate_ms=500 -PVT.iono_model=Broadcast -PVT.trop_model=Saastamoinen +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=true PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index c2b9d7b2e..5fe9b1d1c 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -79,7 +79,6 @@ if(ENABLE_LIMESDR) endif() - if(ENABLE_UHD) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} uhd_signal_source.h) @@ -141,6 +140,10 @@ else() ) endif() +if(GNURADIO_IS_38_OR_GREATER) + target_compile_definitions(signal_source_adapters PUBLIC -DGR_GREATER_38=1) +endif() + target_include_directories(signal_source_adapters PUBLIC ${CMAKE_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/signal_source/adapters/limesdr_signal_source.cc b/src/algorithms/signal_source/adapters/limesdr_signal_source.cc index 274ff17dc..aadb7b014 100644 --- a/src/algorithms/signal_source/adapters/limesdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/limesdr_signal_source.cc @@ -78,7 +78,12 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura try { #ifdef LimeSDR_PPS + +#ifdef GR_GREATER_38 + limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, false, PPS_mode_); +#else limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, PPS_mode_); +#endif if (ext_clock_MHz_ != 0.0) { if (limesdr_source_->set_ext_clk(ext_clock_MHz_)) @@ -95,7 +100,13 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura limesdr_source_->disable_ext_clk(); } #else + +#ifdef GR_GREATER_38 + limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_, false); +#else limesdr_source_ = gr::limesdr::source::make(limesdr_serial_, limechannel_mode_, limesdr_file_); +#endif + #endif } catch (const boost::exception& e) @@ -114,6 +125,8 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura */ limesdr_source_->set_antenna(antenna_, channel_); + std::cout << "LimeSDR RX antenna set to " << antenna_ << " for channel " << channel_ << "\n"; + LOG(INFO) << "LimeSDR RX antenna set to " << antenna_ << " for channel " << channel_; // 2 set sampling rate double actual_sample_rate = limesdr_source_->set_sample_rate(sample_rate_); std::cout << "Actual RX Rate: " << actual_sample_rate << " [SPS]...\n"; @@ -133,23 +146,14 @@ LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configura // TODO: gr-limesdr does not report PLL tune frequency error... // 4. set rx gain - //todo: gr-limesdr does not expose AGC controls.. - // if (AGC_enabled_ == true) - // { - // osmosdr_source_->set_gain_mode(true); - // std::cout << "AGC enabled\n"; - // LOG(INFO) << "AGC enabled"; - // } - // else - // { double actual_gain = limesdr_source_->set_gain(gain_, channel_); std::cout << "Actual RX Gain: " << actual_gain << " [dB]...\n"; LOG(INFO) << "Actual RX Gain: " << actual_gain << " [dB]..."; // Set analog bandwidth - double actual_analog_bw = limesdr_source_->set_bandwidth(analog_bw_hz_, channel_); - std::cout << "Actual Analog Bandwidth: " << actual_analog_bw << " [Hz]...\n"; - LOG(INFO) << "Actual Analog Bandwidth: : " << actual_analog_bw << " [Hz]..."; + double current_analog_bw = limesdr_source_->set_bandwidth(analog_bw_hz_, channel_); + std::cout << "Actual Analog Bandwidth: " << current_analog_bw << " [Hz]...\n"; + LOG(INFO) << "Actual Analog Bandwidth: : " << current_analog_bw << " [Hz]..."; // Set digital bandwidth limesdr_source_->set_digital_filter(digital_bw_hz_, channel_); diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index cf0379889..b5cf09aa8 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -2030,6 +2030,10 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) { std::cout << "msg Bad any_cast: " << e.what(); } + catch (std::exception &ex) + { + LOG(WARNING) << "Bad any_cast: " << ex.what(); + } } //************* end time tags **************