There's already a "get_time_now" method swigged in the 
gr_uhd_usrp_{source,sink} block, along with a "get_time_last_pps" method if you 
need to synchronize to an absolute time.

Sean

From: discuss-gnuradio-bounces+sean.nowlan=gtri.gatech....@gnu.org 
[mailto:discuss-gnuradio-bounces+sean.nowlan=gtri.gatech....@gnu.org] On Behalf 
Of Alexander Olihovik
Sent: Friday, June 22, 2012 1:18 PM
To: j...@ettus.com
Cc: discuss-gnuradio@gnu.org
Subject: Re: [Discuss-gnuradio] Using the UHD API for Python Programming

For get_time_now(), would I need to swig multi_usrp.hpp?
On Fri, Jun 22, 2012 at 12:19 PM, Josh Blum 
<j...@ettus.com<mailto:j...@ettus.com>> wrote:


On 06/22/2012 07:33 AM, Alexander Olihovik wrote:
> Hi all,
> I'm having some trouble using the C++ UHD API for writing Python code.
> I understand that the code has been SWIG'd from C++ to Python.
>
>
> Specifically, the C++ code I want to convert to Python is:
> ---------------------------------------
> uhd::stream_cmd_t
> stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
> stream_cmd.num_samps = samps_to_recv;
> stream_cmd.stream_now = false;
> stream_cmd.time_spec = time_to_recv;
> usrp->issue_stream_cmd(stream_cmd);
>
Stream command is not swigged because the control of streaming is part
of gnuradio's scheduler. So start() and stop() get automatically called
by the scheduler. For convenience this is a set_command_time() to
control stream_cmd.time_spec.

Basically, gnuradio is handling the streaming for you. Think block-based
streaming model.

> uhd::time_spec_t cmd_time = usrp->get_time_now() + uhd::time_spec_t(0.1);
> usrp->set_command_time(cmd_time);
> usrp->set_rx_freq(1.03e9, 0/*ch0*/);
> usrp->set_rx_freq(1.03e9, 1/*ch1*/);
> usrp->set_clear_time();
This part is swigged.

-josh

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



--
Alex Olihovik
University of Virginia 2013
BS Electrical Engineering
BS Computer Engineering
ano...@virginia.edu<mailto:ano...@virginia.edu>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to