I'm using the GNURadio python interface to UHD, and I'm trying to set a
specific time to start collecting samples and either collect a specific
number of samples or stop the collection of samples at a specific time.
Essentially, creating a timed snapshot of samples. This is something
similar to the C++ Ettus UHD example 'rx_timed_sample'.

I can get a flowgraph to start at a specific time, but I can't seem to get
it to stop at a specific time (at least without causing overflows). I've
also tried doing a finite aquisition, which works, but I can't get it to
start at a specific time. So I'm kind of lost at what to do next.

Here is my try at the finite acquisition (seems to just ignore the start
time and collects 0 samples):

num_samples = 1000

usrp = uhd.usrp_source(
    ",".join(("", "")),
    uhd.stream_args(
        cpu_format="fc32",
        channels=range(1),
    ),
)

...

usrp.set_start_time(absolute_start_time)
samples = usrp.finite_acquisition(num_samples)


I've also tried some combinations of following without success (TypeError:
in method 'usrp_source_sptr_issue_stream_cmd', argument 2 of type
'::uhd::stream_cmd_t const &'):

usrp.set_command_time(absolute_start_time)
usrp.issue_stream_cmd(uhd.stream_cmd.STREAM_MODE_NUM_SAMPS_AND_DONE)
I also tried the following in a flowgraph:

...
usrp = flowgrah.uhd_usrp_source_0
absolute_start_time = uhd.uhd_swig.time_spec_t(start_time)
usrp.set_start_time(absolute_start_time)

flowgrah.start()

stop_cmd = uhd.stream_cmd(uhd.stream_cmd.STREAM_MODE_STOP_CONTINUOUS)
absolute_stop_time = absolute_start_time +
uhd.uhd_swig.time_spec_t(collection_time)

usrp.set_command_time(absolute_stop_time)
usrp.issue_stream_cmd(stop_cmd)

For whatever reason the flowgraph one generated overflows consistently for
anything greater than a .02s collection time.

I posted this question on stack overflow without any success:
http://stackoverflow.com/questions/43420300/how-to-receive-a-finite-number-of-samples-at-a-future-time-using-uhd-gnuradio

Any help would be greatly appreciated!!

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

Reply via email to