git-artes / gr-isdbt

DTV ISDB-T in GNURadio
http://iie.fing.edu.uy/investigacion/grupos/artes/gr-isdbt/
Other
147 stars 35 forks source link

RuntimeError when running receiver grcs: block::set_relative_rate: relative rate must be > 0.0 #24

Closed TheRealPhoneCall closed 5 years ago

TheRealPhoneCall commented 5 years ago

Hi, I wanted to try and test your module, and receive tv broadcast from my end. Was able to obtain parameters for a specific channel. But I'm having runtime error when running the following GRCs:

Can you please help me move on from this error? Exact error stack trace is shown below...

Detected ISDB-T's 64QAM constellation Detected ISDB-T's 64QAM constellation [gr-isdbt.OFDM_SYM_ACQ] You are using ofdm_sym_acquisition to perform coarse OFDM synchronization. Consider using ofdm_synchronization instead. Traceback (most recent call last): File "/home/ergwd/Projects/gr-miindtv/examples/fullseg_receiver_and_measurements.py", line 580, in main() File "/home/ergwd/Projects/gr-miindtv/examples/fullseg_receiver_and_measurements.py", line 568, in main tb = top_block_cls() File "/home/ergwd/Projects/gr-miindtv/examples/fullseg_receiver_and_measurements.py", line 421, in init rate=2, File "/home/ergwd/prefix/default/lib/python2.7/dist-packages/isdbt/isdbt_channel_decoding.py", line 41, in init self.isdbt_viterbi_decoder_0 = isdbt.viterbi_decoder(constellation_size, rate) File "/home/ergwd/prefix/default/lib/python2.7/dist-packages/isdbt/isdbt_swig.py", line 5043, in make return _isdbt_swig.viterbi_decoder_make(*args, **kwargs) RuntimeError: block::set_relative_rate: relative rate must be > 0.0

git-artes commented 5 years ago

Hi, That's a weird error. Those examples should work, and from what I understand, the error is regarding the set_relative_rate in the viterbi decoder. However, the variables involved are automatically set (depending on the options available), so it should definitely work. Maybe you could debug a little bit (like printing what's happening just before line 131 on viterbi_decoder_impl.cc)? best

TheRealPhoneCall commented 5 years ago

Sorry it took some time for me to get back at this! Thanks for helping...here are the lines before line 131 on that file:

namespace gr { namespace isdbt {

    const unsigned char viterbi_decoder_impl::d_puncture_1_2[2] = {1, 1};
    const unsigned char viterbi_decoder_impl::d_puncture_2_3[4] = {1, 1, 0, 1};
    const unsigned char viterbi_decoder_impl::d_puncture_3_4[6] = {1, 1, 0, 1, 1, 0};
    const unsigned char viterbi_decoder_impl::d_puncture_5_6[10] = {1, 1, 0, 1, 1, 0, 0, 1, 1, 0};
    const unsigned char viterbi_decoder_impl::d_puncture_7_8[14] = {1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0};

    viterbi_decoder::sptr
        viterbi_decoder::make(int constellation_size, int rate)
        {
            return gnuradio::get_initial_sptr
                (new viterbi_decoder_impl(constellation_size, rate));
        }

    /*
     * The private constructor
     */
    viterbi_decoder_impl::viterbi_decoder_impl(int constellation_size, int rate)
        : gr::block("viterbi_decoder",
                gr::io_signature::make(1, 1, sizeof(unsigned char)),
                gr::io_signature::make2(1, 2, sizeof(unsigned char), sizeof(float)))
    {

        // d_k: the input of the encoder
        // d_n: the output of the encoder
        // d_puncture: depuncturing matrix
        switch (rate){
            case 0:
                d_k = 1;
                d_n = 2;
                d_puncture = d_puncture_1_2;
                d_ntraceback = 5;
                break;
            case 1:
                d_k = 2;
                d_n = 3;
                d_puncture = d_puncture_2_3;
                d_ntraceback = 9;
                break;
            case 2:
                d_k = 3;
                d_n = 4;
                d_puncture = d_puncture_3_4;
                d_ntraceback = 10;
                break;
            case 3:
                d_k = 5;
                d_n = 6;
                d_puncture = d_puncture_5_6;
                d_ntraceback = 15;
                break;
            case 4:
                d_k = 7;
                d_n = 8;
                d_puncture = d_puncture_7_8;
                d_ntraceback = 24;
                break;
        }

        // initial state
        d_init = 0; 
        // constellation size
        d_m = log2(constellation_size);

        d_last_ber_out = 0.5;
        d_alpha_avg = 1e-5; 

        /*
         * We input n bytes, each carrying m bits => nm bits
         * The result after decoding is km bits, therefore km/8 bytes.
         *
         * out/in rate is km/8n in bytes. We are outputting unpacked bytes. 
         * To generate k bits, we needed n bits (and since we are inputting
         * bytes with one symbol at a time, each with m bits). Thus, the 
         * relative rate would be d_k/(d_n/d_m). However, since we are outputting
         * packed bytes (all 8 bits carry useful data) the output rate is divided by
         * 8. 
         */
        assert((d_k * d_m) % (8 * d_n));
        set_relative_rate((d_k * d_m) / (8 * d_n));
git-artes commented 5 years ago

Hi, I meant printing the involved variables, like in printf("d_k: %i\n", d_k); to see what's going on with the variables involved in your particular case. best

ergwd-pcieerd commented 5 years ago

Hi, I'm the same person as the above but on another account. I got it running on another computer without that problem. It seems that there's some platform/dependency problem on my other computer. I will get back at you about it when I get back at that gnuradio workstation.

I have to ask, how do I open a video stream of the tv signals being received? Can you point me to a guide that does so? I might have to ask this on another thread

git-artes commented 5 years ago

Hi, Glad it worked. To display the audio/video in the computer you should read the output file with a media player (we use ffplay). There is an explanation in the README. If you still have problems, please open another issue. best