Pipes

Is there a way of sending the data from the USRP to another application
using pipes?? I only know the basics of pipes, and need to look into it
more. I was going to try using TCP but thought pipes maybe easier. Also,
labview (the app i am sending it to) expects data over the TCP port to
be in
string format, which is another headache I’m not really prepared to
tackle.
My main issue is whether pipes can be done in using the available
GNURadio
libraries. I am guessing it maybe achieved using the
gr_file_descriptor_sink(), but I’m not sure how to write to the pipe
using
this.

Any ideas??

Regards Paul


Check out the latest video @ http://xtra.co.nz/streaming

On Tue, Jul 04, 2006 at 06:44:55AM +0000, paul munro wrote:

Any ideas??
Regards Paul

Hi Paul, you can use pipes or TCP. I suggest TCP, it’s really no
problem. In both cases, open the pipe / socket in python, then use
the foo.fileno() method to get the file descriptor. Use the file
descriptor with gr.file_descriptor_sink

Eric

Ok, I have tried the TCP method with no real success. I have set
GNUradio to
be the client, Labview as the server. They connect, then the python
script
disconnects with errors before any data is communicated. I have tried a
couple of different methods. 1) no framing or correlator, and
2) with gr.simple_correlator(1024)

My code is as follows:

        # write to fd (socket)
        fd = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
    self.conn = fd.connect(('0.0.0.0',options.socket))
        print "Connecting to:", self.conn
        print "Address:", self.conn
        # sink to file descriptor
        self.dst = gr.file_descriptor_sink (gr.sizeof_gr_complex,

fd.fileno())
print (“data to socket”)

        self.connect(self.u, self.dst)

       #self.corr = gr.simple_correlator (1024)
 	   #self.connect(self.u, self.corr, self.dst)

1)when using no correlator the error I get is:
gr_file_descriptor_sink: Bad file descriptor

  1. when using gr.simple_correlator(8) the error is:
    File
    “/usr/local/lib/python2.3/site-packages/gnuradio/gr/basic_flow_graph.py”,
    line
    242, in _check_type_match
    raise ValueError, ‘source and destination data sizes are
    different’

From what I can gather, Labview reads x bytes (8 in my case) in string
format. This string can then be recast to complex. I have done this
reading
from a file and pipes with no problems. I’m not sure if the problem is
the
tcp control or a lower level of gnuradio.

Any suggestions??

Regards Paul

labview (the app i am sending it to) expects data over the TCP port to
Any ideas??
Regards Paul

Hi Paul, you can use pipes or TCP. I suggest TCP, it’s really no
problem. In both cases, open the pipe / socket in python, then use
the foo.fileno() method to get the file descriptor. Use the file
descriptor with gr.file_descriptor_sink

Eric


Don?t just search. Find. Check out the new MSN Search!
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

On Wed, Jul 05, 2006 at 10:32:36AM +0000, paul munro wrote:

  self.conn = fd.connect(('0.0.0.0',options.socket))
	   #self.connect(self.u, self.corr, self.dst)

I’m pretty sure that “fd” is going out of scope and thus the underlying
file descriptor is closed.

This is what is causing:

1)when using no correlator the error I get is:
gr_file_descriptor_sink: Bad file descriptor

Try assigning it to self.fd = socket.socket(…)

  1. when using gr.simple_correlator(8) the error is:
    File
    “/usr/local/lib/python2.3/site-packages/gnuradio/gr/basic_flow_graph.py”,
    line
    242, in _check_type_match
    raise ValueError, ‘source and destination data sizes are
    different’

You’ve got to connect things with the same size ins and outs together.
Sorry, the error message could use some improvement. It should tell
you the blocks involved.

From what I can gather, Labview reads x bytes (8 in my case) in string
format. This string can then be recast to complex. I have done this reading
from a file and pipes with no problems. I’m not sure if the problem is the
tcp control or a lower level of gnuradio.

It’s your python code. No problem with TCP or GNU Radio.

Any suggestions??

Start with something more simple. E.g., have GNU Radio generate a
complex sinusoid using gr.sig_source_c and use TCP to send it to
labview.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs