mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 04:30:33 +00:00
A smarter way of handling the multirrate input of observables block
This commit is contained in:
parent
81179a9f38
commit
184bd0d1de
@ -37,6 +37,8 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <armadillo>
|
#include <armadillo>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <gnuradio/block_detail.h>
|
||||||
|
#include <gnuradio/buffer.h>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <matio.h>
|
#include <matio.h>
|
||||||
#include "Galileo_E1.h"
|
#include "Galileo_E1.h"
|
||||||
@ -325,9 +327,21 @@ bool Hybrid_valueCompare_gnss_synchro_d_TOW(const Gnss_Synchro& a, double b)
|
|||||||
|
|
||||||
void hybrid_observables_cc::forecast (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
void hybrid_observables_cc::forecast (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool zero_samples=true;
|
||||||
for(unsigned int i = 0; i < d_nchannels; i++)
|
for(unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
ninput_items_required[i] = 0; //set the required available samples in each call
|
int items=detail()->input(i)->items_available();
|
||||||
|
if (items>0) zero_samples=false;
|
||||||
|
ninput_items_required[i] = items; //set the required available samples in each call
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zero_samples==true)
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < d_nchannels; i++)
|
||||||
|
{
|
||||||
|
ninput_items_required[i] = 1; //set the required available samples in each call
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,27 +367,15 @@ int hybrid_observables_cc::general_work (int noutput_items ,
|
|||||||
* Multi-rate GNURADIO Block. Read how many input items are avaliable in each channel
|
* Multi-rate GNURADIO Block. Read how many input items are avaliable in each channel
|
||||||
* Record all synchronization data into queues
|
* Record all synchronization data into queues
|
||||||
*/
|
*/
|
||||||
bool zero_samples=true;
|
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
n_consume[i] = ninput_items[i];// full throttle
|
n_consume[i] = ninput_items[i];// full throttle
|
||||||
for (int j = 0; j < n_consume[i]; j++)
|
for (int j = 0; j < n_consume[i]; j++)
|
||||||
{
|
{
|
||||||
d_gnss_synchro_history_queue[i].push_back(in[i][j]);
|
d_gnss_synchro_history_queue[i].push_back(in[i][j]);
|
||||||
zero_samples=false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if there are new channel data available
|
|
||||||
//This is required because the combination of several GNSS tracking signals
|
|
||||||
//leads to a multirrate inputs that can not warantee that every channel will have new data
|
|
||||||
//and forecast method is set to zero samples for each channel to avoid blockings
|
|
||||||
if (zero_samples==true)
|
|
||||||
{
|
|
||||||
usleep(500); // run this task at up to 2 kHz rate
|
|
||||||
return 0; // No new samples in this call, thus, return.
|
|
||||||
}
|
|
||||||
|
|
||||||
bool channel_history_ok;
|
bool channel_history_ok;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user