Dear all,

I built an angle-of-arrival system using four Ettus USRP2. I'm facing a problem when trying to display a vector containing the calculated MUSIC-Spectrum using a “QT GUI Vector Sink”. The vector sink won't display any data for the first two minutes, and then it is starting to show very old values. When I use the block “Vector to Stream” and a simple “QT GUI Time Sink” instead, the values are displayed immediately without delay.

The block “music_cf” feeding the vector sink is a sync_decimator, generating one vector of 181 elements for every 1000 input samples. I've provided a shortened version of my c++ code in the attachment, without the actual mathematics.

What could be the reason for this huge delay when using the “QT GUI Vector Sink”? Is it a buffering problem?

Best regards,
Simon

Block Diagram:
http://fs1.directupload.net/images/150903/7cnqbzup.png
/* -*- c++ -*- */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include "music_cf_impl.h"
#include <Eigen/Dense>
#include <math.h>
#include <cmath>
#include <vector>

using Eigen::VectorXf;
using std::complex;
using namespace std;

namespace gr {
  namespace aoa {

    music_cf::sptr
    music_cf::make(float fc, float threshold, int vlen)
    {
      return gnuradio::get_initial_sptr
        (new music_cf_impl(fc, threshold, vlen));
    }

    /*
     * The private constructor
     */
    music_cf_impl::music_cf_impl(float fc, float threshold, int vlen)
      : gr::sync_decimator("music_cf",
              gr::io_signature::make(4, 4, sizeof(gr_complex)),
              gr::io_signature::make(1, 1, sizeof(float)*vlen), 1000),
	      d_fc(fc),
	      d_threshold(threshold),
	      d_vlen(vlen)
    {
    }

    /*
     * Our virtual destructor.
     */
    music_cf_impl::~music_cf_impl()
    {
    }

    int
    music_cf_impl::work(int noutput_items,
			  gr_vector_const_void_star &input_items,
			  gr_vector_void_star &output_items)
    {
        const gr_complex *in0 = (const gr_complex *) input_items[0];
	const gr_complex *in1 = (const gr_complex *) input_items[1];
        const gr_complex *in2 = (const gr_complex *) input_items[2];
	const gr_complex *in3 = (const gr_complex *) input_items[3];
	float *out = (float *) output_items[0];

	VectorXf Zf(d_vlen); // Float vector of length d_vlen from Eigen3 library

	// calculations to fill Zf with data not posted here

	float out_vector [d_vlen];
	for(int n=0; n<d_vlen; n++)
	{
	    if(isnan(Zf(n)))
	    {
		out_vector[n] = 0;
		cout << "isNaN" << endl;
	    }
	    else
	    {
		out_vector[n] = Zf(n);
	    }
	}

	memcpy(out, out_vector, d_vlen*sizeof(float));

        // Tell runtime system how many output items we produced.
        return 1;
    }

  } /* namespace aoa */
} /* namespace gr */

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to