Washbourne, Logan
2015-08-08 22:33:29 UTC
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)
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)