Monday, July 20, 2015

Re: [Discuss-gnuradio] Build C++ processing block that adds a preamble

Hi Gabriele,

my suggestion would be not to have a general block, where you should
implement a forecast; patterned interleaver alread does what you want;
feed it with a vector source containing the preamble on port 0, and your
to-be-packeted data on port 1; the pattern would then be
"[0]*preamble_length + [1]*packet_length" (that's valid python and you
can directly use it in the input field in GRC).

The error you're seeing happens somewhere you're handling PMTs (tags,
messages?); it might be quite unrelated to the forecast problem.

Best regards,
Marcus

On 20.07.2015 11:00, Gabriele Galiero wrote:
> Hello, I am trying to build my own block. The block should operate as
> follows:
>
> - The block receive the sequence of the input stream.
> - The block divides the input sequence in blocks of d_pkt_len elements,
> a predefined value of packet length (unsigned int d_pkt_len), and attach
> to the beginning of the sequence a word of specified length of samples
> (unsigned int d_sync_word_len).
> - In this example the word is set to be just 0's for simplicity.
> d_pkt_len and d_sync_word_len are meant to be input parameters in the
> final block.
>
> For instance, if input is (1,1,1,1,1,1) and d_pkt_len=6,
> d_sync_word_len=4, the output should be (0,0,0,0,1,1,1,1,1,1).
> If input is (1,1,1,1,1,1) and d_pkt_len=3, d_sync_word_len=4, the output
> should be (0,0,0,0,1,1,1,0,0,0,0,1,1,1).
>
> This was a bit confusing for me when it came to code forecast function,
> since, the output number of items really depends on the input and the
> parameter d_pkt_len. I used set_output_multiple().
>
> The issue is, I built the block, and one of the tests failed. Giving me
> the following error:
>
>>> build$ ctest -V -R
> UpdateCTestConfiguration from
> :/home/comlab/Desktop/Gabri/mimo/gr-sync/build/DartConfiguration.tcl
> UpdateCTestConfiguration from
> :/home/comlab/Desktop/Gabri/mimo/gr-sync/build/DartConfiguration.tcl
> Test project /home/comlab/Desktop/Gabri/mimo/gr-sync/build
> Constructing a list of tests
> Done constructing a list of tests
> Checking test dependency graph...
> Checking test dependency graph end
> test 1
> Start 1: test_sync
>
> 1: Test command: /bin/sh
> "/home/comlab/Desktop/Gabri/mimo/gr-sync/build/lib/test_sync_test.sh"
> 1: Test timeout computed to be: 9.99988e+06
> 1:
> 1:
> 1/2 Test #1: test_sync ........................ Passed 0.00 sec
> test 2
> Start 2: qa_sync_ff
>
> 2: Test command: /bin/sh
> "/home/comlab/Desktop/Gabri/mimo/gr-sync/build/python/qa_sync_ff_test.sh"
> 2: Test timeout computed to be: 9.99988e+06
> 2: thread[thread-per-block[1]: <block sync_ff (0)>]: pmt_dict_keys:
> wrong_type : #<unknown>
> 2: thread[thread-per-block[1]: <block sync_ff (1)>]: pmt_dict_keys:
> wrong_type : #<unknown>
> 2: F
> 2:
> ======================================================================
> 2: FAIL: test_001_t (__main__.qa_sync_ff)
> 2:
> ----------------------------------------------------------------------
> 2: Traceback (most recent call last):
> 2: File
> "/home/comlab/Desktop/Gabri/mimo/gr-sync/python/qa_sync_ff.py", line 47,
> in test_001_t
> 2: self.assertFloatTuplesAlmostEqual(expected_result, result_data,
> 6)
> 2: File
> "/usr/local/lib/python2.7/dist-packages/gnuradio/gr_unittest.py", line
> 88, in assertFloatTuplesAlmostEqual
> 2: self.assertEqual (len(a), len(b))
> 2: AssertionError: 10 != 0
> 2:
> 2:
> ----------------------------------------------------------------------
> 2: Ran 1 test in 0.264s
> 2:
> 2: FAILED (failures=1)
> 2/2 Test #2: qa_sync_ff .......................***Failed 0.43 sec
>
> 50% tests passed, 1 tests failed out of 2
>
> Total Test time (real) = 0.43 sec
>
> The following tests FAILED:
> 2 - qa_sync_ff (Failed)
> Errors while running CTest
>
>
> I was trying to get some info from this, but I wasn't able so far. In
> addition I tried to make the xml file just to try it in
> GNURadio-Companion but It gave me error, I guess it has to be with the
> test error. If anyone is able to help me or give me some tip to fix that
> it would be very nice. I have spent so much time in this simple block. I
> attach the sync_ff_impl.cc, sync_ff_impl.c and qa_sync_ff.py files.
>
> Thanks in advance.
>
> Attachments:
> http://www.ruby-forum.com/attachment/10917/sync_ff_impl.cc
> http://www.ruby-forum.com/attachment/10918/sync_ff_impl.h
> http://www.ruby-forum.com/attachment/10919/qa_sync_ff.py
>
>


_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

No comments:

Post a Comment