discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How to pass time tag into usrp sink as a paramete


From: Rui Zou
Subject: Re: [Discuss-gnuradio] How to pass time tag into usrp sink as a parameter ?[hurry...]
Date: Wed, 17 Dec 2014 22:44:38 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

Hi, Marcus,
I read the doc and examples you recommended, but I still don't understand fully how to implement my wok.
Sorry for my previous omission that the first line of my flow graph design is:
usrp_source -> ptk_dtc -> grab_time_tag -> usrp_sink
1. Here is the work function of my grab_time_tag block(not finished), I don't know how to code next:
    const float *sigin = (const float *) input_items[0];
   const unsigned char *detect = (const unsigned char *) input_items[1];
   pmt::pmt_t *out = (pmt::pmt_t *) output_items[0];
   
   std::vector<gr::tag_t> rx_time_tags;
   const uint64_t samp0_count = this->nitems_read(0);

   for(i = 0; i < ninput_items; i++){
       if (detect[0]){
           get_tags_in_range(rx_time_tags, 0, samp0_count, samp0_count+1,
               pmt::string_to_symbol("rx_time"));
           break;
       }
   }

2. I want to send acks at an intended time at usrp_sink, how to pass this time information into usrp_sink?
I know a C++ method gr::uhd::usrp_sink::set_command_time, but don't know how to use it.
What also confuses me is:
if I construct a usrp_sink object in python, how to pass the time information posted from grab_time_tag into it? (They are not at the same level after all). IMHO, Python is not something valuable. It's just to build block objects and connect them.
but if I do the job in C++, does it mean I have to rewrite a new usrp_sink block(sounds impratical) to receive the desired time value posted from grab_time_tag ? or else?

BTW, the file_sink/source was just for testing.
I 'm purely a green hand. If something is wrongly understood, please correct me with no hesitation.
Hope your kind reply in specific details on the two query above. Many thanks!

在 2014年12月17日 00:34, Marcus Müller 写道:
Hello Rui,

why do you take the detour through a file? That looks unnecessary.

the USRP sink understands transmission times you specify using tags [1],
so this will be the easiest way to deal with this. You just need to
write a really short block (in C++ or python, whatever you prefer) which
takes the rx_time tag that the USRP source added to the sample stream
and generates a tag with the desired point in time [2].

There are some examples of the rx_time and tx_time tags usage in gr-uhd,
so just search for "tx_time" or "rx_time" in gnuradio/gr-uhd/examples/ .

Greetings,
Marcus

[1] http://gnuradio.org/doc/doxygen/page_stream_tags.html
[2] http://gnuradio.org/doc/doxygen/page_stream_tags.html
On 12/16/2014 05:21 PM, Rui Zou wrote:
Hello,
I would like to implement the process as follows at the Rx side:
Record the time when the first sample arrived, and then wait for a
certain interval and then send ack back to Tx. Meanwhile, finish the
cfo calculating and compensating.
Here is my whole flow graph design. (Each means a block)

                           pkt_dtc-> cfo_calc -> file_sink
                                            cfo_calc -> cfo_cpst
                                       file_source -> cfo_cpst ->
usrp_sink

where pkt_dtc, grab_time_tag and cfo_calc was done myself with C++.
However, My question are:
1. Is it correct of my whole desgin (I want to implement them in one
top block) or are there any easier solutions ?
2. After the block grab_time_tag, how should I pass the time
information (directly got from the method get_tags_in_range) into the
usrp_sink as a parameter so as to send ack at the intended time?
Should I write in Python(but they are not the same level) or C++(but I
can't rewrite a usrp_sink) ?

Any doubts or suggestions are highly appreciated !




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

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


reply via email to

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