1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Merge branch 'detect-gr' of https://github.com/carlesfernandez/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-04-27 18:10:19 +02:00
commit 9121ca95bb
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
16 changed files with 53 additions and 71 deletions

View File

@ -695,7 +695,7 @@ endif()
################################################################################
# GNU Radio - https://gnuradio.org
################################################################################
set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS FFT FILTER PMT)
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
find_package(UHD)
set_package_properties(UHD PROPERTIES
@ -719,10 +719,10 @@ set_package_properties(GNURADIO PROPERTIES
PURPOSE "Implements flowgraph scheduler, provides some processing blocks and classes to create new ones."
TYPE REQUIRED
)
if(PC_GNURADIO_RUNTIME_VERSION)
if(PC_GNURADIO_RUNTIME_VERSION VERSION_LESS ${GNSSSDR_GNURADIO_MIN_VERSION})
if(GNURADIO_VERSION)
if(GNURADIO_VERSION VERSION_LESS ${GNSSSDR_GNURADIO_MIN_VERSION})
unset(GNURADIO_RUNTIME_FOUND)
message(STATUS "The GNU Radio version installed in your system is too old.")
message(STATUS "The GNU Radio version installed in your system (v${GNURADIO_VERSION}) is too old.")
endif()
endif()
if(NOT GNURADIO_RUNTIME_FOUND)
@ -730,15 +730,14 @@ if(NOT GNURADIO_RUNTIME_FOUND)
if(OS_IS_LINUX)
message("Go to https://github.com/gnuradio/pybombs")
message("and follow the instructions to install GNU Radio in your system.")
message(FATAL_ERROR "GNU Radio ${GNSSSDR_GNURADIO_MIN_VERSION} or later is required to build gnss-sdr")
endif()
if(OS_IS_MACOSX)
message("You can install it easily via Macports:")
message(" sudo port install gnuradio ")
message("Alternatively, you can use homebrew:")
message(" brew install gnuradio")
message(FATAL_ERROR "GNU Radio ${GNSSSDR_GNURADIO_MIN_VERSION} or later is required to build gnss-sdr")
endif()
message(FATAL_ERROR "GNU Radio v${GNSSSDR_GNURADIO_MIN_VERSION} or later is required to build gnss-sdr.")
else()
if(NOT TARGET Gnuradio::runtime)
add_library(Gnuradio::runtime SHARED IMPORTED)
@ -1818,7 +1817,7 @@ endif()
find_package(Protobuf)
set_package_properties(Protobuf PROPERTIES
URL "https://developers.google.com/protocol-buffers/"
DESCRIPTION "A language-neutral, platform-neutral extensible mechanism for serializing structured data"
DESCRIPTION "Structured data serialization mechanism"
PURPOSE "Used to serialize output data in a way that can be read by other applications."
TYPE REQUIRED
)

View File

@ -24,7 +24,7 @@ include(FindPackageHandleStandardArgs)
# if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list
if(NOT GR_REQUIRED_COMPONENTS)
set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG BLOCKS DIGITAL FFT FILTER PMT FEC TRELLIS UHD)
set(GR_REQUIRED_COMPONENTS RUNTIME PMT BLOCKS FFT FILTER ANALOG)
endif()
# Allows us to use all .cmake files in this directory
@ -43,9 +43,6 @@ macro(LIST_CONTAINS var value)
endforeach()
endmacro()
# Trick for feature_summary
set(GNURADIO_FOUND TRUE)
function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE)
list_contains(REQUIRED_MODULE ${EXTVAR} ${GR_REQUIRED_COMPONENTS})
if(NOT REQUIRED_MODULE)
@ -150,24 +147,21 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE)
endfunction()
gr_module(RUNTIME gnuradio-runtime gnuradio/top_block.h gnuradio-runtime)
gr_module(ANALOG gnuradio-analog gnuradio/analog/api.h gnuradio-analog)
gr_module(AUDIO gnuradio-audio gnuradio/audio/api.h gnuradio-audio)
gr_module(PMT gnuradio-runtime pmt/pmt.h gnuradio-pmt)
gr_module(BLOCKS gnuradio-blocks gnuradio/blocks/api.h gnuradio-blocks)
gr_module(CHANNELS gnuradio-channels gnuradio/channels/api.h gnuradio-channels)
gr_module(DIGITAL gnuradio-digital gnuradio/digital/api.h gnuradio-digital)
gr_module(FCD gnuradio-fcd gnuradio/fcd_api.h gnuradio-fcd)
gr_module(FEC gnuradio-fec gnuradio/fec/api.h gnuradio-fec)
gr_module(FFT gnuradio-fft gnuradio/fft/api.h gnuradio-fft)
gr_module(FILTER gnuradio-filter gnuradio/filter/api.h gnuradio-filter)
gr_module(NOAA gnuradio-noaa gnuradio/noaa/api.h gnuradio-noaa)
gr_module(PAGER gnuradio-pager gnuradio/pager/api.h gnuradio-pager)
gr_module(ANALOG gnuradio-analog gnuradio/analog/api.h gnuradio-analog)
gr_module(DIGITAL gnuradio-digital gnuradio/digital/api.h gnuradio-digital)
gr_module(AUDIO gnuradio-audio gnuradio/audio/api.h gnuradio-audio)
gr_module(CHANNELS gnuradio-channels gnuradio/channels/api.h gnuradio-channels)
gr_module(QTGUI gnuradio-qtgui gnuradio/qtgui/api.h gnuradio-qtgui)
gr_module(TRELLIS gnuradio-trellis gnuradio/trellis/api.h gnuradio-trellis)
gr_module(UHD gnuradio-uhd gnuradio/uhd/api.h gnuradio-uhd)
gr_module(VOCODER gnuradio-vocoder gnuradio/vocoder/api.h gnuradio-vocoder)
gr_module(WAVELET gnuradio-wavelet gnuradio/wavelet/api.h gnuradio-wavelet)
gr_module(WXGUI gnuradio-wxgui gnuradio/wxgui/api.h gnuradio-wxgui)
gr_module(PMT gnuradio-runtime pmt/pmt.h gnuradio-pmt)
list(REMOVE_DUPLICATES GNURADIO_ALL_INCLUDE_DIRS)
list(REMOVE_DUPLICATES GNURADIO_ALL_LIBRARIES)
@ -206,4 +200,7 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION)
endif()
# Trick for feature_summary
set(GNURADIO_FOUND TRUE)
if(NOT DEFINED GNURADIO_FOUND)
set(GNURADIO_FOUND TRUE)
endif()
set(GNURADIO_VERSION ${PC_GNURADIO_RUNTIME_VERSION})

View File

@ -148,7 +148,6 @@ bool Rtklib_Solver::save_matfile()
sizeof(uint8_t) * number_of_uint8_vars +
sizeof(float) * number_of_float_vars;
std::ifstream dump_file;
std::cout << "Generating .mat file for " << dump_filename << std::endl;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
@ -163,6 +162,7 @@ bool Rtklib_Solver::save_matfile()
int64_t num_epoch = 0LL;
if (dump_file.is_open())
{
std::cout << "Generating .mat file for " << dump_filename << std::endl;
size = dump_file.tellg();
num_epoch = static_cast<int64_t>(size) / static_cast<int64_t>(epoch_size_bytes);
dump_file.seekg(0, std::ios::beg);

View File

@ -38,10 +38,9 @@
#include "tracking_interface.h"
#include <glog/logging.h>
#include <cstring> // for memcpy
#include <utility>
#include <utility> // for std::move
// Constructor
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
std::string role, std::string implementation, gr::msg_queue::sptr queue)
@ -120,7 +119,6 @@ Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::s
}
// Destructor
Channel::~Channel() = default;
@ -133,8 +131,9 @@ void Channel::connect(gr::top_block_sptr top_block)
trk_->connect(top_block);
nav_->connect(top_block);
//Synchronous ports
// Synchronous ports
top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0);
// Message ports
top_block->msg_connect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk"));
DLOG(INFO) << "tracking -> telemetry_decoder";

View File

@ -34,6 +34,7 @@
#ifndef GNSS_SDR_CHANNEL_H_
#define GNSS_SDR_CHANNEL_H_
#include "channel_fsm.h"
#include "channel_interface.h"
#include "channel_msg_receiver_cc.h"
@ -51,7 +52,7 @@ class ConfigurationInterface;
class AcquisitionInterface;
class TrackingInterface;
class TelemetryDecoderInterface;
//class ChannelFsm;
/*!
* \brief This class represents a GNSS channel. It wraps an AcquisitionInterface,
@ -66,8 +67,8 @@ public:
Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
std::string role, std::string implementation, gr::msg_queue::sptr queue);
//! Virtual destructor
virtual ~Channel();
virtual ~Channel(); //!< Virtual destructor
void connect(gr::top_block_sptr top_block) override; //!< connects the tracking block to the top_block and to the telemetry
void disconnect(gr::top_block_sptr top_block) override;
@ -108,4 +109,4 @@ private:
std::mutex mx;
};
#endif /*GNSS_SDR_CHANNEL_H_*/
#endif // GNSS_SDR_CHANNEL_H_

View File

@ -62,7 +62,7 @@ target_include_directories(input_filter_adapters
${CMAKE_SOURCE_DIR}/src/core/interfaces
)
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.20")
if(NOT (GNURADIO_VERSION VERSION_LESS "3.8"))
target_compile_definitions(input_filter_adapters PUBLIC -DGR_GREATER_38=1)
endif()

View File

@ -52,7 +52,7 @@ target_include_directories(resampler_adapters
${CMAKE_SOURCE_DIR}/src/core/interfaces
)
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.20")
if(NOT (GNURADIO_VERSION VERSION_LESS "3.8"))
target_compile_definitions(resampler_adapters PUBLIC -DGR_GREATER_38=1)
endif()

View File

@ -135,6 +135,8 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES
spir_gss6450_file_signal_source.cc
rtl_tcp_signal_source.cc
labsat_signal_source.cc
two_bit_cpx_file_signal_source.cc
two_bit_packed_file_signal_source.cc
${OPT_DRIVER_SOURCES}
)
@ -146,20 +148,11 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS
spir_gss6450_file_signal_source.h
rtl_tcp_signal_source.h
labsat_signal_source.h
two_bit_cpx_file_signal_source.h
two_bit_packed_file_signal_source.h
${OPT_DRIVER_HEADERS}
)
if(PC_GNURADIO_RUNTIME_VERSION VERSION_GREATER 3.7.3)
set(SIGNAL_SOURCE_ADAPTER_SOURCES ${SIGNAL_SOURCE_ADAPTER_SOURCES}
two_bit_cpx_file_signal_source.cc
two_bit_packed_file_signal_source.cc
)
set(SIGNAL_SOURCE_ADAPTER_HEADERS ${SIGNAL_SOURCE_ADAPTER_HEADERS}
two_bit_cpx_file_signal_source.h
two_bit_packed_file_signal_source.h
)
endif()
list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
list(SORT SIGNAL_SOURCE_ADAPTER_SOURCES)

View File

@ -35,11 +35,12 @@
#include <exception>
#include <iostream>
#include <sstream>
#include <utility>
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, gr::msg_queue::sptr queue)
{
return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, queue));
return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, std::move(queue)));
}
@ -48,7 +49,7 @@ labsat23_source::labsat23_source(const char *signal_file_basename,
gr::msg_queue::sptr queue) : gr::block("labsat23_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_queue(queue)
d_queue(std::move(queue))
{
if (channel_selector < 1 or channel_selector > 2)
{

View File

@ -83,8 +83,7 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
// preamble bits to sampled symbols
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_frame_length_symbols = GPS_SUBFRAME_BITS * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT;
d_max_symbols_without_valid_frame = d_required_symbols * 10; //rise alarm 1 minute without valid tlm
d_page_part_symbols = static_cast<double *>(volk_gnsssdr_malloc(d_frame_length_symbols * sizeof(double), volk_gnsssdr_get_alignment()));
d_max_symbols_without_valid_frame = d_required_symbols * 10; // rise alarm 1 minute without valid tlm
int32_t n = 0;
for (int32_t i = 0; i < d_bits_per_preamble; i++)
{
@ -127,7 +126,6 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs(
gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
{
volk_gnsssdr_free(d_preamble_samples);
volk_gnsssdr_free(d_page_part_symbols);
if (d_dump_file.is_open() == true)
{
try
@ -285,7 +283,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
// NEW GPS SUBFRAME HAS ARRIVED!
if (subframe_synchro_confirmation)
{
int32_t subframe_ID = d_nav.subframe_decoder(subframe); //decode the subframe
int32_t subframe_ID = d_nav.subframe_decoder(subframe); // decode the subframe
if (subframe_ID > 0 and subframe_ID < 6)
{
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "
@ -377,7 +375,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
{
case 0: // no preamble information
{
//correlate with preamble
// correlate with preamble
int32_t corr_value = 0;
if (d_symbol_history.size() >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
{
@ -405,7 +403,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
}
case 1: // possible preamble lock
{
//correlate with preamble
// correlate with preamble
int32_t corr_value = 0;
int32_t preamble_diff = 0;
if (d_symbol_history.size() >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS)

View File

@ -62,6 +62,7 @@ public:
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
void set_channel(int channel); //!< Set receiver's channel
void reset();
/*!
* \brief This is where all signal processing takes place
*/
@ -76,15 +77,14 @@ private:
bool gps_word_parityCheck(uint32_t gpsword);
bool decode_subframe();
// new
int32_t d_bits_per_preamble;
int32_t d_samples_per_preamble;
int32_t d_preamble_period_symbols;
int32_t *d_preamble_samples;
uint32_t d_required_symbols;
uint32_t d_frame_length_symbols;
double *d_page_part_symbols;
bool flag_PLL_180_deg_phase_locked;
// navigation message vars
Gps_Navigation_Message d_nav;
uint32_t d_prev_GPS_frame_4bytes;
@ -103,7 +103,6 @@ private:
bool d_flag_preamble;
int32_t d_CRC_error_counter;
Gnss_Satellite d_satellite;
int32_t d_channel;

View File

@ -100,8 +100,8 @@ void Exponential_Smoother::set_min_value(float value)
double Exponential_Smoother::smooth(double raw)
{
float raw_f = static_cast<float>(raw);
double smooth_d = static_cast<double>((this)->smooth(raw_f));
auto raw_f = static_cast<float>(raw);
auto smooth_d = static_cast<double>((this)->smooth(raw_f));
return smooth_d;
}
@ -116,7 +116,7 @@ float Exponential_Smoother::smooth(float raw)
init_buffer_.push_back(smoothed_value);
if (init_counter_ == samples_for_initialization_)
{
old_value_ = std::accumulate(std::begin(init_buffer_), std::end(init_buffer_), 0.0f) / static_cast<float>(init_buffer_.size());
old_value_ = std::accumulate(std::cbegin(init_buffer_), std::cend(init_buffer_), 0.0F) / static_cast<float>(init_buffer_.size());
if (old_value_ < (min_value_ + offset_))
{
// flush buffer and start again

View File

@ -80,11 +80,7 @@ if(ENABLE_RAW_UDP)
target_compile_definitions(core_receiver PRIVATE -DRAW_UDP=1)
endif()
if(PC_GNURADIO_RUNTIME_VERSION VERSION_GREATER 3.7.3)
target_compile_definitions(core_receiver PRIVATE -DMODERN_GNURADIO=1)
endif()
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.20")
if(NOT (GNURADIO_VERSION VERSION_LESS "3.8"))
target_compile_definitions(core_receiver PRIVATE -DGR_GREATER_38=1)
endif()

View File

@ -1299,7 +1299,6 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
exit(1);
}
}
#if MODERN_GNURADIO
else if (implementation == "Two_Bit_Cpx_File_Signal_Source")
{
try
@ -1328,7 +1327,6 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
exit(1);
}
}
#endif
else if (implementation == "Spir_File_Signal_Source")
{
try

View File

@ -57,19 +57,20 @@ class GNSSBlockFactory
public:
GNSSBlockFactory();
virtual ~GNSSBlockFactory();
std::unique_ptr<GNSSBlockInterface> GetSignalSource(const std::shared_ptr<ConfigurationInterface>& configuration,
const gr::msg_queue::sptr queue, int ID = -1); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(const std::shared_ptr<ConfigurationInterface>& configuration, int ID = -1);
std::unique_ptr<GNSSBlockInterface> GetPVT(const std::shared_ptr<ConfigurationInterface>& configuration);
std::unique_ptr<GNSSBlockInterface> GetObservables(const std::shared_ptr<ConfigurationInterface>& configuration);
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(const std::shared_ptr<ConfigurationInterface>& configuration,
const gr::msg_queue::sptr queue); // NOLINT(performance-unnecessary-value-param)
/*
std::unique_ptr<GNSSBlockInterface> GetObservables(const std::shared_ptr<ConfigurationInterface>& configuration);
std::unique_ptr<GNSSBlockInterface> GetPVT(const std::shared_ptr<ConfigurationInterface>& configuration);
/*!
* \brief Returns the block with the required configuration and implementation
*/
std::unique_ptr<GNSSBlockInterface> GetBlock(const std::shared_ptr<ConfigurationInterface>& configuration,
@ -133,4 +134,4 @@ private:
unsigned int out_streams);
};
#endif /*GNSS_SDR_BLOCK_FACTORY_H_*/
#endif // GNSS_SDR_BLOCK_FACTORY_H_

View File

@ -141,7 +141,7 @@ endif()
# Definitions
################################################################################
if(${PC_GNURADIO_RUNTIME_VERSION} VERSION_GREATER "3.7.20")
if(NOT (GNURADIO_VERSION VERSION_LESS "3.8"))
add_definitions(-DGR_GREATER_38=1)
endif()