From 4a362c0507a865330e8ce5ee427484705ad20b1e Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Wed, 18 Dec 2019 00:10:29 -0500 Subject: [PATCH 01/10] Added UHD support for Ettus Research USRP devices --- src/goesrecv/CMakeLists.txt | 12 ++ src/goesrecv/config.cc | 42 ++++++ src/goesrecv/config.h | 14 +- src/goesrecv/source.cc | 33 +++++ src/goesrecv/uhd_source.cc | 288 ++++++++++++++++++++++++++++++++++++ src/goesrecv/uhd_source.h | 72 +++++++++ 6 files changed, 460 insertions(+), 1 deletion(-) create mode 100644 src/goesrecv/uhd_source.cc create mode 100644 src/goesrecv/uhd_source.h diff --git a/src/goesrecv/CMakeLists.txt b/src/goesrecv/CMakeLists.txt index b8a0934e..8956ebea 100644 --- a/src/goesrecv/CMakeLists.txt +++ b/src/goesrecv/CMakeLists.txt @@ -9,6 +9,14 @@ add_library(publisher ) target_link_libraries(publisher nanomsg) +pkg_check_modules(UHD uhd) +if(NOT UHD_FOUND) + message(WARNING "Unable to find libuhd") +else() + add_library(uhd_source uhd_source.cc) + target_link_libraries(uhd_source ${UHD_LIBRARIES} publisher stdc++) +endif() + pkg_check_modules(AIRSPY libairspy) if(NOT AIRSPY_FOUND) message(WARNING "Unable to find libairspy") @@ -60,6 +68,10 @@ target_link_libraries(goesrecv clock_recovery) target_link_libraries(goesrecv quantize) target_link_libraries(goesrecv nanomsg_source) target_link_libraries(goesrecv version) +if(UHD_FOUND) + target_compile_definitions(goesrecv PUBLIC -DBUILD_UHD) + target_link_libraries(goesrecv uhd_source) +endif() if(AIRSPY_FOUND) target_compile_definitions(goesrecv PUBLIC -DBUILD_AIRSPY) target_link_libraries(goesrecv airspy_source) diff --git a/src/goesrecv/config.cc b/src/goesrecv/config.cc index ff522585..258431cf 100644 --- a/src/goesrecv/config.cc +++ b/src/goesrecv/config.cc @@ -123,6 +123,43 @@ void loadDemodulator(Config::Demodulator& out, const toml::Value& v) { } } +// +void loadUHDSource(Config::UHD& out, const toml::Value& v) { + const auto& table = v.as(); + + for (const auto& it : table) { + const auto& key = it.first; + const auto& value = it.second; + + if (key == "type") { + out.type = value.as(); + continue; + } + + if (key == "frequency") { + out.frequency = value.as(); + continue; + } + + if (key == "sample_rate") { + out.sampleRate = value.as(); + continue; + } + + if (key == "gain") { + out.gain = value.as(); + continue; + } + + if (key == "sample_publisher") { + out.samplePublisher = createSamplePublisher(value); + continue; + } + + throwInvalidKey(key); + } +} + void loadAirspySource(Config::Airspy& out, const toml::Value& v) { const auto& table = v.as(); for (const auto& it : table) { @@ -382,6 +419,11 @@ Config Config::load(const std::string& file) { continue; } + if (key == "uhd") { + loadUHDSource(out.uhd, value); + continue; + } + if (key == "airspy") { loadAirspySource(out.airspy, value); continue; diff --git a/src/goesrecv/config.h b/src/goesrecv/config.h index 1a026b29..57141441 100644 --- a/src/goesrecv/config.h +++ b/src/goesrecv/config.h @@ -21,7 +21,7 @@ struct Config { // LRIT or HRIT std::string downlinkType; - // String "airspy" or "rtlsdr" + // String "uhd", "airspy" or "rtlsdr" std::string source; // Demodulator statistics (gain, frequency correction, etc.) @@ -33,6 +33,18 @@ struct Config { Demodulator demodulator; + struct UHD { + + std::string type; // device type filter + uint32_t frequency = 0; + uint32_t sampleRate = 0; + uint8_t gain = 8; + + std::unique_ptr samplePublisher; + }; + + UHD uhd; + struct Airspy { uint32_t frequency = 0; uint32_t sampleRate = 0; diff --git a/src/goesrecv/source.cc b/src/goesrecv/source.cc index 28fd91b5..cac8ad5a 100644 --- a/src/goesrecv/source.cc +++ b/src/goesrecv/source.cc @@ -2,6 +2,10 @@ #include +#ifdef BUILD_UHD +#include "uhd_source.h" +#endif + #ifdef BUILD_AIRSPY #include "airspy_source.h" #endif @@ -15,6 +19,35 @@ std::unique_ptr Source::build( const std::string& type, Config& config) { + if (type == "uhd") { +#ifdef BUILD_UHD + auto uhd = UHD::open( config.uhd.type ); + + // Use sample rate if set, otherwise default to lowest possible rate. + auto rates = uhd->getSampleRates(); + + // Use sample rate if set, otherwise default to 2.4MSPS. + if (config.uhd.sampleRate != 0) { + uhd->setSampleRate(config.uhd.sampleRate); + } else { + uhd->setSampleRate(2400000); + } + + uhd->setFrequency(config.uhd.frequency); + uhd->setGain(config.uhd.gain); + uhd->setSamplePublisher(std::move(config.airspy.samplePublisher)); + + return std::unique_ptr(uhd.release()); +#else + throw std::runtime_error( + "You configured goesrecv to use the \"uhd\" source, " + "but goesrecv was not compiled with UHD support. " + "Make sure to install the UHD library before compiling goestools, " + "and look for a message saying 'Found uhd' when running cmake." + ); +#endif + } + if (type == "airspy") { #ifdef BUILD_AIRSPY auto airspy = Airspy::open(); diff --git a/src/goesrecv/uhd_source.cc b/src/goesrecv/uhd_source.cc new file mode 100644 index 00000000..66af8cda --- /dev/null +++ b/src/goesrecv/uhd_source.cc @@ -0,0 +1,288 @@ +#include + +#include "uhd_source.h" + +#include + +#include +#include + +#include +#include +#include + + +std::unique_ptr UHD::open( std::string type ) +{ + std::string args = ""; + + // Filter to a device type if one was specified + if ( not type.empty( ) ) + { + args = "type=" + type; + } + + // Set the scheudling priority on the current thread + uhd::set_thread_priority_safe( ); + + // Create a USRP device + uhd::usrp::multi_usrp::sptr dev = nullptr; + + UHD_SAFE_CALL + ( + dev = uhd::usrp::multi_usrp::make( args ); + ) + + // Abort if we didn't open a device + if ( dev == nullptr ) + { + std::cout << "Unable to open UHD device. " << std::endl; + + exit( 1 ); + } + + std::cout << std::endl << "Using Device " << dev->get_pp_string( ) << std::endl; + + // Lock mboard clocks + dev->set_clock_source( "internal" ); + + return std::make_unique( dev ); +} + +UHD::UHD( uhd::usrp::multi_usrp::sptr dev ) : dev_( dev ) +{ + // Load list of supported sample rates + sampleRates_ = loadSampleRates( ); +} + +UHD::~UHD( ) +{ + +} + +std::vector UHD::loadSampleRates( ) +{ + return { 200000, 250000, 2000000, 8000000, 10000000, 12500000, 16000000, 20000000, 56000000 }; +} + +void UHD::setFrequency( uint32_t freq ) +{ + ASSERT( dev_ != nullptr ); + + uhd::tune_request_t tune_request( freq ); + + dev_->set_rx_freq( tune_request ); +} + +void UHD::setSampleRate( uint32_t rate ) +{ + ASSERT( dev_ != nullptr ); + + dev_->set_rx_rate( rate ); + + // Set the bandwidth to match the sample rate + dev_->set_rx_bandwidth( rate ); + + sampleRate_ = rate; +} + +uint32_t UHD::getSampleRate( ) const +{ + return sampleRate_; +} + +void UHD::setGain( int gain ) +{ + ASSERT( dev_ != nullptr ); + + dev_->set_rx_gain( gain ); +} + +void UHD::start( const std::shared_ptr> &queue ) +{ + ASSERT( dev_ != nullptr ); + + queue_ = queue; + + thread_ = std::thread( [&] { + + running = true; + + size_t num_acc_samps = 0; // number of accumulated samples + + // set the antenna + dev_->set_rx_antenna( "TX/RX" ); + + std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); // allow for some setup time + + // Check Ref and LO Lock detect + std::vector sensor_names; + + sensor_names = dev_->get_rx_sensor_names( 0 ); + + if ( std::find( sensor_names.begin( ), sensor_names.end( ), "lo_locked" ) != sensor_names.end( ) ) + { + uhd::sensor_value_t lo_locked = dev_->get_rx_sensor( "lo_locked", 0 ); + + std::cout << std::endl << "Checking RX: " << lo_locked.to_pp_string( ) << std::endl << std::endl; + + UHD_ASSERT_THROW( lo_locked.to_bool( ) ); + } + + sensor_names = dev_->get_mboard_sensor_names( 0 ); + + // create a receive streamer of complex floats + uhd::stream_args_t stream_args( "fc32" ); + + uhd::rx_streamer::sptr rx_stream = dev_->get_rx_stream( stream_args ); + + // setup streaming + uhd::stream_cmd_t stream_cmd_start( uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS ); + + stream_cmd_start.stream_now = true; + + rx_stream->issue_stream_cmd( stream_cmd_start ); + + uhd::rx_metadata_t md; + + std::vector> buff( rx_stream->get_max_num_samps( ) * 2 ); + + while ( running ) + { + size_t num_rx_samps = rx_stream->recv( &buff.front( ), buff.size( ), md ); + + // handle the error codes + switch ( md.error_code ) + { + case uhd::rx_metadata_t::ERROR_CODE_NONE: + break; + + case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: + if ( num_acc_samps == 0 ) + continue; + + std::cerr << "Timeout before all samples received, possible packet loss" << std::endl; + + goto done_loop; + + + case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: + if ( md.out_of_sequence == true ) + std::cerr << "Samples out of sequence" << std::endl; + else + std::cerr << "Sample buffer overflow. Try reducing the sample rate." << std::endl; + + goto done_loop; + + default: + std::cerr << "Received error code " << md.error_code << std::endl; + std::cerr << "flags " << md.out_of_sequence << std::endl; + goto done_loop; + } + + transfer_buffer( buff, num_rx_samps ); + +#ifdef HANDLEIT + // HANDLE + + // Expect multiple of 2 + ASSERT( ( num_rx_samps & 0x2 ) == 0 ); + + if ( num_rx_samps % 4 != 0 ) + { + std::cout << "not div by four " << num_rx_samps << std::endl; + continue; + } + // Grab buffer from queue + auto out = queue_->popForWrite( ); + + out->resize( num_rx_samps ); + + std::complex *p = out->data( ); + + for ( int i = 0; i < int( num_rx_samps ); i++ ) + { + p[i] = buff[i]; + + // std::cout << "count " << num_rx_samps << std::endl; + } + + // Publish output if applicable + if ( samplePublisher_ ) + { + samplePublisher_->publish( *out ); + } + + // Return buffer to queue + queue_->pushWrite( std::move( out ) ); + + // HANDLE +#endif + // Increment the accumulated sample count + num_acc_samps += num_rx_samps; + } + done_loop: + + // setup streaming + uhd::stream_cmd_t stream_cmd_stop( uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS ); + + // stream_cmd.stream_now = true; + + rx_stream->issue_stream_cmd( stream_cmd_stop ); + + // finished + std::cout << std::endl << "Streaming ended" << std::endl << std::endl; + + return EXIT_SUCCESS; + } ); + +#ifdef __APPLE__ + pthread_setname_np( "uhd" ); +#else + pthread_setname_np( thread_.native_handle( ), "uhd" ); +#endif +} + +void UHD::stop( ) +{ + ASSERT( dev_ != nullptr ); + + // cause the recieve loop to exit + running = false; + + // Wait for thread to terminate + thread_.join( ); + + // Close queue to signal downstream + queue_->close( ); + + // Clear reference to queue + queue_.reset( ); +} + +void UHD::transfer_buffer( std::vector> transfer, size_t num_rx_samps ) +{ + // Expect multiple of 2 + ASSERT( ( num_rx_samps & 0x2 ) == 0 ); + + // Grab buffer from queue + auto out = queue_->popForWrite( ); + + out->resize( num_rx_samps ); + + std::complex *p = out->data( ); + + for ( int i = 0; i < int( num_rx_samps ); i++ ) + { + p[i] = transfer[i]; + } + + // Publish output if applicable + if ( samplePublisher_ ) + { + samplePublisher_->publish( *out ); + } + + // Return buffer to queue + queue_->pushWrite( std::move( out ) ); +} diff --git a/src/goesrecv/uhd_source.h b/src/goesrecv/uhd_source.h new file mode 100644 index 00000000..41b8441b --- /dev/null +++ b/src/goesrecv/uhd_source.h @@ -0,0 +1,72 @@ +#pragma once + +#include + +#include +#include +#include + +#include +#include +#include +#include + + +#include "source.h" + +class UHD : public Source +{ + public: + static std::unique_ptr open( std::string type ); + + explicit UHD( uhd::usrp::multi_usrp::sptr dev ); + + ~UHD( ); + + std::vector getSampleRates( ) const + { + return sampleRates_; + } + + void setFrequency( uint32_t freq ); + + void setSampleRate( uint32_t rate ); + + virtual uint32_t getSampleRate( ) const override; + + void setGain( int gain ); + + // void setBiasTee( bool on ); + + void setSamplePublisher( std::unique_ptr samplePublisher ) + { + samplePublisher_ = std::move( samplePublisher ); + } + + virtual void start( const std::shared_ptr> &queue ) override; + + virtual void stop( ) override; + + protected: + + bool running; + + uhd::usrp::multi_usrp::sptr dev_; + + std::vector loadSampleRates( ); + + std::vector sampleRates_; + + std::uint32_t sampleRate_; + + // Background RX thread + std::thread thread_; + + virtual void transfer_buffer( std::vector> transfer, size_t num_rx_samps ); + + // Set on start; cleared on stop + std::shared_ptr > queue_; + + // Optional publisher for samples + std::unique_ptr samplePublisher_; +}; From 682e7dfb81fbe8b2ddb1be49ce40f15e9c6b9260 Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Wed, 18 Dec 2019 00:13:50 -0500 Subject: [PATCH 02/10] Added UHD goesrecv configuration file example --- etc/goesrecv-uhd.conf | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 etc/goesrecv-uhd.conf diff --git a/etc/goesrecv-uhd.conf b/etc/goesrecv-uhd.conf new file mode 100644 index 00000000..07dcb6ab --- /dev/null +++ b/etc/goesrecv-uhd.conf @@ -0,0 +1,30 @@ +[demodulator] +mode = "hrit" +source = "uhd" + +[rtlsdr] +frequency = 1694100000 +sample_rate = 2400000 +gain = 5 +bias_tee = false + +[uhd] +type = "b200" +frequency = 1694100000 +sample_rate = 8000000 +gain = 32 + +[costas] +max_deviation = 200e3 + +[nanomsg] +sample_rate = 2400000 +connect = "tcp://0.0.0.0:5005" +receive_buffer = 2097152 + +[decoder.packet_publisher] +bind = "tcp://0.0.0.0:5004" +send_buffer = 1048576 + +[monitor] +statsd_address = "udp4://localhost:8125" From e49386e76b9b4c7b46393b584f076b4b6665441e Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Wed, 18 Dec 2019 16:02:41 -0500 Subject: [PATCH 03/10] Improved local oscillator locking method --- src/goesrecv/source.cc | 2 +- src/goesrecv/uhd_source.cc | 72 +++++++++++++++++++++++--------------- src/goesrecv/uhd_source.h | 20 ++++------- 3 files changed, 51 insertions(+), 43 deletions(-) diff --git a/src/goesrecv/source.cc b/src/goesrecv/source.cc index cac8ad5a..5b72b3f3 100644 --- a/src/goesrecv/source.cc +++ b/src/goesrecv/source.cc @@ -24,7 +24,7 @@ std::unique_ptr Source::build( auto uhd = UHD::open( config.uhd.type ); // Use sample rate if set, otherwise default to lowest possible rate. - auto rates = uhd->getSampleRates(); + // auto rates = uhd->getSampleRates(); // Use sample rate if set, otherwise default to 2.4MSPS. if (config.uhd.sampleRate != 0) { diff --git a/src/goesrecv/uhd_source.cc b/src/goesrecv/uhd_source.cc index 66af8cda..3bbf0782 100644 --- a/src/goesrecv/uhd_source.cc +++ b/src/goesrecv/uhd_source.cc @@ -43,7 +43,7 @@ std::unique_ptr UHD::open( std::string type ) std::cout << std::endl << "Using Device " << dev->get_pp_string( ) << std::endl; - // Lock mboard clocks + // Select the internal clock source dev->set_clock_source( "internal" ); return std::make_unique( dev ); @@ -51,18 +51,12 @@ std::unique_ptr UHD::open( std::string type ) UHD::UHD( uhd::usrp::multi_usrp::sptr dev ) : dev_( dev ) { - // Load list of supported sample rates - sampleRates_ = loadSampleRates( ); + // Perform necessary constructor operations here } UHD::~UHD( ) { - -} - -std::vector UHD::loadSampleRates( ) -{ - return { 200000, 250000, 2000000, 8000000, 10000000, 12500000, 16000000, 20000000, 56000000 }; + // Perform necessary destructor operations here } void UHD::setFrequency( uint32_t freq ) @@ -82,13 +76,13 @@ void UHD::setSampleRate( uint32_t rate ) // Set the bandwidth to match the sample rate dev_->set_rx_bandwidth( rate ); - - sampleRate_ = rate; } uint32_t UHD::getSampleRate( ) const { - return sampleRate_; + ASSERT( dev_ != nullptr ); + + return dev_->get_rx_rate( ); } void UHD::setGain( int gain ) @@ -102,56 +96,73 @@ void UHD::start( const std::shared_ptr> &queue ) { ASSERT( dev_ != nullptr ); + // This is the application's sample queue queue_ = queue; thread_ = std::thread( [&] { + // The streamming loop continues to run as long as this is true running = true; - size_t num_acc_samps = 0; // number of accumulated samples + // Keep track of the total accumulated samples + size_t num_acc_samps = 0; - // set the antenna + // Set the antenana for receiving our signal dev_->set_rx_antenna( "TX/RX" ); - std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); // allow for some setup time - - // Check Ref and LO Lock detect - std::vector sensor_names; - - sensor_names = dev_->get_rx_sensor_names( 0 ); + // Check sensors for a local oscillator + std::vector sensor_names = dev_->get_rx_sensor_names( 0 ); + // If a local oscillator exists, make sure it's locked if ( std::find( sensor_names.begin( ), sensor_names.end( ), "lo_locked" ) != sensor_names.end( ) ) { - uhd::sensor_value_t lo_locked = dev_->get_rx_sensor( "lo_locked", 0 ); + std::cout << std::endl << "-- Found a local oscillator" << std::endl; - std::cout << std::endl << "Checking RX: " << lo_locked.to_pp_string( ) << std::endl << std::endl; + int lock_attempts = 0; - UHD_ASSERT_THROW( lo_locked.to_bool( ) ); - } + do + { + if ( lock_attempts++ > 3 ) // Abort after three attempts + { + std::cout << "Unable to lock local oscillator" << std::endl; + + exit( 1 ); + } - sensor_names = dev_->get_mboard_sensor_names( 0 ); + // Allow the front end time to settle + std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); + } + while ( not dev_->get_rx_sensor( "lo_locked" ).to_bool( ) ); + + std::cout << "-- Local oscillator locked" << std::endl << std::endl; + } - // create a receive streamer of complex floats + // Specify that we want to receive samples as a pair of 16 bit complex foats uhd::stream_args_t stream_args( "fc32" ); + // Create a receive stream uhd::rx_streamer::sptr rx_stream = dev_->get_rx_stream( stream_args ); - // setup streaming + // Create a stream command that will start immediately and run continuously uhd::stream_cmd_t stream_cmd_start( uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS ); stream_cmd_start.stream_now = true; + // Start streaming rx_stream->issue_stream_cmd( stream_cmd_start ); + // Holds stream metadata, such as error codes uhd::rx_metadata_t md; + // Create an internal buffer to hold received samples std::vector> buff( rx_stream->get_max_num_samps( ) * 2 ); while ( running ) { + // Read samples from the device and into our buffer size_t num_rx_samps = rx_stream->recv( &buff.front( ), buff.size( ), md ); - // handle the error codes + // Handle any error codes we receive switch ( md.error_code ) { case uhd::rx_metadata_t::ERROR_CODE_NONE: @@ -180,6 +191,7 @@ void UHD::start( const std::shared_ptr> &queue ) goto done_loop; } + // Copies samples from our internal buffer into the application's queue transfer_buffer( buff, num_rx_samps ); #ifdef HANDLEIT @@ -247,7 +259,7 @@ void UHD::stop( ) { ASSERT( dev_ != nullptr ); - // cause the recieve loop to exit + // Causes the sample streaming loop to exit running = false; // Wait for thread to terminate @@ -260,6 +272,7 @@ void UHD::stop( ) queue_.reset( ); } +// Copies samples from our internal buffer into the application's queue void UHD::transfer_buffer( std::vector> transfer, size_t num_rx_samps ) { // Expect multiple of 2 @@ -274,6 +287,7 @@ void UHD::transfer_buffer( std::vector> transfer, size_t num for ( int i = 0; i < int( num_rx_samps ); i++ ) { + // std::cout << "real " << real( transfer[i] ) << " imag " << imag( transfer[i] ) << std::endl; p[i] = transfer[i]; } diff --git a/src/goesrecv/uhd_source.h b/src/goesrecv/uhd_source.h index 41b8441b..46f54391 100644 --- a/src/goesrecv/uhd_source.h +++ b/src/goesrecv/uhd_source.h @@ -23,45 +23,39 @@ class UHD : public Source ~UHD( ); - std::vector getSampleRates( ) const - { - return sampleRates_; - } - void setFrequency( uint32_t freq ); + // Also sets the bandwidth to match void setSampleRate( uint32_t rate ); + // Reads the current sample rate setting from the device virtual uint32_t getSampleRate( ) const override; void setGain( int gain ); - // void setBiasTee( bool on ); - void setSamplePublisher( std::unique_ptr samplePublisher ) { samplePublisher_ = std::move( samplePublisher ); } + // Starts the sample streaming loop virtual void start( const std::shared_ptr> &queue ) override; + // Stops the sample streaming loop virtual void stop( ) override; protected: + // When set to false the sample streaming loop exits bool running; + // A reference to the device uhd::usrp::multi_usrp::sptr dev_; - std::vector loadSampleRates( ); - - std::vector sampleRates_; - - std::uint32_t sampleRate_; - // Background RX thread std::thread thread_; + // Copies samples from our internal buffer into the application's queue virtual void transfer_buffer( std::vector> transfer, size_t num_rx_samps ); // Set on start; cleared on stop From c2574d31e7d40bed13906d3e2fc5b0271954ddec Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Wed, 18 Dec 2019 22:07:36 -0500 Subject: [PATCH 04/10] Improve handling of buffer overflows --- src/goesrecv/uhd_source.cc | 203 +++++++++++++++---------------------- src/goesrecv/uhd_source.h | 4 - 2 files changed, 82 insertions(+), 125 deletions(-) diff --git a/src/goesrecv/uhd_source.cc b/src/goesrecv/uhd_source.cc index 3bbf0782..17aea5d3 100644 --- a/src/goesrecv/uhd_source.cc +++ b/src/goesrecv/uhd_source.cc @@ -1,47 +1,42 @@ -#include +// +// Support for Ettus Research software defined radio peripherals (USRP) +// Added by Jim Herbert (https://github.com/codient/goestools) +// #include "uhd_source.h" - -#include - #include #include - -#include +#include +#include #include #include +#include - -std::unique_ptr UHD::open( std::string type ) -{ +std::unique_ptr UHD::open( std::string type ) { std::string args = ""; // Filter to a device type if one was specified - if ( not type.empty( ) ) - { + if ( not type.empty() ) { args = "type=" + type; } // Set the scheudling priority on the current thread - uhd::set_thread_priority_safe( ); + uhd::set_thread_priority_safe(); // Create a USRP device uhd::usrp::multi_usrp::sptr dev = nullptr; - UHD_SAFE_CALL - ( - dev = uhd::usrp::multi_usrp::make( args ); - ) + UHD_SAFE_CALL( dev = uhd::usrp::multi_usrp::make( args ); ) // Abort if we didn't open a device - if ( dev == nullptr ) - { + if ( dev == nullptr ) { std::cout << "Unable to open UHD device. " << std::endl; exit( 1 ); } - std::cout << std::endl << "Using Device " << dev->get_pp_string( ) << std::endl; + std::cout << std::endl + << "Using Device " << dev->get_pp_string() << std::endl; // Select the internal clock source dev->set_clock_source( "internal" ); @@ -49,18 +44,15 @@ std::unique_ptr UHD::open( std::string type ) return std::make_unique( dev ); } -UHD::UHD( uhd::usrp::multi_usrp::sptr dev ) : dev_( dev ) -{ +UHD::UHD( uhd::usrp::multi_usrp::sptr dev ) : dev_( dev ) { // Perform necessary constructor operations here } -UHD::~UHD( ) -{ +UHD::~UHD() { // Perform necessary destructor operations here } -void UHD::setFrequency( uint32_t freq ) -{ +void UHD::setFrequency( uint32_t freq ) { ASSERT( dev_ != nullptr ); uhd::tune_request_t tune_request( freq ); @@ -68,8 +60,7 @@ void UHD::setFrequency( uint32_t freq ) dev_->set_rx_freq( tune_request ); } -void UHD::setSampleRate( uint32_t rate ) -{ +void UHD::setSampleRate( uint32_t rate ) { ASSERT( dev_ != nullptr ); dev_->set_rx_rate( rate ); @@ -78,29 +69,25 @@ void UHD::setSampleRate( uint32_t rate ) dev_->set_rx_bandwidth( rate ); } -uint32_t UHD::getSampleRate( ) const -{ +uint32_t UHD::getSampleRate() const { ASSERT( dev_ != nullptr ); - return dev_->get_rx_rate( ); + return dev_->get_rx_rate(); } -void UHD::setGain( int gain ) -{ +void UHD::setGain( int gain ) { ASSERT( dev_ != nullptr ); dev_->set_rx_gain( gain ); } -void UHD::start( const std::shared_ptr> &queue ) -{ +void UHD::start( const std::shared_ptr> &queue ) { ASSERT( dev_ != nullptr ); // This is the application's sample queue queue_ = queue; thread_ = std::thread( [&] { - // The streamming loop continues to run as long as this is true running = true; @@ -111,17 +98,17 @@ void UHD::start( const std::shared_ptr> &queue ) dev_->set_rx_antenna( "TX/RX" ); // Check sensors for a local oscillator - std::vector sensor_names = dev_->get_rx_sensor_names( 0 ); + std::vector sensor_names = dev_->get_rx_sensor_names( 0 ); // If a local oscillator exists, make sure it's locked - if ( std::find( sensor_names.begin( ), sensor_names.end( ), "lo_locked" ) != sensor_names.end( ) ) - { - std::cout << std::endl << "-- Found a local oscillator" << std::endl; + if ( std::find( sensor_names.begin(), sensor_names.end(), + "lo_locked" ) != sensor_names.end() ) { + std::cout << std::endl + << "-- Found a local oscillator" << std::endl; int lock_attempts = 0; - do - { + do { if ( lock_attempts++ > 3 ) // Abort after three attempts { std::cout << "Unable to lock local oscillator" << std::endl; @@ -131,20 +118,22 @@ void UHD::start( const std::shared_ptr> &queue ) // Allow the front end time to settle std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); - } - while ( not dev_->get_rx_sensor( "lo_locked" ).to_bool( ) ); + } while ( not dev_->get_rx_sensor( "lo_locked" ).to_bool() ); std::cout << "-- Local oscillator locked" << std::endl << std::endl; } - // Specify that we want to receive samples as a pair of 16 bit complex foats + // Specify that we want to receive samples as a pair of 16 bit complex + // foats uhd::stream_args_t stream_args( "fc32" ); // Create a receive stream uhd::rx_streamer::sptr rx_stream = dev_->get_rx_stream( stream_args ); - // Create a stream command that will start immediately and run continuously - uhd::stream_cmd_t stream_cmd_start( uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS ); + // Create a stream command that will start immediately and run + // continuously + uhd::stream_cmd_t stream_cmd_start( + uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS ); stream_cmd_start.stream_now = true; @@ -155,88 +144,64 @@ void UHD::start( const std::shared_ptr> &queue ) uhd::rx_metadata_t md; // Create an internal buffer to hold received samples - std::vector> buff( rx_stream->get_max_num_samps( ) * 2 ); + std::vector> buff( rx_stream->get_max_num_samps() * + 2 ); - while ( running ) - { + while ( running ) { // Read samples from the device and into our buffer - size_t num_rx_samps = rx_stream->recv( &buff.front( ), buff.size( ), md ); + size_t num_rx_samps = + rx_stream->recv( &buff.front(), buff.size(), md ); // Handle any error codes we receive - switch ( md.error_code ) - { - case uhd::rx_metadata_t::ERROR_CODE_NONE: - break; - - case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: - if ( num_acc_samps == 0 ) - continue; + switch ( md.error_code ) { + case uhd::rx_metadata_t::ERROR_CODE_NONE: + break; - std::cerr << "Timeout before all samples received, possible packet loss" << std::endl; + case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: + if ( num_acc_samps == 0 ) + continue; - goto done_loop; + std::cerr << "Timeout before all samples received, possible " + "packet loss" + << std::endl; + goto done_loop; - case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: - if ( md.out_of_sequence == true ) - std::cerr << "Samples out of sequence" << std::endl; - else - std::cerr << "Sample buffer overflow. Try reducing the sample rate." << std::endl; + case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: + if ( md.out_of_sequence == true ) + std::cerr << "Samples out of sequence" << std::endl; + else + std::cerr << "Sample buffer overflow. If this persists, " + "try reducing the sample rate." + << std::endl; + num_rx_samps = 0; - goto done_loop; + continue; - default: - std::cerr << "Received error code " << md.error_code << std::endl; - std::cerr << "flags " << md.out_of_sequence << std::endl; - goto done_loop; + default: + std::cerr << "Received error code " << md.error_code + << std::endl; + std::cerr << "flags " << md.out_of_sequence << std::endl; + goto done_loop; } - // Copies samples from our internal buffer into the application's queue - transfer_buffer( buff, num_rx_samps ); - -#ifdef HANDLEIT - // HANDLE - - // Expect multiple of 2 - ASSERT( ( num_rx_samps & 0x2 ) == 0 ); - + // The receiving queue is expecting a number of samples evenly + // divisible by four if ( num_rx_samps % 4 != 0 ) - { - std::cout << "not div by four " << num_rx_samps << std::endl; continue; - } - // Grab buffer from queue - auto out = queue_->popForWrite( ); - - out->resize( num_rx_samps ); - - std::complex *p = out->data( ); - for ( int i = 0; i < int( num_rx_samps ); i++ ) - { - p[i] = buff[i]; - - // std::cout << "count " << num_rx_samps << std::endl; - } - - // Publish output if applicable - if ( samplePublisher_ ) - { - samplePublisher_->publish( *out ); - } - - // Return buffer to queue - queue_->pushWrite( std::move( out ) ); + // Copies samples from our internal buffer into the application's + // queue + transfer_buffer( buff, num_rx_samps ); - // HANDLE -#endif // Increment the accumulated sample count num_acc_samps += num_rx_samps; } done_loop: // setup streaming - uhd::stream_cmd_t stream_cmd_stop( uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS ); + uhd::stream_cmd_t stream_cmd_stop( + uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS ); // stream_cmd.stream_now = true; @@ -251,49 +216,45 @@ void UHD::start( const std::shared_ptr> &queue ) #ifdef __APPLE__ pthread_setname_np( "uhd" ); #else - pthread_setname_np( thread_.native_handle( ), "uhd" ); + pthread_setname_np( thread_.native_handle(), "uhd" ); #endif } -void UHD::stop( ) -{ +void UHD::stop() { ASSERT( dev_ != nullptr ); // Causes the sample streaming loop to exit running = false; // Wait for thread to terminate - thread_.join( ); + thread_.join(); // Close queue to signal downstream - queue_->close( ); + queue_->close(); // Clear reference to queue - queue_.reset( ); + queue_.reset(); } // Copies samples from our internal buffer into the application's queue -void UHD::transfer_buffer( std::vector> transfer, size_t num_rx_samps ) -{ +void UHD::transfer_buffer( std::vector> transfer, + size_t num_rx_samps ) { // Expect multiple of 2 ASSERT( ( num_rx_samps & 0x2 ) == 0 ); // Grab buffer from queue - auto out = queue_->popForWrite( ); + auto out = queue_->popForWrite(); out->resize( num_rx_samps ); - std::complex *p = out->data( ); + std::complex *p = out->data(); - for ( int i = 0; i < int( num_rx_samps ); i++ ) - { - // std::cout << "real " << real( transfer[i] ) << " imag " << imag( transfer[i] ) << std::endl; + for ( int i = 0; i < int( num_rx_samps ); i++ ) { p[i] = transfer[i]; } // Publish output if applicable - if ( samplePublisher_ ) - { + if ( samplePublisher_ ) { samplePublisher_->publish( *out ); } diff --git a/src/goesrecv/uhd_source.h b/src/goesrecv/uhd_source.h index 46f54391..c2bde7a4 100644 --- a/src/goesrecv/uhd_source.h +++ b/src/goesrecv/uhd_source.h @@ -1,17 +1,13 @@ #pragma once #include - #include #include #include - #include #include #include #include - - #include "source.h" class UHD : public Source From 80d192c94ae6e50f446b8e1d11e8eb9b42d4c8d4 Mon Sep 17 00:00:00 2001 From: codient <59000880+codient@users.noreply.github.com> Date: Wed, 18 Dec 2019 22:26:28 -0500 Subject: [PATCH 05/10] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 95183e1c..57ae0adc 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,16 @@ Bundled dependencies: * libcorrect (currently a fork with CMake related fixes) * libaec +Ettus Research USRP dependencies (required when building USRP support) + +* libuhd-dev +* libuhd003.010.003 +* libboost + ## Build ``` shell -git clone https://github.com/pietern/goestools +git clone --recursive https://github.com/codient/goestools cd goestools mkdir -p build cd build From d03ba3c617590ed688042ff0fc57a47d91033965 Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Thu, 19 Dec 2019 15:56:30 -0500 Subject: [PATCH 06/10] clang formatting changes to better match the original project --- etc/goesrecv-uhd.conf | 2 +- src/goesrecv/uhd_source.cc | 116 ++++++++++++++++++------------------- src/goesrecv/uhd_source.h | 72 +++++++++++------------ 3 files changed, 94 insertions(+), 96 deletions(-) diff --git a/etc/goesrecv-uhd.conf b/etc/goesrecv-uhd.conf index 07dcb6ab..5f44bcb6 100644 --- a/etc/goesrecv-uhd.conf +++ b/etc/goesrecv-uhd.conf @@ -11,7 +11,7 @@ bias_tee = false [uhd] type = "b200" frequency = 1694100000 -sample_rate = 8000000 +sample_rate = 4000000 gain = 32 [costas] diff --git a/src/goesrecv/uhd_source.cc b/src/goesrecv/uhd_source.cc index 17aea5d3..d9fda5c5 100644 --- a/src/goesrecv/uhd_source.cc +++ b/src/goesrecv/uhd_source.cc @@ -12,11 +12,11 @@ #include #include -std::unique_ptr UHD::open( std::string type ) { +std::unique_ptr UHD::open(std::string type) { std::string args = ""; // Filter to a device type if one was specified - if ( not type.empty() ) { + if (not type.empty()) { args = "type=" + type; } @@ -26,25 +26,25 @@ std::unique_ptr UHD::open( std::string type ) { // Create a USRP device uhd::usrp::multi_usrp::sptr dev = nullptr; - UHD_SAFE_CALL( dev = uhd::usrp::multi_usrp::make( args ); ) + UHD_SAFE_CALL(dev = uhd::usrp::multi_usrp::make(args);) // Abort if we didn't open a device - if ( dev == nullptr ) { + if (dev == nullptr) { std::cout << "Unable to open UHD device. " << std::endl; - exit( 1 ); + exit(1); } std::cout << std::endl << "Using Device " << dev->get_pp_string() << std::endl; // Select the internal clock source - dev->set_clock_source( "internal" ); + dev->set_clock_source("internal"); - return std::make_unique( dev ); + return std::make_unique(dev); } -UHD::UHD( uhd::usrp::multi_usrp::sptr dev ) : dev_( dev ) { +UHD::UHD(uhd::usrp::multi_usrp::sptr dev) : dev_(dev) { // Perform necessary constructor operations here } @@ -52,42 +52,42 @@ UHD::~UHD() { // Perform necessary destructor operations here } -void UHD::setFrequency( uint32_t freq ) { - ASSERT( dev_ != nullptr ); +void UHD::setFrequency(uint32_t freq) { + ASSERT(dev_ != nullptr); - uhd::tune_request_t tune_request( freq ); + uhd::tune_request_t tune_request(freq); - dev_->set_rx_freq( tune_request ); + dev_->set_rx_freq(tune_request); } -void UHD::setSampleRate( uint32_t rate ) { - ASSERT( dev_ != nullptr ); +void UHD::setSampleRate(uint32_t rate) { + ASSERT(dev_ != nullptr); - dev_->set_rx_rate( rate ); + dev_->set_rx_rate(rate); // Set the bandwidth to match the sample rate - dev_->set_rx_bandwidth( rate ); + dev_->set_rx_bandwidth(rate); } uint32_t UHD::getSampleRate() const { - ASSERT( dev_ != nullptr ); + ASSERT(dev_ != nullptr); return dev_->get_rx_rate(); } -void UHD::setGain( int gain ) { - ASSERT( dev_ != nullptr ); +void UHD::setGain(int gain) { + ASSERT(dev_ != nullptr); - dev_->set_rx_gain( gain ); + dev_->set_rx_gain(gain); } -void UHD::start( const std::shared_ptr> &queue ) { - ASSERT( dev_ != nullptr ); +void UHD::start(const std::shared_ptr> &queue) { + ASSERT(dev_ != nullptr); // This is the application's sample queue queue_ = queue; - thread_ = std::thread( [&] { + thread_ = std::thread([&] { // The streamming loop continues to run as long as this is true running = true; @@ -95,70 +95,70 @@ void UHD::start( const std::shared_ptr> &queue ) { size_t num_acc_samps = 0; // Set the antenana for receiving our signal - dev_->set_rx_antenna( "TX/RX" ); + dev_->set_rx_antenna("TX/RX"); // Check sensors for a local oscillator - std::vector sensor_names = dev_->get_rx_sensor_names( 0 ); + std::vector sensor_names = dev_->get_rx_sensor_names(0); // If a local oscillator exists, make sure it's locked - if ( std::find( sensor_names.begin(), sensor_names.end(), - "lo_locked" ) != sensor_names.end() ) { + if (std::find(sensor_names.begin(), sensor_names.end(), "lo_locked") != + sensor_names.end()) { std::cout << std::endl << "-- Found a local oscillator" << std::endl; int lock_attempts = 0; do { - if ( lock_attempts++ > 3 ) // Abort after three attempts + if (lock_attempts++ > 3) // Abort after three attempts { std::cout << "Unable to lock local oscillator" << std::endl; - exit( 1 ); + exit(1); } // Allow the front end time to settle - std::this_thread::sleep_for( std::chrono::seconds( 1 ) ); - } while ( not dev_->get_rx_sensor( "lo_locked" ).to_bool() ); + std::this_thread::sleep_for(std::chrono::seconds(1)); + } while (not dev_->get_rx_sensor("lo_locked").to_bool()); std::cout << "-- Local oscillator locked" << std::endl << std::endl; } // Specify that we want to receive samples as a pair of 16 bit complex // foats - uhd::stream_args_t stream_args( "fc32" ); + uhd::stream_args_t stream_args("fc32"); // Create a receive stream - uhd::rx_streamer::sptr rx_stream = dev_->get_rx_stream( stream_args ); + uhd::rx_streamer::sptr rx_stream = dev_->get_rx_stream(stream_args); // Create a stream command that will start immediately and run // continuously uhd::stream_cmd_t stream_cmd_start( - uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS ); + uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS); stream_cmd_start.stream_now = true; // Start streaming - rx_stream->issue_stream_cmd( stream_cmd_start ); + rx_stream->issue_stream_cmd(stream_cmd_start); // Holds stream metadata, such as error codes uhd::rx_metadata_t md; // Create an internal buffer to hold received samples - std::vector> buff( rx_stream->get_max_num_samps() * - 2 ); + std::vector> buff(rx_stream->get_max_num_samps() * + 2); - while ( running ) { + while (running) { // Read samples from the device and into our buffer size_t num_rx_samps = - rx_stream->recv( &buff.front(), buff.size(), md ); + rx_stream->recv(&buff.front(), buff.size(), md); // Handle any error codes we receive - switch ( md.error_code ) { + switch (md.error_code) { case uhd::rx_metadata_t::ERROR_CODE_NONE: break; case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: - if ( num_acc_samps == 0 ) + if (num_acc_samps == 0) continue; std::cerr << "Timeout before all samples received, possible " @@ -168,7 +168,7 @@ void UHD::start( const std::shared_ptr> &queue ) { goto done_loop; case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW: - if ( md.out_of_sequence == true ) + if (md.out_of_sequence == true) std::cerr << "Samples out of sequence" << std::endl; else std::cerr << "Sample buffer overflow. If this persists, " @@ -187,12 +187,12 @@ void UHD::start( const std::shared_ptr> &queue ) { // The receiving queue is expecting a number of samples evenly // divisible by four - if ( num_rx_samps % 4 != 0 ) + if (num_rx_samps % 4 != 0) continue; // Copies samples from our internal buffer into the application's // queue - transfer_buffer( buff, num_rx_samps ); + transfer_buffer(buff, num_rx_samps); // Increment the accumulated sample count num_acc_samps += num_rx_samps; @@ -201,27 +201,27 @@ void UHD::start( const std::shared_ptr> &queue ) { // setup streaming uhd::stream_cmd_t stream_cmd_stop( - uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS ); + uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS); // stream_cmd.stream_now = true; - rx_stream->issue_stream_cmd( stream_cmd_stop ); + rx_stream->issue_stream_cmd(stream_cmd_stop); // finished std::cout << std::endl << "Streaming ended" << std::endl << std::endl; return EXIT_SUCCESS; - } ); + }); #ifdef __APPLE__ - pthread_setname_np( "uhd" ); + pthread_setname_np("uhd"); #else - pthread_setname_np( thread_.native_handle(), "uhd" ); + pthread_setname_np(thread_.native_handle(), "uhd"); #endif } void UHD::stop() { - ASSERT( dev_ != nullptr ); + ASSERT(dev_ != nullptr); // Causes the sample streaming loop to exit running = false; @@ -237,27 +237,27 @@ void UHD::stop() { } // Copies samples from our internal buffer into the application's queue -void UHD::transfer_buffer( std::vector> transfer, - size_t num_rx_samps ) { +void UHD::transfer_buffer(std::vector> transfer, + size_t num_rx_samps) { // Expect multiple of 2 - ASSERT( ( num_rx_samps & 0x2 ) == 0 ); + ASSERT((num_rx_samps & 0x2) == 0); // Grab buffer from queue auto out = queue_->popForWrite(); - out->resize( num_rx_samps ); + out->resize(num_rx_samps); std::complex *p = out->data(); - for ( int i = 0; i < int( num_rx_samps ); i++ ) { + for (int i = 0; i < int(num_rx_samps); i++) { p[i] = transfer[i]; } // Publish output if applicable - if ( samplePublisher_ ) { - samplePublisher_->publish( *out ); + if (samplePublisher_) { + samplePublisher_->publish(*out); } // Return buffer to queue - queue_->pushWrite( std::move( out ) ); + queue_->pushWrite(std::move(out)); } diff --git a/src/goesrecv/uhd_source.h b/src/goesrecv/uhd_source.h index c2bde7a4..1447da45 100644 --- a/src/goesrecv/uhd_source.h +++ b/src/goesrecv/uhd_source.h @@ -1,62 +1,60 @@ #pragma once -#include +#include "source.h" #include +#include #include -#include #include #include #include #include -#include "source.h" - -class UHD : public Source -{ - public: - static std::unique_ptr open( std::string type ); +#include - explicit UHD( uhd::usrp::multi_usrp::sptr dev ); +class UHD : public Source { + public: + static std::unique_ptr open(std::string type); - ~UHD( ); + explicit UHD(uhd::usrp::multi_usrp::sptr dev); - void setFrequency( uint32_t freq ); + ~UHD(); - // Also sets the bandwidth to match - void setSampleRate( uint32_t rate ); + void setFrequency(uint32_t freq); - // Reads the current sample rate setting from the device - virtual uint32_t getSampleRate( ) const override; + // Also sets the bandwidth to match + void setSampleRate(uint32_t rate); - void setGain( int gain ); + // Reads the current sample rate setting from the device + virtual uint32_t getSampleRate() const override; - void setSamplePublisher( std::unique_ptr samplePublisher ) - { - samplePublisher_ = std::move( samplePublisher ); - } + void setGain(int gain); - // Starts the sample streaming loop - virtual void start( const std::shared_ptr> &queue ) override; + void setSamplePublisher(std::unique_ptr samplePublisher) { + samplePublisher_ = std::move(samplePublisher); + } - // Stops the sample streaming loop - virtual void stop( ) override; + // Starts the sample streaming loop + virtual void start(const std::shared_ptr> &queue) override; - protected: + // Stops the sample streaming loop + virtual void stop() override; - // When set to false the sample streaming loop exits - bool running; + protected: + // When set to false the sample streaming loop exits + bool running; - // A reference to the device - uhd::usrp::multi_usrp::sptr dev_; + // A reference to the device + uhd::usrp::multi_usrp::sptr dev_; - // Background RX thread - std::thread thread_; + // Background RX thread + std::thread thread_; - // Copies samples from our internal buffer into the application's queue - virtual void transfer_buffer( std::vector> transfer, size_t num_rx_samps ); + // Copies samples from our internal buffer into the application's queue + virtual void transfer_buffer(std::vector> transfer, + size_t num_rx_samps); - // Set on start; cleared on stop - std::shared_ptr > queue_; + // Set on start; cleared on stop + std::shared_ptr> queue_; - // Optional publisher for samples - std::unique_ptr samplePublisher_; + // Optional publisher for samples + std::unique_ptr samplePublisher_; }; From 573fd0f9327dcce74dd091bc23714809f9e00b9f Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Wed, 1 Jan 2020 16:57:33 -0500 Subject: [PATCH 07/10] Corrected samplePublisher for UHD --- src/goesrecv/source.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/goesrecv/source.cc b/src/goesrecv/source.cc index 5b72b3f3..a148b5d5 100644 --- a/src/goesrecv/source.cc +++ b/src/goesrecv/source.cc @@ -35,7 +35,7 @@ std::unique_ptr Source::build( uhd->setFrequency(config.uhd.frequency); uhd->setGain(config.uhd.gain); - uhd->setSamplePublisher(std::move(config.airspy.samplePublisher)); + uhd->setSamplePublisher(std::move(config.uhd.samplePublisher)); return std::unique_ptr(uhd.release()); #else From 62673226a8c2e7cc0b407803b2495d727e0c7c47 Mon Sep 17 00:00:00 2001 From: codient <59000880+codient@users.noreply.github.com> Date: Thu, 2 Jan 2020 18:33:10 -0500 Subject: [PATCH 08/10] Update README.md Modified USRP dependencies --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 57ae0adc..7118af72 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,7 @@ Bundled dependencies: Ettus Research USRP dependencies (required when building USRP support) -* libuhd-dev -* libuhd003.010.003 +* libuhd * libboost ## Build From 1013d95a1a236b82b90a5ec5f7b20b15aa783a2e Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Tue, 21 Apr 2020 22:32:52 -0400 Subject: [PATCH 09/10] Fixed a typo in a comment --- src/goesrecv/uhd_source.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/goesrecv/uhd_source.cc b/src/goesrecv/uhd_source.cc index d9fda5c5..f7d3d36f 100644 --- a/src/goesrecv/uhd_source.cc +++ b/src/goesrecv/uhd_source.cc @@ -124,7 +124,7 @@ void UHD::start(const std::shared_ptr> &queue) { } // Specify that we want to receive samples as a pair of 16 bit complex - // foats + // floats uhd::stream_args_t stream_args("fc32"); // Create a receive stream From 737d8126cb724fc13cce7b0a8f1c09670e79198f Mon Sep 17 00:00:00 2001 From: Jim Herbert Date: Fri, 24 Apr 2020 21:23:22 -0400 Subject: [PATCH 10/10] Remove assert on unknown keys in ancillary text processing --- src/goesproc/handler_goesr.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/goesproc/handler_goesr.cc b/src/goesproc/handler_goesr.cc index e9d25620..dfedca73 100644 --- a/src/goesproc/handler_goesr.cc +++ b/src/goesproc/handler_goesr.cc @@ -135,7 +135,13 @@ GOESRProduct::GOESRProduct(const std::shared_ptr& f) continue; } - FAILM("Unhandled key in ancillary text \"", key, "\""); + // New keys were added to this map which tripped this assert. + // Started happening on Apr 2, 2020. If these contain useful + // information, we can choose to properly process them at a + // later point in time. Until then, ignore them. + // + // FAILM("Unhandled key in ancillary text \"", key, "\""); + // } // The product name is encoded in the file name only. @@ -594,3 +600,4 @@ void GOESRImageHandler::overlayMaps(const GOESRProduct& product, cv::Mat& mat) { mat = drawer.draw(mat); #endif } +