[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resetting Head block via callback

From: Jeff Long
Subject: Re: Resetting Head block via callback
Date: Sun, 13 Dec 2020 09:01:27 -0500

No, the Head block tells the framework that it is 'Done' after the specified number of items have been processed. The 'Done' state propagates through the flowgraph, block threads exit, etc. The only way to get things restarted is to rerun the flowgraph.

On Sun, Dec 13, 2020 at 7:21 AM Marcin Wachowiak <marcin.r.wachowiak@gmail.com> wrote:
I would like to ask if there is any possibility to reset Head block after it has signaled Done - after collecting a number of samples. A simple callback would be most preferred but only:  set_length is defined:

make: blocks.head(${type.size}*${vlen}, ${num_items})
- set_length(${num_items})
While there is a reset method defined in head_impl.h
void reset() { d_ncopied_items = 0; }
void set_length(uint64_t nitems) { d_nitems = nitems; }

I am unable to call it via call in flowgraph.py generated file due to lack of registered callback. (I already tried setting length to 0 and then back again, but it didn't reset the block). Should I simply register the callback like:

imports: from gnuradio import blocks
make: blocks.head(${type.size}*${vlen}, ${num_items})
- set_length(${num_items})
- reset()

and then rebuild gr-blocks? (and later commit it to GNU Radio github) Or is there a better solution?

What I am trying to achieve is triggering a measurement of N samples and saving it to a generated filename via QT GUI checkbox using a Selector and Head sink.
The renaming and file generation is already solved via callbacks, but after a single measurement trigger it only generates empty files - no data is fed into them.
Flowgraph img:
Triggering the measurement code: the reset() does not make any effect

def set_trigger_measurment(self, trigger_measurment):
self.trigger_measurment = trigger_measurment

if trigger_measurment == True:
self.blocks_file_sink_0.open(testbench_setup_pymodule.get_meas_path(self.distance, self.rx_gain, self.src_att, self.physical_aoa))


Kind regards,
Marcin Wachowiak

reply via email to

[Prev in Thread] Current Thread [Next in Thread]