General_Work Not Executing

Hello All,

I recently rewrote the Chat Sanitize and Chat Receiver blocks from the
Tutorial module(Example 5) in C++. I did this because I wanted to add an
acknowledgment feature into the blocks in order to add some robustness
to
it(I’m not sure yet if the chat example will lend itself to being robust
but it was the starting point I chose). The problem arose when I added
an
input port to the Text Sanitize block and added an output to the Chat
Receiver block and connected them together. Instead of a linear program
I
now had a loop of a program. I did something wrong because now the Text
Sanitize block wasn’t outputting anything, so I commented out the input
code for Text Sanitize and the output code for Chat Receiver. I went to
retest the program to see if it behaved just like Example 5(which it was
before I started adding on the acknowledgment bits) but now Text
Sanitize
wasn’t outputting anything still.

I tried putting some cout’s in the general _work function where the
message
publishing code is and I have determined that it’s not even entering the
general_work function.

Does anyone have any thoughts on the matter? I must have changed
something
when I commented out the input portion of the Text_Sanitize code but for
the life of me I can’t figure out what it is. I have even since made two
new blocks to try and redo the functionality of Text Sanitize but the
same
problem still persists.

My code can be found at: https://github.com/loganwashbourne/Thesis.git

The juicy files are in the Thesis/OOT/gr-ACK/lib folder.

There might be some profanity in the commit messages, it was a stressful
day.

I appreciate your time,

Logan Washbourne
Electrical Engineering Graduate Student
(Electromagnetics)

On Fri, Aug 28, 2015 at 12:49 PM, Washbourne, Logan <
[email protected]> wrote:

Sanitize block wasn’t outputting anything, so I commented out the input
when I commented out the input portion of the Text_Sanitize code but for
the life of me I can’t figure out what it is. I have even since made two
new blocks to try and redo the functionality of Text Sanitize but the same
problem still persists.

So this will be a good lesson in using git! It’s good to keep small,
quantified changes in git so that you know where you are versus where
you
started when making a change. “git diff” is your friend here. Lots of
ways
to use this tool to help in your development cycle.

(Also, looking at your git repo, you’ve checked in the ‘~’ temp files
from
your editor [emacs I assume]. You don’t want any temp or auto-generated
files in a git repository; just stuff that you’ve created that needs to
be
tracked.)

The problem is that this block is designed only to output messages, not
a
data stream. You can see in the constructor that the io_signature is
using
(0, 0, 0) for both inputs and outputs. The scheduler doesn’t recognize
this
block in the stream and so never things to call the general_work. The
original blocks you are referring to only have message interfaces.

Hope this helps get you in the right direction.

Tom

On Mon, Aug 31, 2015 at 11:28 AM, Washbourne, Logan <
[email protected]> wrote:

model it directly after the ChatApp tutorial, and I’m pretty sure that’s
what the send and receive blocks in that project were doing.

Is this not a good practice or infeasible?

Logan Washbourne
Electrical Engineering Graduate Student
(Electromagnetics)

Hi Logan,

Have another look at the Python code you were copying from. The
chat_sanitizer just creates a message output port and we call it’s
post_message from the main app when a user is ready to post. There’s
nothing automatic about it, so no work function to be called. The
chat_receiver code just waits until a message is posted to it, at which
point it wakes up and fires off its handle_msg function to process the
message.

What you’re trying to do is feasible, but I think you’ll need to
understand
the message passing system in the scheduler instead of the data
streaming
model to get a better handle on it.

Tom

Tom,

Thanks for the reply!

So unfortunately I started using git after I found out that the code
wasn’t
entering general_work. It was actually the reason I started using git,
so
this wouldn’t happen again haha. Thanks for the temp files tip, I’ll try
to
fix that today.

For the blocks, I think I just want them to pass messages. I’m trying to
model it directly after the ChatApp tutorial, and I’m pretty sure that’s
what the send and receive blocks in that project were doing.

Is this not a good practice or infeasible?

Logan Washbourne
Electrical Engineering Graduate Student
(Electromagnetics)

Tom,

Thanks for pointing me in a new direction. I’ve spent this morning
reading
about the scheduler and I came across your Scheduler Details slide show
from 2013. I saw the message passing protocol on slide 15, which makes
sense, but I am not reaching the first bullet point, my messages are not
being published. So then I continued reading and came across slide 29
and I
see that if a block is not a streaming block then BLKD_IN gets set,
which I
then found the gr_block_executor.h file and saw the comment next to the
BLKD_IN state, which reads that the block is now blocked and waiting for
input data. I must be not fully understanding that flowchart because I
can’t see how those steps apply to a source block that doesn’t rely on
input data.

The next step in my mind is either to figure out how to get the
scheduler
to recognize a block that only outputs messages or to figure out how to
call the function within my block that publishes the message without
relying on the scheduler.

Do you have any other sources that detail the scheduler? Or any advice
in
helping to understand the presentation about the scheduler?

I appreciate your time,

Logan Washbourne
Electrical Engineering Graduate Student
(Electromagnetics)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs