discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Message passing: boost::bind() not executing


From: Laura Arjona
Subject: Re: [Discuss-gnuradio] Message passing: boost::bind() not executing
Date: Tue, 20 Aug 2019 15:53:59 -0700

Thank you very much Marcus.

I was using the the scheduler ( sudo  GR_SCHEDULER=STS nice -n -10 python ./test.py ) to start my flow graph,
I did'nt realize before that the message passing needs more than one thread.

Best

On Tue, Aug 20, 2019 at 4:53 AM Müller, Marcus (CEL) <address@hidden> wrote:
Hi!

So, Occam's Razor first: Is it certain that gate_impl's general_work is
really called regularly?
Because: the message passing code here looks really good, and thus my
first guess is that of the code which you sensibly omitted here, the
rest of the general_work() somehow leads to the thing not being called.
Or maybe it's the forecast() method?

Best regards,
Marcus

On Mon, 2019-08-19 at 15:52 -0700, Laura Arjona wrote:
>
> Hi all,
> I would really appreciate some help with using message passing.
> I have 2 different OOT modules, connected (called gate and decoder). And I want to pass information from gate to decoder For example, the string "OK".
> However, the message is not received in the decoder block. And I am not sure whether the problem is in my gate or in my decoder block.
>
> Find below a sketch of my flow graph (partial) and the code in C++ (partial) and python
>
>
>
>
> python main file
> ....
> self.connect((self.gate), (self.decoder))
> self.msg_connect(self.gate, "out_gate", self.decoder, "in_decoder")
>
>
> OOT Module: gate_impl
> /* The private constructor */
>     gate_impl::gate_impl(int sample_rate)  :
>      gr::block("gate", gr::io_signature::make(1, 1, sizeof(gr_complex)),
>               gr::io_signature::make(1, 1, sizeof(gr_complex) ))  {
>
>        message_port_register_out(pmt::mp("out_gate"));
>
> }
>
> int
>     gate_impl::general_work (int noutput_items,
>                        gr_vector_int &ninput_items,
>                        gr_vector_const_void_star &input_items,
>                        gr_vector_void_star &output_items)
>     {
>
>     message_port_pub(pmt::mp("out_gate"), pmt::mp("OK"));
>     }
>
> OOT Module: decoder_impl
>
>  /*
>      * The private constructor
>      */
>     decoder_impl::decoder_impl(int sample_rate,std::vector<int> output_sizes)
>       : gr::block("decoder",
>               gr::io_signature::make(1, 1, sizeof(gr_complex)),
>               gr::io_signature::makev(2, 2, output_sizes)),
>               s_rate(sample_rate)
>     {
>
>        message_port_register_in(pmt::mp("in_decoder"));
>
> set_msg_handler(pmt::mp("in_decoder"),
>    boost::bind(&decoder_impl::msg_handler_method, this, _1) 
> );
>
> void
> decoder_impl::msg_handler_method(pmt::pmt_t msg)
> {
>   std::cout << "***** MESSAGE DEBUG PRINT ********\n";
>   pmt::print(msg);
>   std::cout << "**********************************\n";
> }
>
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


--
Laura Arjona 
Washington Research Foundation Innovation Postdoctoral Fellow in Neuroengineering

Paul G. Allen School of Computer Science & Engineering
185 E Stevens Way NE
University of Washington
Seattle, WA 98195-2350

reply via email to

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