discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] OOT block not showing in GRC


From: Kevin McQuiggin
Subject: Re: [Discuss-gnuradio] OOT block not showing in GRC
Date: Sat, 8 Aug 2015 15:43:40 -0700

Hi Logan:

I just went through the same process!  My new OOT block wasn't being found.  
The solution is to add a [grc] segment to the config.conf file in ~/.gnuradio:

I had to create the .gnuradio directory, then add the simple two-line [grc] 
stanza to a new config.conf file:

[grc]
local_blocks_path=/usr/local/share/gnuradio/grc/blocks

This tells grc to look for additional blocks in the stated directory.  So you 
would do something like:

cd
mkdir .gnuradio
cd .gnuradio
vi config.conf

Then add the two lines above, your OOT block install path may be different so 
I'd check it first.

Hope this helps,

Kevin

> On Aug 8, 2015, at 3:33 PM, Washbourne, Logan <address@hidden> wrote:
> 
> Hello all,
> 
> I am trying to create a simple OOT block. Eventually I would like to create a 
> block that lets a transmitting agent know if their message was received or 
> not, but for now I am just trying to create a block that multiplies the input 
> values by 2 (very similar to the guided tutorial example of the square_ff 
> block).
> 
> So the problem is that when I follow all of the instructions no errors appear 
> but when I open up the GRC, my module and blocks are not there.
> 
> So hopefully no one minds if I explain how I have installed Gnuradio on my 
> machine and the process of creating the OOT module, in hopes someone might 
> find where I made an error.
> 
> I have already gotten previous help and responses on here that really did 
> help me out so I'd like to say again, thank you to the community.
> 
> Ok, so I used Pybombs to install Gnuradio.
> 
> /home/username/Thesis/pybombs is where I installed pybombs.
> 
> Before installing gnuradio I changed the permissions to the path of 
> /opt/gnuradio/pybombs by using: sudo chown username:mygroupname 
> /opt/gnuradio/pybombs (thanks to Nathan West)
> 
> I then used ./pybombs install gnuradio.
> 
> I changed the install prefix to /opt/gnuradio/pybombs
> 
> Then I used ./pybobms env
> source /opt/gnuradio/pybombs/setup_env.sh (sometimes I have to rerun this to 
> get the GRC to open, not sure what I'm doing to undo this command)
> 
> Then I created the folder, /home/username/Thesis/OOT
> 
> I then used gr_modtool newmod ACK
> 
> Then /home/username/Thesis/OOT/gr-ACK gr_modtool add -t general check
> 
> altered the QA file
> rewrote the check_impl.cc file
> 
> Created the build folder(/home/username/Thesis/OOT/gr-ACK/build
> 
> ran cmake ../
> ran make
> ran make test
> 
> Everything passed(after some debugging, array indices start at 0 btw)
> 
> I then ran gr_modtool makexml check in the gr-ACK folder
> 
> Then cd build
> 
> sudo make install
> sudo ldconfig
> 
> gnuradio-companion
> 
> And I can't find my module or block.
> 
> I have a feeling that I'm still installing gnuradio or my OOT blocks in the 
> wrong places, but I'm not sure how to remedy it.
> 
> *********check_impl.cc***********
> 
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> #endif
> 
> #include <gnuradio/io_signature.h>
> #include "check_impl.h"
> 
> namespace gr {
>   namespace ACK {
> 
>     check::sptr
>     check::make()
>     {
>       return gnuradio::get_initial_sptr
>         (new check_impl());
>     }
> 
>     /*
>      * The private constructor
>      */
>     check_impl::check_impl()
>       : gr::block("check",
>               gr::io_signature::make(1,1, sizeof (float)),
>               gr::io_signature::make(1,1, sizeof (float)))
>     {}
> 
>     /*
>      * Our virtual destructor.
>      */
>     check_impl::~check_impl()
>     {
>     }
> 
>     void
>     check_impl::forecast (int noutput_items, gr_vector_int 
> &ninput_items_required)
>     {
>         ninput_items_required[0] = noutput_items;
>     }
> 
>     int
>     check_impl::general_work (int noutput_items,
>                        gr_vector_int &ninput_items,
>                        gr_vector_const_void_star &input_items,
>                        gr_vector_void_star &output_items)
>     {
>         const float *in = (const float *) input_items[0];
>         float *out = (float *) output_items[0];
> 
>         // Do <+signal processing+>
>         // Tell runtime system how many input items we consumed on
>         // each input stream.
> 
>     for(int i = 0; i < noutput_items ;i++)
>     {
>         out[i] = in[i] * 2;
>     }
> 
> 
>         consume_each (noutput_items);
> 
>         // Tell runtime system how many output items we produced.
>         return noutput_items;
>     }
> 
>   } /* namespace ACK */
> } /* namespace gr */
> 
> 
> ***********qa_check.py**********************
> 
> #!/usr/bin/env python
> 
> 
> from gnuradio import gr, gr_unittest
> from gnuradio import blocks
> import ACK_swig as ACK
> 
> class qa_check (gr_unittest.TestCase):
> 
>     def setUp (self):
>         self.tb = gr.top_block ()
> 
>     def tearDown (self):
>         self.tb = None
> 
>     def test_001_check (self):
> 
>     src_data = (3, 4, 5.5, 2, 3)
>     expected_result = (6, 8, 11, 4, 6)
>     src = blocks.vector_source_f(src_data)
>     sqr = ACK.check()
>     dst = blocks.vector_sink_f()
>     self.tb.connect(src,sqr)
>     self.tb.connect(sqr,dst)
>     self.tb.run()
>     result_data = dst.data()
>     self.assertFloatTuplesAlmostEqual(expected_result,result_data,6)
> 
> 
> 
> 
> 
> 
> if __name__ == '__main__':
>     gr_unittest.run(qa_check, "qa_check.xml")
> 
> 
> 
> 
> I really appreciate all of your time,
> 
> Logan Washbourne
> Electrical Engineering Graduate Student
> (Electromagnetics)
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

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