Forum: GNU Radio cannot make new signal processing block

Posted by nexy_sm (Guest)
on 2012-10-09 09:51
(Received via mailing list)
Hi all,

I am currently following the instructions for building new signal 
processing
block. I have downloaded complete folder as it was stated. The problem 
is
when I enter folder topdir/src.python and run make check I have the
following error:

[savi_ne@ts python]$ make check
make: *** No rule to make target `check'.  Stop.

Thanks in advance



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Martin Braun (CEL) (Guest)
on 2012-10-09 11:30
(Received via mailing list)
Hi nexy_sm,

read again:
http://gnuradio.org/redmine/projects/gnuradio/wiki...

The command 'make check' is nowhere in the instructions for building a
new signal processing block.

M

On Tue, Oct 09, 2012 at 12:50:38AM -0700, nexy_sm wrote:
> Thanks in advance
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Posted by Nemanja Savic (Guest)
on 2012-10-09 12:30
(Received via mailing list)
Hi all,

in fact, I was following instructions from

http://www.gnu.org/software/gnuradio/doc/howto-wri...

And the problem was bad reference to the PKG_CONFIG_PATH.

I see that in the instructions you sent me and inistructions that I was
following, building folders are different.
Posted by Martin Braun (CEL) (Guest)
on 2012-10-10 09:56
(Received via mailing list)
On Tue, Oct 09, 2012 at 12:28:57PM +0200, Nemanja Savic wrote:
> http://www.gnu.org/software/gnuradio/doc/howto-wri...
>
> And the problem was bad reference to the PKG_CONFIG_PATH.
>
> I see that in the instructions you sent me and inistructions that I was
> following, building folders are different.

That's ancient docs... didn't you read the sell-by date? :)
Just go to gnuradio.org and follow the instructions. They're really
impossible to miss.

Johnathan/Tom, can you take that old stuff down? Outdated docs are
poison, if you ask me.

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Posted by Tom Rondeau (Guest)
on 2012-10-10 15:18
(Received via mailing list)
On Wed, Oct 10, 2012 at 3:55 AM, Martin Braun (CEL)
<martin.braun@kit.edu> wrote:
> impossible to miss.
>
> Johnathan/Tom, can you take that old stuff down? Outdated docs are
> poison, if you ask me.
>
> MB

It's hosted on gnu.org, and I don't have access to edit it. I'll have
to contact the FSF webmaster and ask him to remove it.

Tom
Posted by nexy_sm (Guest)
on 2012-10-11 16:13
(Received via mailing list)
Hallo again guys,

I followed instructions on the proposed website. Everything "was fine" 
until
I had to run test. Even when I run make test from gr-how-to-write-block
folder which comes with the installation tets fail.

Running tests...
Start processing tests
Test project /home/savi_ne/work/gnuradio/gr-howto/build
  1/  1 Testing qa_howto                      ***Failed

0% tests passed, 1 tests failed out of 1

The following tests FAILED:
    1 - qa_howto (Failed)
Errors while running CTest
make: *** [test] Error 8

Any suggestions?



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Tom Rondeau (Guest)
on 2012-10-11 16:53
(Received via mailing list)
On Thu, Oct 11, 2012 at 10:11 AM, nexy_sm <vlasinac@gmail.com> wrote:
>
> 0% tests passed, 1 tests failed out of 1
>
> The following tests FAILED:
>           1 - qa_howto (Failed)
> Errors while running CTest
> make: *** [test] Error 8
>
> Any suggestions?

Can you run this instead of 'make test':

ctest -V

That will give more output information about what's happening during the 
test.

Tom
Posted by nexy_sm (Guest)
on 2012-10-12 09:48
(Received via mailing list)
Ok, I run the suggested command. And the problem is in importing module:


UpdateCTestConfiguration  from
:/home/savi_ne/work/gnuradio/gr-howto/build/DartConfiguration.tcl
Start processing tests
UpdateCTestConfiguration  from
:/home/savi_ne/work/gnuradio/gr-howto/build/DartConfiguration.tcl
Test project /home/savi_ne/work/gnuradio/gr-howto/build
Constructing a list of tests
Done constructing a list of tests
Changing directory into 
/home/savi_ne/work/gnuradio/gr-howto/build/python
  1/  1 Testing qa_howto
Test command: /bin/sh
/home/savi_ne/work/gnuradio/gr-howto/build/python/qa_howto_test.sh
Test timeout computed to be: 9.99988e+06
Traceback (most recent call last):
  File "/home/savi_ne/work/gnuradio/gr-howto/python/qa_howto.py", line 
24,
in <module>
    import howto_swig
ImportError: No module named howto_swig
-- Process completed
***Failed

0% tests passed, 1 tests failed out of 1

The following tests FAILED:
    1 - qa_howto (Failed)
Errors while running CTest

Any suggestions?
In the line that causes the error is written following:
import howto_swig # Can't import howto because that module does not yet
exist

Regards



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Tom Rondeau (Guest)
on 2012-10-12 17:40
(Received via mailing list)
On Fri, Oct 12, 2012 at 3:47 AM, nexy_sm <vlasinac@gmail.com> wrote:
> Done constructing a list of tests
> -- Process completed
> import howto_swig # Can't import howto because that module does not yet
> exist
>
> Regards

Looks like you haven't done the installation properly. Is the SWIG
interface file correct? All of the CMakeLists.txt files updated?
What's your install path? If it's not a standard path (/usr,
/usr/local) you'll have to make sure Python knows where to find it
(PYTHONPATH=...).

Have you looked at using gr_modtool.py
(https://github.com/mbant/gr-modtool)? It helps make sure the setup is
done correctly to install everything properly.

Tom
Posted by nexy_sm (Guest)
on 2012-10-12 20:06
(Received via mailing list)
Python path is OK. Gnuradio works fine, I have tried some examples using 
GRC,
etc.

I also used gr-modtool like it was explained on the website.
I haven't looked at swig interface file since it was not part of the
tutorial, but I think it should have been generated correctly by 
gr-modtool.

How can I check installation of the SWIG?

Anyway I will not have chance to try anything until monday.

Regards and thanks



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by nexy_sm (Guest)
on 2012-10-15 12:16
(Received via mailing list)
Any suggestions how to make this thing working?



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Tom Rondeau (Guest)
on 2012-10-15 16:25
(Received via mailing list)
On Fri, Oct 12, 2012 at 2:04 PM, nexy_sm <vlasinac@gmail.com> wrote:
> Python path is OK. Gnuradio works fine, I have tried some examples using GRC,
> etc.

Have you verified that that module is actually installed where you
think it is? If you are just building the gr-howto-write-a-block like
this:

cmake -DCMAKE_INSTALL_PREFIX=/opt/howto [path to 
source]/gr-howto-write-a-block
make && sudo make install

When you look in /opt/howto/lib/python2.7/dist-packages, you will find
a 'howto' directory. Under that, you'll find:

howto_swig.py
howto_swig.pyc
howto_swig.pyo
_howto_swig.so
__init__.py
__init__.pyc
__init__.pyo

All of those files have to be there. Then, if
PYTHONPATH=/opt/howto/lib/python2.7/dist-packages, you can 'import
howto' from inside Python.

Tom
Posted by nexy_sm (Guest)
on 2012-10-15 17:25
(Received via mailing list)
Finaly it works.
Thanks!!!!!!!!!!!!!!!!!!!!!!!



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Tom Rondeau (Guest)
on 2012-10-15 18:10
(Received via mailing list)
On Mon, Oct 15, 2012 at 11:24 AM, nexy_sm <vlasinac@gmail.com> wrote:
> Finaly it works.
> Thanks!!!!!!!!!!!!!!!!!!!!!!!

That's great!

Can you say a few words about what you did to get it working for the
benefit of others that might be having problems?

Tom
Posted by nexy_sm (Guest)
on 2012-10-16 11:10
(Received via mailing list)
Of course, that's at least what I can do.

First of all, I would like to say that the biggest problem was lack of 
my
knowledge in Linux.
I was strictly following instructions from gnuradio.org about making out 
of
tree signal processing block, and there is not stated that i have to do
/make install/ before testing module.
Also, nowhere is stated stest -V, for getting more error information, 
and
also using -DCMAKE_INSTALL_PREFIX, whish is used for setting base 
address or
whatever.

Maybe somebody should make detailed tutorials, for the people that knows
only signal processing, not Linux, just for smooth start, unti they get
used.

Regards
Nemanja



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Martin Braun (CEL) (Guest)
on 2012-10-16 11:27
(Received via mailing list)
On Tue, Oct 16, 2012 at 02:08:42AM -0700, nexy_sm wrote:
> First of all, I would like to say that the biggest problem was lack of my
> knowledge in Linux.
> I was strictly following instructions from gnuradio.org about making out of
> tree signal processing block, and there is not stated that i have to do
> /make install/ before testing module.

Hm, you shouldn't need to do that. (That's why it's not in the
instructions.)

> Also, nowhere is stated stest -V, for getting more error information, and
> also using -DCMAKE_INSTALL_PREFIX, whish is used for setting base address or
> whatever.

That's already what I'd consider 'advanced' usage, which is why it's not
in the tutorial, either. Although I guess 'ctest -V' could be in there.

> Maybe somebody should make detailed tutorials, for the people that knows
> only signal processing, not Linux, just for smooth start, unti they get
> used.

Since you just went through the process, how about writing something
while the knowledge is still fresh?

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Posted by nexy_sm (Guest)
on 2012-10-16 12:15
(Received via mailing list)
Do you mean some kind of tutorial or what?

Well, that means that my test don't work, since you said that make 
install
isn't necesary.

So, let's start again, what might be a problem?



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Martin Braun (CEL) (Guest)
on 2012-10-16 13:20
(Received via mailing list)
On Tue, Oct 16, 2012 at 03:14:31AM -0700, nexy_sm wrote:
> Do you mean some kind of tutorial or what?
>
> Well, that means that my test don't work, since you said that make install
> isn't necesary.
>
> So, let's start again, what might be a problem?

That's still impossible to tell from what you've written.
I've just checked that gr_modtool and the tutorial are correct.

Here's what I did:

1) Create an out-of-tree module

~/tmp % gr_modtool.py create test
Module directory is "./gr-test".
Creating directory...
Copying howto example...
Unpacking...
Replacing occurences of 'howto' to 'test'... Done.
Use 'gr_modtool add' to add a new block to this currently empty module.

2) Then, I add a sync-block:

~/tmp% cd gr-test
tmp/gr-test % gr_modtool.py add -t sync square_ff
Operating in directory .
GNU Radio module name identified: test
Code is of type: sync
Block/code identifier: square_ff
Enter valid argument list, including default arguments:
Add Python QA code? [Y/n]
Add C++ QA code? [Y/n] n
Traversing lib...
Adding file 'square_ff_impl.h'...
Adding file 'square_ff_impl.cc'...
Adding file 'square_ff.h'...
Traversing swig...
Editing swig/test_swig.i...
Traversing python...
Adding file 'qa_square_ff.py'...
Editing python/CMakeLists.txt...
Traversing grc...
Adding file 'test_square_ff.xml'...
Editing grc/CMakeLists.txt...

3) Next, I edit the work() function of the block (this only needs one
line to be changed) to look like this:
Before this is done, the 'make' command won't work!

{
        const float *in = (const float *) input_items[0];
        float *out = (float *) output_items[0];

        for (int i = 0; i < noutput_items; i++) {
                out[i] = in[i] * in[i];
        }

        // Tell runtime system how many output items we produced.
        return noutput_items;
}

4) Finally, I edit the file python/qa_square_ff.py such that the test 
case contains this:
Before this is done, the 'make test' or 'ctest' commands won't work!

    def test_001_t (self):
        test_data = (1, 2, 3, 4)
        correct_res = (1, 4, 9, 16)
        sink = gr.vector_sink_f()
        self.tb.connect(gr.vector_source_f(test_data), test.square_ff(), 
sink)
        self.tb.run()
        self.assertEqual(sink.data(), correct_res)


Then, I go to the build directory and invoke the make process:

gr-test/build % cmake .. # Output omitted
gr-test/build % make # Output omitted
gr-test/build % make test
Running tests...
Test project /home/braun/tmp/gr-test/build
    Start 1: test_test
1/2 Test #1: test_test ........................   Passed    0.02 sec
    Start 2: qa_square_ff
2/2 Test #2: qa_square_ff .....................   Passed    0.23 sec

100% tests passed, 0 tests failed out of 2



The End.

This entire process took me less than 10 minutes. If you're taking
longer, you're wasting time.

Other notes:
* I never installed
* The only editing necessary was three lines in the work() function and 
the
  test case in qa_square_ff


So go through your module once again, start from scratch and it will
work.

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Posted by Tom Rondeau (Guest)
on 2012-10-16 16:47
(Received via mailing list)
On Tue, Oct 16, 2012 at 5:08 AM, nexy_sm <vlasinac@gmail.com> wrote:
>
> Maybe somebody should make detailed tutorials, for the people that knows
> only signal processing, not Linux, just for smooth start, unti they get
> used.
>
> Regards
> Nemanja

Unfortunately, you cannot separate the signal processing of SDR from
the operating system. You need to understand a bit of each if you're
going to do anything really, truly useful. So while you're struggling
to get some of this stuff started, you are also learning a lot about
Linux and the build tools. This will serve you immeasurably well in
the future. I am right now struggling through similar issues with OSX.

That having been said, we are slowly producing more information to
help people out. Look at the Doxygen manual that get's generated when
you install GNU Radio. There's a lot more information in there to help
people understand some features of GNU Radio and of the build system.
The -V 'trick' for ctest is kind of outside of the scope of GNU Radio.
That's something that's documented with ctest. I learned about this
myself by just searching for help on getting information out of 'make
test.'

One of the biggest problems we can have as developers is that we are
probably the worst people to document the code, especially features
like what you are talking about. It's hard to know what others don't
know. A lot of what is on the instructions and manuals that I've put
in are because I was just learning something, like using cmake
properly, and thought, "oh, this is something that should be
documented." We have to rely on people to help us put this together.

Tom
Posted by nexy_sm (Guest)
on 2012-10-17 17:14
(Received via mailing list)
Ok, I suppose the best and fastest way to learn gnuradio is by exploring
simple existing blocks, like adder for example.
I was first thinking about adder and the opened gr_add_cc.h.

I was immediately stuck in the constructor part

gr_add_cc::gr_add_cc (size_t vlen)
  : gr_sync_block ("add_cc",
       gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen),
       gr_make_io_signature (1,  1, sizeof (gr_complex)*vlen)),
  d_vlen (vlen)
{
}

I was expecting something like:

gr_add_cc::gr_add_cc (size_t vlen)
  : gr_sync_block ("add_cc",
       gr_make_io_signature (1, vlen, sizeof (gr_complex)),
       gr_make_io_signature (1,  1, sizeof (gr_complex))),
  d_vlen (vlen)
{
}

I don't really understand this line:

 gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen)

Can you just explain breafly what is idea behind, cause i was expecting
something more simpler.

Thanks



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by nexy_sm (Guest)
on 2012-10-17 17:46
(Received via mailing list)
Hm, I see now, and don't get, how you specifu number of inputs, and what
exactly means Vec Length (vlen)

and what could be wrong with implementation like this:

int
gr_add_cc::work (int noutput_items,
       gr_vector_const_void_star &input_items,
       gr_vector_void_star &output_items)
{
  gr_complex *optr = (gr_complex *) output_items[0];

  int ninputs = input_items.size ();

  for (size_t i = 0; i < noutput_items; i++){
    gr_complex acc = ((gr_complex *) input_items[0])[i];
    for (int j = 1; j < ninputs; j++)
      acc += ((gr_complex *) input_items[j])[i];

    *optr++ = (gr_complex) acc;
  }
  return noutput_items;
}

And just one question, in the block gr_add_const_ff, you did loop 
unrolling
by yourself, is that because you don't believe to the compiler or 
something
else?

Thanks again
Nemanja



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by Martin Braun (CEL) (Guest)
on 2012-10-17 18:41
(Received via mailing list)
On Wed, Oct 17, 2012 at 08:45:21AM -0700, nexy_sm wrote:
> Hm, I see now, and don't get, how you specifu number of inputs, and what
> exactly means Vec Length (vlen)

Read this:
http://gnuradio.org/redmine/projects/gnuradio/wiki...

> and what could be wrong with implementation like this:
> [garbled code]

It doesn't specify the vlen (that's what's wrong).

> And just one question, in the block gr_add_const_ff, you did loop unrolling
> by yourself, is that because you don't believe to the compiler or something
> else?

gr_add_const_ff is pretty old, you should check out
gr-blocks/lib/add_const_vXX_impl.cc.t.

And yes, there's a lot of hand-optimized code.

MB

--
Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin Braun
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT -- University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association
Posted by Tom Rondeau (Guest)
on 2012-10-17 19:42
(Received via mailing list)
On Wed, Oct 17, 2012 at 11:13 AM, nexy_sm <vlasinac@gmail.com> wrote:
>   d_vlen (vlen)
> {
> }
>
> I don't really understand this line:
>
>  gr_make_io_signature (1, -1, sizeof (gr_complex)*vlen)
>
> Can you just explain breafly what is idea behind, cause i was expecting
> something more simpler.
>
> Thanks

It is actually quite simple, you just have a misunderstanding of what
it's supposed to be doing.

The first call is to set the input signature:
   gr_make_io_signature(min inputs, max inputs, input item size)

The second one is for the output signature:
   gr_make_io_signature(min outputs, max outputs, output item size)

The min value specifies how many inputs MUST be connected. The max
value says how many CAN be connected. A value of -1 means it's
undefined and any number can be connected.

The item size is the size in bytes of each item. So for floats, this
is sizeof(float). If you want to handle vectors, you treat the vector
as an item. So a vector of vlen floats has a size
'sizeof(float)*vlen'.

Tom
Posted by nexy_sm (Guest)
on 2012-10-17 22:17
(Received via mailing list)
Ok, thanks for the explanation and link with more information.
Is there any benefit of using for example adder block which calculates
output using input vectors, then using single flat or whatever.

I expect that for calculating for example FFT one usually need packets 
of
512 or 256, etc samples, and then you have to provide precise number of
samples at the input.

I have to take another look on adder block tomorrow, but I couldn't find
today, how is specified number of inputs. Since u can input any number 
of
inputs in GRC for that block, I would expect that value specified inside 
of
constructor.

Thanks
Regards
Nemanja



--
View this message in context: 
http://gnuradio.4.n7.nabble.com/cannot-make-new-si...
Sent from the GnuRadio mailing list archive at Nabble.com.
Posted by adarsh j. (adarsh_j)
on 2012-11-18 11:19
Hi all,

I am facing few problems and i need your help in this regard.
I was able to install HOWTO block in gnuradio properly by closely
following the instructions given on the following page using gr-modtool

"http://gnuradio.org/redmine/projects/gnuradio/wiki...

all test passed successfully and two block (1) square_ff (2) square2_ff
came in gnuradio-companion GUI too and i used them without any problem 
by
importing howto.

But the main thing is that same procedure i followed for
gr_bin_statistics_f too and after installation it came in GRC in some
other block named "howto" (notice small letters) , not in "HOWTO" where
were the square block. But as soon as i drag them to GRC window 
everything
becomes blank in that window.
and also when i try to use this function in spectrum sense python file 
as
howto.gr_bin_statistic_f it gives following error.

stats = howto.gr_bin_statistics_f(self.fft_size, self.msgq,
AttributeError: 'module' object has no attribute 'gr_bin_statistics_f'

Kindly help me to fix this issue.

Thanks

Regards,
adarsh
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.