Error in python (XML file)

Dear all,

I am trying to modify the USRP2 block so that the timer is reset at the
beginning. I added this line to the make tag in the xml file:

self.$(id).set_time_at_next_pps(time_spec_t(0,0))

I receive this error:

Traceback (most recent call last):
File “/media/ZOHAIR/top_block.py”, line 64, in
tb = top_block()
File “/media/ZOHAIR/top_block.py”, line 36, in init
self.usrp2_sync_source_xxxx_0.set_time_at_next_pps(time_spec_t(0,0))
NameError: global name ‘time_spec_t’ is not defined

Any help or hint please? I am using GRC 3.3git-23e45f33

Cheers,
Zoh

View this message in context:
http://old.nabble.com/Error-in-python-(XML-file)-tp29022268p29022268.html
Sent from the GnuRadio mailing list archive at Nabble.com.

I also tried this:
zeroise=usrp2.time_spec_t(0,0)
self.$(id).set_time_at_next_pps(zeroise)

and receive:
Traceback (most recent call last):
File “/media/ZOHAIR/top_block.py”, line 66, in
tb = top_block()
File “/media/ZOHAIR/top_block.py”, line 35, in init
zeroise=usrp2.time_spec_t(0,0)
AttributeError: ‘module’ object has no attribute ‘time_spec_t’

The problem in my code or in time_spec_t accessibility? What do you
think?

Thanks
Zohair

Zohair wrote:

Traceback (most recent call last):


View this message in context:
http://old.nabble.com/Error-in-python-(XML-file)-tp29022268p29022492.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Zohair,

You can check what is in the module like so: python -c “from gnuradio
import usrp2; print dir(usrp2)”
[‘MC_PROVIDE_CLK_TO_MIMO’, ‘MC_WE_DONT_LOCK’, ‘MC_WE_LOCK_TO_MIMO’,
‘MC_WE_LOCK_TO_SMA’, ‘SwigPyIterator’, ‘SwigPyIterator_swigregister’,
‘_MC_MIMO_CLK_INPUT’, ‘_MC_WE_LOCK’, ‘__adc_rate’, ‘builtins’,
‘__dac_rate’, ‘__daughterboard_id’, ‘__default_tx_scale_iq’, ‘doc’,
file’, ‘__fpga_master_clock_freq’, ‘__freq_range’, ‘__gain_range’,
name’, ‘package’, ‘__read_gpio’, ‘__set_center_freq’,
‘_newclass’, ‘_object’, ‘_swig_getattr’, ‘_swig_property’, ‘_swig_repr’,
‘_swig_setattr’, ‘_swig_setattr_nondynamic’,
‘_swig_setattr_nondynamic_method’, ‘_usrp2’, ‘cvar’, ‘deref_int_ptr’,
‘deref_long_ptr’, ‘deref_uint16_ptr’, ‘free_int_ptr’, ‘free_long_ptr’,
‘free_uint16_ptr’, ‘make_int_ptr’, ‘make_long_ptr’, ‘make_uint16_ptr’,
‘rx_metadata’, ‘rx_metadata_swigregister’, ‘sink_16sc’, ‘sink_32fc’,
‘sizeof_char’, ‘sizeof_double’, ‘sizeof_float’, ‘sizeof_gr_complex’,
‘sizeof_int’, ‘sizeof_short’, ‘source_16sc’, ‘source_32fc’,
‘tune_result’, ‘tune_result_swigregister’, ‘tx_metadata’,
‘tx_metadata_swigregister’, ‘uint32_t_vector’,
‘uint32_t_vector_swigregister’, ‘usrp2_base’, ‘usrp2_base_swigregister’,
‘usrp2_sink_16sc_sptr’, ‘usrp2_sink_16sc_sptr_swigregister’,
‘usrp2_sink_32fc_sptr’, ‘usrp2_sink_32fc_sptr_swigregister’,
‘usrp2_sink_base’, ‘usrp2_sink_base_swigregister’,
‘usrp2_source_16sc_sptr’, ‘usrp2_source_16sc_sptr_swigregister’,
‘usrp2_source_32fc_sptr’, ‘usrp2_source_32fc_sptr_swigregister’,
‘usrp2_source_base’, ‘usrp2_source_base_swigregister’]

Looks like time_spec is not present. The gr-usrp2 swig file probably
needs a line added: %include <usrp2/usrp2.h>
This is where the time spec is defined.

I encourage you to use the UHD if you are interested in timestamped
samples if you want a supported solution that works with the latest
gnuradio:
http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/wiki

It also seems that I need to add the import for time_spec_t to the
uhd_swig.i file :slight_smile:

-Josh

I thought I should give UHD a go and have switched now to using it
instead
for the VRT branch. Again, I want to test the sample alignment for
multiple
USRP’s. ( Big thanks to you Josh for adding the time facilities three
days a
go)
I have modified the XML file as below:
uhd.simple_source($args, uhd.io_type_t.$type.type)
self.$(id).set_samp_rate($samp_rate)
self.$(id).set_center_freq($center_freq)
self.$(id).set_gain($gain)
#if $ant()
self.$(id).set_antenna($ant)
#end if
self.$(id).set_time_next_pps(uhd.time_spec_t(0,0)) <==============
time.sleep(1)
<==============

Now my questions are:
1- Is it enough to do this? Shouldn’t I tell the USRP2 to start
streaming at
a specific timestamp? I have looked into the UHD files but wasn’t able
to
spot a function to do this, though.

2- If I don’t use the clock_config, what are the defaults?

3- In the runtime, how can I print the received packet timestamp to make
sure they are aligned?

Waiting to hear from you.

Best,

Zohair

View this message in context:
http://old.nabble.com/Error-in-python-(XML-file)-tp29022268p29063451.html
Sent from the GnuRadio mailing list archive at Nabble.com.

1- Is it enough to do this? Shouldn’t I tell the USRP2 to start streaming at
a specific timestamp? I have looked into the UHD files but wasn’t able to
spot a function to do this, though.

yes, the stream_cmd must have a time stamp specified so both usrp2s
start streaming at the exact same time. Currently, it defaults to
stream now:
http://www.ettus.com/uhd_docs/doxygen/html/structuhd_1_1stream__cmd__t.html

this change will require modifications to the gr-uhd source in the
call to issue_stream_cmd

2- If I don’t use the clock_config, what are the defaults?

internal ref clock, sma pps

3- In the runtime, how can I print the received packet timestamp to make
sure they are aligned?

print the first metadata.time_spec in the gr-uhd source work function

should you be willing to wait, I am working on exactly this issue of
multiple usrp2 alignment and I hope to push something up next week
when I get it all working.

-Josh

Sounds good! I will start working on this tomorrow and if I get it
working
that’s good. if not, I will wait till you push it.

Thanks a lot.

Zohair

Josh B.-2 wrote:

http://www.ettus.com/uhd_docs/doxygen/html/structuhd_1_1stream__cmd__t.html

Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://old.nabble.com/Error-in-python-(XML-file)-tp29022268p29068054.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi Josh,

Thanks for replying.

I tried what you told me to do. I added %include<usrp2/usrp2.h> and
maked
the directory. However, I receive this error;

usrp2.cc: In function ‘PyObject*
_wrap_usrp2_start_rx_streaming(PyObject*,
PyObject*, PyObject*)’:
usrp2.cc:7970: error: ‘time_spec_t’ was not declared in this scope

This line has:
usrp2::time_spec_t const &arg3_defvalue = time_spec_t() ;

Before this line there are a lot of occurrences of time_spec_t and there
is
no compiling error. This means that the usrp2.h is indeed accessed but
why
do you think I receive this error? Any clue or hint, please?

Cheers,
Zohair

Josh B.-2 wrote:

name’, ‘package’, ‘__read_gpio’, ‘__set_center_freq’,
‘uint32_t_vector_swigregister’, ‘usrp2_base’, ‘usrp2_base_swigregister’,

On 06/29/2010 03:38 AM, Zohair wrote:

Traceback (most recent call last):


Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


View this message in context:
http://old.nabble.com/Error-in-python-(XML-file)-tp29022268p29033168.html
Sent from the GnuRadio mailing list archive at Nabble.com.