1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-17 18:49:57 +00:00

Start migration to GNU Radio 3.7 new C++ API. This commit replaces some components of gnuradio-core by the new components gr-blocks, gr-fft and gr-filter.

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@282 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Carles Fernandez 2012-11-25 11:15:11 +00:00
parent 0760fa0f3e
commit 818d9e14b5
22 changed files with 306 additions and 311 deletions

View File

@ -46,7 +46,7 @@ project
project : requirements project : requirements
<define>OMNITHREAD_POSIX <define>OMNITHREAD_POSIX
<cxxflags>"-msse2 -mfpmath=sse -std=c++0x -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free" <cxxflags>"-msse2 -mfpmath=sse -std=c++0x -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free"
<linkflags>"-larmadillo -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -llapack -lblas -lprofiler -ltcmalloc -lvolk" <linkflags>"-lgnuradio-blocks -lgnuradio-fft -lgnuradio-filter -larmadillo -lboost_system -lboost_filesystem -lboost_thread -lboost_date_time -llapack -lblas -lprofiler -ltcmalloc -lvolk"
<include>src/algorithms/acquisition/adapters <include>src/algorithms/acquisition/adapters
<include>src/algorithms/acquisition/gnuradio_blocks <include>src/algorithms/acquisition/gnuradio_blocks
<include>src/algorithms/channel/adapters <include>src/algorithms/channel/adapters
@ -85,7 +85,10 @@ project : requirements
<include>$GNURADIO_ROOT/gnuradio-core/src/lib/general <include>$GNURADIO_ROOT/gnuradio-core/src/lib/general
<include>$GNURADIO_ROOT/gnuradio-core/src/lib/gengen <include>$GNURADIO_ROOT/gnuradio-core/src/lib/gengen
<include>$GNURADIO_ROOT/gr-uhd/include <include>$GNURADIO_ROOT/gr-uhd/include
<include>$GNURADIO_ROOT/volk/lib <include>$GNURADIO_ROOT/gr-blocks/include
<include>$GNURADIO_ROOT/gr-fft/include
<include>$GNURADIO_ROOT/gr-filter/include
#<include>$GNURADIO_ROOT/volk/lib
<include>$OSMOSDR_ROOT/include/osmosdr <include>$OSMOSDR_ROOT/include/osmosdr
<include>$(GTEST_DIR)/include <include>$(GTEST_DIR)/include
<threading>multi <threading>multi

View File

@ -588,7 +588,7 @@ void gps_l1_ca_ls_pvt::togeod(double *dphi, double *dlambda, double *h, double a
} }
if (i == (maxit-1)) if (i == (maxit-1))
{ {
DLOG(INFO) << "The computation of geodetic coordinates did not converged" << std::endl; DLOG(INFO) << "The computation of geodetic coordinates did not converge";
} }
} }
*dphi = (*dphi) * rtd; *dphi = (*dphi) * rtd;

View File

@ -37,10 +37,6 @@
#include <string> #include <string>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h>
#include <gnuradio/gr_complex_to_interleaved_short.h>
#include <gnuradio/gr_interleaved_short_to_complex.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -86,8 +82,9 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_,
shift_resolution_, if_, fs_in_, samples_per_ms, queue_, shift_resolution_, if_, fs_in_, samples_per_ms, queue_,
dump_, dump_filename_); dump_, dump_filename_);
stream_to_vector_ = gr_make_stream_to_vector(item_size_, //stream_to_vector_ = gr_make_stream_to_vector(item_size_,
vector_length_); // vector_length_);
stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" DLOG(INFO) << "stream_to_vector("
<< stream_to_vector_->unique_id() << ")"; << stream_to_vector_->unique_id() << ")";
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id()

View File

@ -37,6 +37,7 @@
#include "acquisition_interface.h" #include "acquisition_interface.h"
#include "pcps_acquisition_cc.h" #include "pcps_acquisition_cc.h"
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
#include <gnuradio/blocks/stream_to_vector.h>
class ConfigurationInterface; class ConfigurationInterface;
@ -121,9 +122,7 @@ public:
private: private:
ConfigurationInterface* configuration_; ConfigurationInterface* configuration_;
pcps_acquisition_cc_sptr acquisition_cc_; pcps_acquisition_cc_sptr acquisition_cc_;
gr_block_sptr stream_to_vector_; gr::blocks::stream_to_vector::sptr stream_to_vector_;
gr_block_sptr complex_to_short_;
gr_block_sptr short_to_complex_;
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;
unsigned int vector_length_; unsigned int vector_length_;

View File

@ -38,10 +38,6 @@
#include "configuration_interface.h" #include "configuration_interface.h"
#include <iostream> #include <iostream>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h>
#include <gnuradio/gr_complex_to_interleaved_short.h>
#include <gnuradio/gr_interleaved_short_to_complex.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -83,8 +79,9 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition(
acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_, acquisition_cc_ = pcps_make_acquisition_cc(sampled_ms_,
shift_resolution_, if_, fs_in_, vector_length_, queue_, shift_resolution_, if_, fs_in_, vector_length_, queue_,
dump_, dump_filename_); dump_, dump_filename_);
stream_to_vector_ = gr_make_stream_to_vector(item_size_,
vector_length_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_);
DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id() DLOG(INFO) << "stream_to_vector(" << stream_to_vector_->unique_id()
<< ")"; << ")";
DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id() DLOG(INFO) << "acquisition(" << acquisition_cc_->unique_id()

View File

@ -39,6 +39,8 @@
#include "acquisition_interface.h" #include "acquisition_interface.h"
#include "pcps_acquisition_cc.h" #include "pcps_acquisition_cc.h"
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
#include <gnuradio/blocks/stream_to_vector.h>
class ConfigurationInterface; class ConfigurationInterface;
@ -122,9 +124,7 @@ public:
private: private:
pcps_acquisition_cc_sptr acquisition_cc_; pcps_acquisition_cc_sptr acquisition_cc_;
gr_block_sptr stream_to_vector_; gr::blocks::stream_to_vector::sptr stream_to_vector_;
gr_block_sptr complex_to_short_;
gr_block_sptr short_to_complex_;
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;
unsigned int vector_length_; unsigned int vector_length_;

View File

@ -80,10 +80,10 @@ pcps_acquisition_cc::pcps_acquisition_cc(
if (posix_memalign((void**)&d_fft_codes, 16, d_fft_size * sizeof(gr_complex)) == 0){}; if (posix_memalign((void**)&d_fft_codes, 16, d_fft_size * sizeof(gr_complex)) == 0){};
// Direct FFT // Direct FFT
d_fft_if = new gri_fft_complex(d_fft_size, true); d_fft_if = new gr::fft::fft_complex(d_fft_size, true);
// Inverse FFT // Inverse FFT
d_ifft = new gri_fft_complex(d_fft_size, false); d_ifft = new gr::fft::fft_complex(d_fft_size, false);
// For dumping samples into a file // For dumping samples into a file
d_dump = dump; d_dump = dump;

View File

@ -53,7 +53,7 @@
#include <gnuradio/gr_block.h> #include <gnuradio/gr_block.h>
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <gnuradio/gri_fft.h> #include <gnuradio/fft/fft.h>
#include <queue> #include <queue>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -72,137 +72,138 @@ pcps_make_acquisition_cc(unsigned int sampled_ms,
* \brief This class implements a Parallel Code Phase Search Acquisition * \brief This class implements a Parallel Code Phase Search Acquisition
*/ */
class pcps_acquisition_cc: public gr_block { class pcps_acquisition_cc: public gr_block
{
private: private:
friend pcps_acquisition_cc_sptr friend pcps_acquisition_cc_sptr
pcps_make_acquisition_cc(unsigned int sampled_ms, pcps_make_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in, unsigned int doppler_max, long freq, long fs_in,
int samples_per_ms, gr_msg_queue_sptr queue, bool dump, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename); std::string dump_filename);
pcps_acquisition_cc(unsigned int sampled_ms, pcps_acquisition_cc(unsigned int sampled_ms,
unsigned int doppler_max, long freq, long fs_in, unsigned int doppler_max, long freq, long fs_in,
int samples_per_ms, gr_msg_queue_sptr queue, bool dump, int samples_per_ms, gr_msg_queue_sptr queue, bool dump,
std::string dump_filename); std::string dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset); int doppler_offset);
long d_fs_in; long d_fs_in;
long d_freq; long d_freq;
int d_samples_per_ms; int d_samples_per_ms;
unsigned int d_doppler_resolution; unsigned int d_doppler_resolution;
float d_threshold; float d_threshold;
std::string d_satellite_str; std::string d_satellite_str;
unsigned int d_doppler_max; unsigned int d_doppler_max;
unsigned int d_doppler_step; unsigned int d_doppler_step;
unsigned int d_sampled_ms; unsigned int d_sampled_ms;
unsigned int d_fft_size; unsigned int d_fft_size;
unsigned long int d_sample_counter; unsigned long int d_sample_counter;
gr_complex* d_carrier; gr_complex* d_carrier;
gr_complex* d_fft_codes; gr_complex* d_fft_codes;
gri_fft_complex* d_fft_if; gr::fft::fft_complex* d_fft_if;
gri_fft_complex* d_ifft; gr::fft::fft_complex* d_ifft;
Gnss_Synchro *d_gnss_synchro; Gnss_Synchro *d_gnss_synchro;
unsigned int d_code_phase; unsigned int d_code_phase;
float d_doppler_freq; float d_doppler_freq;
float d_mag; float d_mag;
float d_input_power; float d_input_power;
float d_test_statistics; float d_test_statistics;
gr_msg_queue_sptr d_queue; gr_msg_queue_sptr d_queue;
concurrent_queue<int> *d_channel_internal_queue; concurrent_queue<int> *d_channel_internal_queue;
std::ofstream d_dump_file; std::ofstream d_dump_file;
bool d_active; bool d_active;
bool d_dump; bool d_dump;
unsigned int d_channel; unsigned int d_channel;
std::string d_dump_filename; std::string d_dump_filename;
public: public:
/*! /*!
* \brief Default destructor * \brief Default destructor
*/ */
~pcps_acquisition_cc(); ~pcps_acquisition_cc();
/*! /*!
* \brief Set acquisition/tracking common Gnss_Synchro object pointer * \brief Set acquisition/tracking common Gnss_Synchro object pointer
* to exchange synchronization data between acquisition and tracking blocks * to exchange synchronization data between acquisition and tracking blocks
*/ */
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{ {
d_gnss_synchro = p_gnss_synchro; d_gnss_synchro = p_gnss_synchro;
} }
/*! /*!
* \brief Returns the maximum peak of grid search * \brief Returns the maximum peak of grid search
*/ */
unsigned int mag() unsigned int mag()
{ {
return d_mag; return d_mag;
} }
/*! /*!
* \brief Initializes acquisition algorithm. * \brief Initializes acquisition algorithm.
*/ */
void init(); void init();
/*! /*!
* \brief Sets local code for PCPS acquisition algorithm. * \brief Sets local code for PCPS acquisition algorithm.
*/ */
void set_local_code(std::complex<float> * code); void set_local_code(std::complex<float> * code);
/*! /*!
* \brief Starts acquisition algorithm, turning from standby mode to * \brief Starts acquisition algorithm, turning from standby mode to
* active mode * active mode
*/ */
void set_active(bool active) void set_active(bool active)
{ {
d_active = active; d_active = active;
} }
/*! /*!
* \brief Set acquisition channel unique ID * \brief Set acquisition channel unique ID
*/ */
void set_channel(unsigned int channel) void set_channel(unsigned int channel)
{ {
d_channel = channel; d_channel = channel;
} }
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
*/ */
void set_threshold(float threshold) void set_threshold(float threshold)
{ {
d_threshold = threshold; d_threshold = threshold;
} }
/*! /*!
* \brief Set maximum Doppler off grid search * \brief Set maximum Doppler off grid search
*/ */
void set_doppler_max(unsigned int doppler_max) void set_doppler_max(unsigned int doppler_max)
{ {
d_doppler_max = doppler_max; d_doppler_max = doppler_max;
} }
/*! /*!
* \brief Set Doppler steps for the grid search * \brief Set Doppler steps for the grid search
*/ */
void set_doppler_step(unsigned int doppler_step) void set_doppler_step(unsigned int doppler_step)
{ {
d_doppler_step = doppler_step; d_doppler_step = doppler_step;
} }
/*! /*!
* \brief Set tracking channel internal queue * \brief Set tracking channel internal queue
*/ */
void set_channel_queue(concurrent_queue<int> *channel_internal_queue) void set_channel_queue(concurrent_queue<int> *channel_internal_queue)
{ {
d_channel_internal_queue = channel_internal_queue; d_channel_internal_queue = channel_internal_queue;
} }
int general_work(int noutput_items, gr_vector_int &ninput_items, int general_work(int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items); gr_vector_void_star &output_items);
}; };
#endif /* GNSS_SDR_PCPS_ACQUISITION_CC_H_*/ #endif /* GNSS_SDR_PCPS_ACQUISITION_CC_H_*/

View File

@ -69,7 +69,7 @@ public:
}; };
struct gps_channel_acquiring_fsm_S1: public sc::state< struct gps_channel_acquiring_fsm_S1: public sc::state<
gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm> { gps_channel_acquiring_fsm_S1, GpsL1CaChannelFsm> {
public: public:
typedef mpl::list<sc::transition< typedef mpl::list<sc::transition<
Ev_gps_channel_failed_acquisition_no_repeat, Ev_gps_channel_failed_acquisition_no_repeat,
@ -77,7 +77,7 @@ public:
Ev_gps_channel_failed_acquisition_repeat, Ev_gps_channel_failed_acquisition_repeat,
gps_channel_acquiring_fsm_S1>, sc::transition< gps_channel_acquiring_fsm_S1>, sc::transition<
Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> > Ev_gps_channel_valid_acquisition, gps_channel_tracking_fsm_S2> >
reactions; reactions;
gps_channel_acquiring_fsm_S1(my_context ctx) : gps_channel_acquiring_fsm_S1(my_context ctx) :
my_base(ctx) { my_base(ctx) {

View File

@ -29,7 +29,6 @@
*/ */
#include "ishort_to_complex.h" #include "ishort_to_complex.h"
#include <gnuradio/gr_interleaved_short_to_complex.h>
#include "configuration_interface.h" #include "configuration_interface.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_file_sink.h> #include <gnuradio/gr_file_sink.h>
@ -60,7 +59,8 @@ IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::str
size_t item_size=sizeof(gr_complex); size_t item_size=sizeof(gr_complex);
gr_interleaved_short_to_complex_ = gr_make_interleaved_short_to_complex(); gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make();
DLOG(INFO) << "data_type_adapter_(" << gr_interleaved_short_to_complex_->unique_id() << ")"; DLOG(INFO) << "data_type_adapter_(" << gr_interleaved_short_to_complex_->unique_id() << ")";
if (dump_) if (dump_)

View File

@ -33,7 +33,7 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include <gnuradio/gr_interleaved_short_to_complex.h> #include <gnuradio/blocks/interleaved_short_to_complex.h>
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
class ConfigurationInterface; class ConfigurationInterface;
@ -70,7 +70,7 @@ public:
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
gr_interleaved_short_to_complex_sptr gr_interleaved_short_to_complex_; gr::blocks::interleaved_short_to_complex::sptr gr_interleaved_short_to_complex_;
ConfigurationInterface* config_; ConfigurationInterface* config_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;

View File

@ -34,7 +34,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_file_sink.h> #include <gnuradio/gr_file_sink.h>
#include <gnuradio/gr_remez.h> #include <gnuradio/filter/pm_remez.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -52,7 +52,7 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role,
&& (output_item_type_.compare("gr_complex") == 0)) && (output_item_type_.compare("gr_complex") == 0))
{ {
item_size = sizeof(gr_complex); item_size = sizeof(gr_complex);
fir_filter_ccf_ = gr_make_fir_filter_ccf(1, taps_); fir_filter_ccf_ = gr::filter::fir_filter_ccf::make(1, taps_);
DLOG(INFO) << "input_filter(" << fir_filter_ccf_->unique_id() << ")"; DLOG(INFO) << "input_filter(" << fir_filter_ccf_->unique_id() << ")";
} }
else else
@ -165,11 +165,11 @@ void FirFilter::init()
std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
int grid_density = config_->property(role_ + ".grid_density", default_grid_density); int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
// gr_remez implements the Parks-McClellan FIR filter design. // pm_remez implements the Parks-McClellan FIR filter design.
// It calculates the optimal (in the Chebyshev/minimax sense) FIR filter // It calculates the optimal (in the Chebyshev/minimax sense) FIR filter
// impulse response given a set of band edges, the desired response on // impulse response given a set of band edges, the desired response on
// those bands, and the weight given to the error in those bands. // those bands, and the weight given to the error in those bands.
std::vector<double> taps_d = gr_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); std::vector<double> taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density);
taps_.reserve(taps_d.size()); taps_.reserve(taps_d.size());
for (std::vector<double>::iterator it = taps_d.begin(); it != taps_d.end(); it++) for (std::vector<double>::iterator it = taps_d.begin(); it != taps_d.end(); it++)
{ {

View File

@ -1,6 +1,6 @@
/*! /*!
* \file fir_filter.h * \file fir_filter.h
* \brief Adapts a gnuradio gr_fir_filter designed with gr_remez * \brief Adapts a gnuradio gr_fir_filter designed with pm_remez
* \author Luis Esteve, 2012. luis(at)epsilon-formacion.com * \author Luis Esteve, 2012. luis(at)epsilon-formacion.com
* *
* Detailed description of the file here if needed. * Detailed description of the file here if needed.
@ -35,18 +35,13 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include <gnuradio/gr_fir_filter_ccc.h> #include <gnuradio/filter/fir_filter_ccf.h>
#include <gnuradio/gr_fir_filter_ccf.h>
#include <gnuradio/gr_fir_filter_fcc.h>
#include <gnuradio/gr_fir_filter_fff.h>
#include <gnuradio/gr_fir_filter_fsf.h>
#include <gnuradio/gr_fir_filter_scc.h>
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
class ConfigurationInterface; class ConfigurationInterface;
/*! /*!
* \brief This class adapts a GNU Radio gr_fir_filter designed with gr_remez * \brief This class adapts a GNU Radio gr_fir_filter designed with pm_remez
* *
* See Parks-McClellan FIR filter design, http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm * See Parks-McClellan FIR filter design, http://en.wikipedia.org/wiki/Parks-McClellan_filter_design_algorithm
* Calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response * Calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response
@ -79,7 +74,7 @@ public:
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
gr_fir_filter_ccf_sptr fir_filter_ccf_; gr::filter::fir_filter_ccf::sptr fir_filter_ccf_;
ConfigurationInterface* config_; ConfigurationInterface* config_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;

View File

@ -34,7 +34,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_file_sink.h> #include <gnuradio/gr_file_sink.h>
#include <gnuradio/gr_remez.h> #include <gnuradio/filter/pm_remez.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>
@ -56,7 +56,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration
&& (output_item_type_.compare("gr_complex") == 0)) && (output_item_type_.compare("gr_complex") == 0))
{ {
item_size = sizeof(gr_complex); item_size = sizeof(gr_complex);
freq_xlating_fir_filter_ccf_ = gr_make_freq_xlating_fir_filter_ccf(decimation_factor, taps_, intermediate_freq_, sampling_freq_); freq_xlating_fir_filter_ccf_ = gr::filter::freq_xlating_fir_filter_ccf::make(decimation_factor, taps_, intermediate_freq_, sampling_freq_);
DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_ccf_->unique_id() << ")"; DLOG(INFO) << "input_filter(" << freq_xlating_fir_filter_ccf_->unique_id() << ")";
} }
else else
@ -172,8 +172,10 @@ void FreqXlatingFirFilter::init()
std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type);
int grid_density = config_->property(role_ + ".grid_density", default_grid_density); int grid_density = config_->property(role_ + ".grid_density", default_grid_density);
std::vector<double> taps_d = gr_remez(number_of_taps - 1, bands, ampl,
error_w, filter_type, grid_density); std::vector<double> taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl,
error_w, filter_type, grid_density);
taps_.reserve(taps_d.size()); taps_.reserve(taps_d.size());
for (std::vector<double>::iterator it = taps_d.begin(); it != taps_d.end(); it++) for (std::vector<double>::iterator it = taps_d.begin(); it != taps_d.end(); it++)
{ {

View File

@ -35,16 +35,13 @@
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include <gnuradio/gr_freq_xlating_fir_filter_ccc.h> #include <gnuradio/filter/freq_xlating_fir_filter_ccf.h>
#include <gnuradio/gr_freq_xlating_fir_filter_ccf.h>
#include <gnuradio/gr_freq_xlating_fir_filter_fcc.h>
#include <gnuradio/gr_freq_xlating_fir_filter_scc.h>
#include <gnuradio/gr_msg_queue.h> #include <gnuradio/gr_msg_queue.h>
class ConfigurationInterface; class ConfigurationInterface;
/*! /*!
* \brief This class adapts a gnuradio gr_freq_xlating_fir_filter designed with gr_remez * \brief This class adapts a gnuradio gr_freq_xlating_fir_filter designed with pm_remez
* *
* Construct a FIR filter with the given taps and a composite frequency * Construct a FIR filter with the given taps and a composite frequency
* translation that shifts intermediate_freq_ down to zero Hz. The frequency * translation that shifts intermediate_freq_ down to zero Hz. The frequency
@ -81,7 +78,7 @@ public:
gr_basic_block_sptr get_right_block(); gr_basic_block_sptr get_right_block();
private: private:
gr_freq_xlating_fir_filter_ccf_sptr freq_xlating_fir_filter_ccf_; gr::filter::freq_xlating_fir_filter_ccf::sptr freq_xlating_fir_filter_ccf_;
ConfigurationInterface* config_; ConfigurationInterface* config_;
bool dump_; bool dump_;
std::string dump_filename_; std::string dump_filename_;

View File

@ -38,8 +38,8 @@
* *
*/ */
#ifndef NCO_LIB_CC_H #ifndef GNSS_SDR_NCO_LIB_CC_H_
#define NCO_LIB_CC_H #define GNSS_SDR_NCO_LIB_CC_H_
#include <gr_fxpt.h> #include <gr_fxpt.h>
#include <xmmintrin.h> #include <xmmintrin.h>

View File

@ -34,8 +34,8 @@
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gps_l1_ca_observables_cc.h" #include "gps_l1_ca_observables_cc.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h> //#include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h> //#include <gnuradio/gr_vector_to_stream.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -182,7 +182,7 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
current_gnss_synchro[i].Pseudorange_symbol_shift = 0.0; current_gnss_synchro[i].Pseudorange_symbol_shift = 0.0;
} }
/* /*
* 2. Compute RAW pseudorranges: Use only the valid channels (channels that are tracking a satellite) * 2. Compute RAW pseudoranges: Use only the valid channels (channels that are tracking a satellite)
*/ */
if(current_gnss_synchro_map.size() > 0 and flag_history_ok == true) if(current_gnss_synchro_map.size() > 0 and flag_history_ok == true)
{ {
@ -219,18 +219,18 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
if (reference_channel != gnss_synchro_iter->second.Channel_ID) if (reference_channel != gnss_synchro_iter->second.Channel_ID)
{ {
// compute the required symbol history shift in order to match the reference symbol // compute the required symbol history shift in order to match the reference symbol
history_shift = gnss_synchro_iter->second.Preamble_symbol_counter-current_symbol; history_shift = gnss_synchro_iter->second.Preamble_symbol_counter - current_symbol;
if (history_shift < (int)MAX_TOA_DELAY_MS ) // and history_shift>=0) if (history_shift < (int)MAX_TOA_DELAY_MS ) // and history_shift>=0)
{ {
tmp_gnss_synchro= d_history_gnss_synchro_deque[gnss_synchro_iter->second.Channel_ID][history_shift]; tmp_gnss_synchro= d_history_gnss_synchro_deque[gnss_synchro_iter->second.Channel_ID][history_shift];
gnss_synchro_aligned_map.insert(std::pair<int,Gnss_Synchro>(gnss_synchro_iter->second.Channel_ID,tmp_gnss_synchro)); gnss_synchro_aligned_map.insert(std::pair<int,Gnss_Synchro>(gnss_synchro_iter->second.Channel_ID, tmp_gnss_synchro));
} }
} }
} }
} }
/* /*
* 3 Compute the pseudorranges using the aligned data map * 3 Compute the pseudoranges using the aligned data map
*/ */
double min_symbol_timestamp_ms; double min_symbol_timestamp_ms;
double max_symbol_timestamp_ms; double max_symbol_timestamp_ms;

View File

@ -46,132 +46,139 @@
using google::LogMessage; using google::LogMessage;
DEFINE_string(signal_source, "-", DEFINE_string(signal_source, "-",
"If defined, path to the file containing the signal samples (overrides the configuration file)"); "If defined, path to the file containing the signal samples (overrides the configuration file)");
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_streams, unsigned int out_streams, std::string role, unsigned int in_streams, unsigned int out_streams,
gr_msg_queue_sptr queue) : gr_msg_queue_sptr queue) :
role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
{ {
std::string default_filename = "../data/sc2_d16.dat";
std::string default_item_type = "short";
std::string default_dump_filename = "../data/sc2_d16.dat";
std::string default_filename = "../data/sc2_d16.dat"; samples_ = configuration->property(role + ".samples", 0);
std::string default_item_type = "short"; sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0);
std::string default_dump_filename = "../data/sc2_d16.dat"; filename_ = configuration->property(role + ".filename", default_filename);
samples_ = configuration->property(role + ".samples", 0); // override value with commandline flag, if present
sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0); if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source;
filename_ = configuration->property(role + ".filename", default_filename);
// override value with commandline flag, if present item_type_ = configuration->property(role + ".item_type", default_item_type);
if (FLAGS_signal_source.compare("-") != 0) filename_= FLAGS_signal_source; repeat_ = configuration->property(role + ".repeat", false);
dump_ = configuration->property(role + ".dump", false);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename);
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false);
item_type_ = configuration->property(role + ".item_type", default_item_type); if (item_type_.compare("gr_complex") == 0)
repeat_ = configuration->property(role + ".repeat", false); {
dump_ = configuration->property(role + ".dump", false); item_size_ = sizeof(gr_complex);
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); }
enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); else if (item_type_.compare("float") == 0)
{
item_size_ = sizeof(float);
}
else if (item_type_.compare("short") == 0)
{
item_size_ = sizeof(short int);
}
else
{
LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type. Using gr_complex.";
item_size_ = sizeof(gr_complex);
}
try
{
file_source_ = gr_make_file_source(item_size_, filename_.c_str(), repeat_);
}
catch (const std::exception &e)
{
std::cerr
<< "The receiver was configured to work with a file signal source "
<< std::endl
<< "but the specified file is unreachable by GNSS-SDR."
<< std::endl
<< "Please modify the configuration at "
<< "conf/gnss-sdr.conf (the default configuration file)"
<< std::endl
<< "and point SignalSource.filename to a valid file,"
<< std::endl
<< "or specify your own receiver and source with the flag"
<< std::endl
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf"
<< std::endl;
LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file "
<< filename_.c_str() << ", exiting the program.";
throw(e);
}
if (item_type_.compare("gr_complex") == 0) DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
{
item_size_ = sizeof(gr_complex);
}
else if (item_type_.compare("float") == 0)
{
item_size_ = sizeof(float);
}
else if (item_type_.compare("short") == 0)
{
item_size_ = sizeof(short int);
}
else
{
LOG_AT_LEVEL(WARNING) << item_type_
<< " unrecognized item type. Using gr_complex.";
item_size_ = sizeof(gr_complex);
}
try
{
file_source_ = gr_make_file_source(item_size_, filename_.c_str(), repeat_);
}
catch (const std::exception &e)
{
std::cerr
<< "The receiver was configured to work with a file signal source "
<< std::endl
<< "but the specified file is unreachable by GNSS-SDR."
<< std::endl
<< "Please modify the configuration at "
<< "conf/gnss-sdr.conf (the default configuration file)"
<< std::endl
<< "and point SignalSource.filename to a valid file,"
<< std::endl
<< "or specify your own receiver and source with the flag"
<< std::endl
<<"gnss-sdr --config_file=my_GNSS_SDR_configuration.conf"
<< std::endl;
LOG_AT_LEVEL(INFO) << "file_signal_source: Unable to open the samples file "
<< filename_.c_str() << ", exiting the program.";
throw(e);
}
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")"; if (samples_ == 0) // read all file
{
/*!
* BUG workaround: The GNURadio file source does not stop the receiver after reaching the End of File.
* A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the
* valve block
*/
std::ifstream file (filename_.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
std::ifstream::pos_type size;
if (file.is_open())
{
size = file.tellg();
}
else
{
std::cout << "file_signal_source: Unable to open the samples file " << filename_.c_str() << std::endl;
LOG_AT_LEVEL(ERROR) << "file_signal_source: Unable to open the samples file " << filename_.c_str();
}
std::cout << std::setprecision(16);
std::cout << "Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
if (size > 0)
{
samples_ = floor((double)size / (double)item_size()) - ceil(0.1 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 100 ms
}
}
CHECK(samples_ > 0) << "File does not contain enough samples to process.";
double signal_duration_s;
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_);
DLOG(INFO) << "Total samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
// if samples_ > 0 then enable a flow valve to stop the process after n samples
//if (samples_ > 0)
//{
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
//}
//else
//{
// std::cout << "Not enough samples to process." << std::endl;
// here we should exit the program
//throw;
//LOG(FATAL)
if (samples_ == 0) //}
{
/*!
* BUG workaround: The GNURadio file source does not stop the receiver after reaching the End of File.
* A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the
* valve block
*/
std::ifstream file (filename_.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
std::ifstream::pos_type size;
if (file.is_open())
{
size = file.tellg();
}
else
{
std::cout << "file_signal_source: Unable to open the samples file " << filename_.c_str() << std::endl;
LOG_AT_LEVEL(ERROR) << "file_signal_source: Unable to open the samples file " << filename_.c_str();
}
std::cout << std::setprecision(16);
std::cout <<"Processing file " << filename_ << ", which contains " << (double)size << " [bytes]" << std::endl;
if (size > 0)
{
samples_ = floor((double)size / (double)item_size()) - ceil(0.1 * (double)sampling_frequency_); //process all the samples available in the file excluding the last 100 ms
} if (dump_)
} {
double signal_duration_s; sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str());
signal_duration_s = (double)samples_ * ( 1 /(double)sampling_frequency_); DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")";
DLOG(INFO) << "Total samples to be processed= "<< samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; }
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
// if samples != 0 then enable a flow valve to stop the process after n samples
if (samples_ != 0)
{
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}
if (dump_) if (enable_throttle_control_)
{ {
sink_ = gr_make_file_sink(item_size_, dump_filename_.c_str()); throttle_ = gr_make_throttle(item_size_, sampling_frequency_);
DLOG(INFO) << "file_sink(" << sink_->unique_id() << ")"; }
} DLOG(INFO) << "File source filename " << filename_;
DLOG(INFO) << "Samples " << samples_;
if (enable_throttle_control_) DLOG(INFO) << "Sampling frequency " << sampling_frequency_;
{ DLOG(INFO) << "Item type " << item_type_;
throttle_ = gr_make_throttle(item_size_, sampling_frequency_); DLOG(INFO) << "Item size " << item_size_;
} DLOG(INFO) << "Repeat " << repeat_;
DLOG(INFO) << "File source filename " << filename_; DLOG(INFO) << "Dump " << dump_;
DLOG(INFO) << "Samples " << samples_; DLOG(INFO) << "Dump filename " << dump_filename_;
DLOG(INFO) << "Sampling frequency " << sampling_frequency_;
DLOG(INFO) << "Item type " << item_type_;
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "Repeat " << repeat_;
DLOG(INFO) << "Dump " << dump_;
DLOG(INFO) << "Dump filename " << dump_filename_;
} }
@ -185,7 +192,7 @@ FileSignalSource::~FileSignalSource()
void FileSignalSource::connect(gr_top_block_sptr top_block) void FileSignalSource::connect(gr_top_block_sptr top_block)
{ {
if (samples_ != 0) if (samples_ > 0)
{ {
if (enable_throttle_control_ == true) if (enable_throttle_control_ == true)
{ {
@ -240,7 +247,7 @@ void FileSignalSource::connect(gr_top_block_sptr top_block)
void FileSignalSource::disconnect(gr_top_block_sptr top_block) void FileSignalSource::disconnect(gr_top_block_sptr top_block)
{ {
if (samples_ != 0) if (samples_ > 0)
{ {
if (enable_throttle_control_ == true) if (enable_throttle_control_ == true)
{ {
@ -305,7 +312,7 @@ gr_basic_block_sptr FileSignalSource::get_left_block()
gr_basic_block_sptr FileSignalSource::get_right_block() gr_basic_block_sptr FileSignalSource::get_right_block()
{ {
if (samples_ != 0) if (samples_ > 0)
{ {
return valve_; return valve_;
} }

View File

@ -34,8 +34,8 @@
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gps_l1_ca_telemetry_decoder_cc.h" #include "gps_l1_ca_telemetry_decoder_cc.h"
#include <gnuradio/gr_io_signature.h> #include <gnuradio/gr_io_signature.h>
#include <gnuradio/gr_stream_to_vector.h> //#include <gnuradio/gr_stream_to_vector.h>
#include <gnuradio/gr_vector_to_stream.h> //#include <gnuradio/gr_vector_to_stream.h>
#include <glog/log_severity.h> #include <glog/log_severity.h>
#include <glog/logging.h> #include <glog/logging.h>

View File

@ -191,7 +191,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
corr_value += d_preambles_symbols[i]; corr_value += d_preambles_symbols[i];
} }
} }
d_flag_preamble=false; d_flag_preamble = false;
//******* frame sync ****************** //******* frame sync ******************
if (abs(corr_value) >= 160) if (abs(corr_value) >= 160)
{ {
@ -206,7 +207,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
d_frame_bit_index = 8; d_frame_bit_index = 8;
d_stat = 1; // enter into frame pre-detection status d_stat = 1; // enter into frame pre-detection status
} }
else if (d_stat == 1) //check 6 seconds of preample separation else if (d_stat == 1) //check 6 seconds of preamble separation
{ {
preamble_diff = abs(d_sample_counter - d_preamble_index); preamble_diff = abs(d_sample_counter - d_preamble_index);
if (abs(preamble_diff - 6000) < 1) if (abs(preamble_diff - 6000) < 1)
@ -238,6 +239,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
} }
} }
} }
//******* SYMBOL TO BIT ******* //******* SYMBOL TO BIT *******
d_symbol_accumulator += in[0][d_samples_per_bit*8 - 1].Prompt_I; // accumulate the input value in d_symbol_accumulator d_symbol_accumulator += in[0][d_samples_per_bit*8 - 1].Prompt_I; // accumulate the input value in d_symbol_accumulator
d_symbol_accumulator_counter++; d_symbol_accumulator_counter++;
@ -245,7 +247,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
{ {
if (d_symbol_accumulator > 0) if (d_symbol_accumulator > 0)
{ //symbol to bit { //symbol to bit
d_GPS_frame_4bytes +=1; //insert the telemetry bit in LSB d_GPS_frame_4bytes += 1; //insert the telemetry bit in LSB
} }
d_symbol_accumulator = 0; d_symbol_accumulator = 0;
d_symbol_accumulator_counter = 0; d_symbol_accumulator_counter = 0;

View File

@ -275,8 +275,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_code()
tcode_chips = -rem_code_phase_chips; tcode_chips = -rem_code_phase_chips;
// Alternative EPL code generation (40% of speed improvement!) // Alternative EPL code generation (40% of speed improvement!)
early_late_spc_samples=round(d_early_late_spc_chips/code_phase_step_chips); early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips);
epl_loop_length_samples=d_current_prn_length_samples+early_late_spc_samples*2; epl_loop_length_samples = d_current_prn_length_samples + early_late_spc_samples*2;
for (int i=0; i<epl_loop_length_samples; i++) for (int i=0; i<epl_loop_length_samples; i++)
{ {
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips)); associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
@ -399,15 +399,15 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
consume_each(samples_available); consume_each(samples_available);
// make an output to not stop the rest of the processing blocks // make an output to not stop the rest of the processing blocks
current_synchro_data.Prompt_I=0.0; current_synchro_data.Prompt_I = 0.0;
current_synchro_data.Prompt_Q=0.0; current_synchro_data.Prompt_Q = 0.0;
current_synchro_data.Tracking_timestamp_secs=(double)d_sample_counter/(double)d_fs_in; current_synchro_data.Tracking_timestamp_secs = (double)d_sample_counter/(double)d_fs_in;
current_synchro_data.Carrier_phase_rads=0.0; current_synchro_data.Carrier_phase_rads = 0.0;
current_synchro_data.Code_phase_secs=0.0; current_synchro_data.Code_phase_secs = 0.0;
current_synchro_data.CN0_dB_hz=0.0; current_synchro_data.CN0_dB_hz = 0.0;
current_synchro_data.Flag_valid_tracking=false; current_synchro_data.Flag_valid_tracking = false;
*out[0] =current_synchro_data; *out[0] = current_synchro_data;
return 1; return 1;
} }
@ -635,13 +635,8 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel_queue(concurrent_queue<int> *cha
d_channel_internal_queue = channel_internal_queue; d_channel_internal_queue = channel_internal_queue;
} }
void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro)
{ {
d_acquisition_gnss_synchro = p_gnss_synchro; d_acquisition_gnss_synchro = p_gnss_synchro;
// Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
//DLOG(INFO) << "Tracking code phase set to " << d_acq_code_phase_samples;
//DLOG(INFO) << "Tracking carrier doppler set to " << d_acq_carrier_doppler_hz;
//DLOG(INFO) << "Tracking Satellite set to " << d_satellite;
} }