AttributeError: uhd module object has no attribute 'stream_cmd'

Dear all,

I am using self.stream_cmd = uhd.stream_cmd() in Python to define how
the devices send samples to the host, though got an AttributeError:
‘module’ object has no attribute ‘stream_cmd’. I checked the definition
of stream_cmd, which is an attribute of uhd and similar as clock_config.
I am wondering what is the problem here, and what causes this error?

Any of your answer would be greatly appreciated.

Thanks,
Yan

On 11/07/2011 09:16 AM, Yan N. wrote:

Dear all,

I am using self.stream_cmd = uhd.stream_cmd() in Python to define how
the devices send samples to the host, though got an AttributeError:
‘module’ object has no attribute ‘stream_cmd’. I checked the
definition of stream_cmd, which is an attribute of uhd and similar as
clock_config. I am wondering what is the problem here, and what
causes this error?

I dont thing stream command has been “swigged” up into python. This is
because starting and stopping is handled by the scheduler which is
written in c++. So there was not a need to issue stream commands in
python.

-josh

Really appreciate your answer, Josh.

I am wondering how to control data streaming from devices to host in
Python, if the stream command issuing approaching cannot work in Python?
What I am trying to do is detecting pps pulse then 2ms later start
receiving data from USRP N200. The received data will feed in next block
of the flowgraph.

Thanks,
Yan

On 11/07/2011 03:50 PM, Yan N. wrote:

Really appreciate your answer, Josh.

I am wondering how to control data streaming from devices to host in
Python, if the stream command issuing approaching cannot work in
Python? What I am trying to do is detecting pps pulse then 2ms later
start receiving data from USRP N200. The received data will feed in
next block of the flowgraph.

Basically, the way python controls streaming is to call tb.start() or
tb.stop(). I realize that isnt a lot of control.

Option 1) Consider making a modification so that the user (you) can
specify the time that the streaming will start. Basically an API call
like uhd.set_stream_time(). Where will be used in the
source block’s start() method… Or more simply, forget the API change,
and hardcode the start-time that you want into the source block.

Option 2) The USRP source already tags the samples with a timestamp. You
dont need to control when streaming begins, because your donwnstream
block can determine the time of any sample using tags (aka packet
metadata).

Option 3) Post messages into the source block to control streaming. This
is a more advanced feature that isnt yet implemented either in the
source block or from an API perspective. I mention it, because this is
something I may add in the near future once my message passing work gets
merged.

Options 1 or 2 are probably most practical for you.

-Josh