How exactly is hier_block 's behaviour different then that of a sync_block in GNU Radio?

…衆ロ難τιáo~ 提交于 2019-12-02 03:53:16

How exactly is hier_block 's behaviour different then that of a sync_block in GNU Radio?

You should read the guided tutorials of GNU Radio where this is all explained very neatly. The content of your question has nothing to do with your title, so I'm not going to answer the question in the title.

However, your real question is a different one:

when trying to set up GUI in your work, things go wrong.

And as a continuation of the answers given you in the other thread: You don't do set up of things in the work function. That method is only used for signal processing.

Set up your flow graph including the GUI during construction, that is, in the __init__ of your top_block. Only that block has the graphical framework's window object set as property.

EDIT: You want to implement your own plotter:

The comment in the code where you said

# Comment 2 -> this doesnt work as Marcus says "Only init block has the graphical framework's window object set as property."

is a wrong quote. Only your top_block has access to the win property, because that's a property of that top_block (and noone else's). That's basic python you're mixing up here.

The other comment

Comment 1 -> this will not work as I dont have access to input_items here

shows that you still haven't quite understood how GNU Radio works. There's a work function that you have to implement, and that function has a parameter input_items; obviously, you can't access another functions parameter when you're not in that function -- that's a logical/programming language thing, too.

All I can do here is repeat: Read the guided tutorials, and do all the exercises within before trying something as complex. Otherwise, the people who try to help you have to explain basic stuff, although you have advanced problems. There's no way around getting familiar with how to program for GNU Radio in Python first, and the guided tutorials (did I mention you should read them?) make that quite easy, given that you're somewhat familiar with python. If you aren't familiar with python, go to python.org and do a python2 tutorial first. Shouldn't take long. You really need to understand the concept of classes, methods, constructors, variables, parameters, properties before you can dive into something that uses as much object-oriented paradigms as GNU Radio.

My remarks on your question:

  1. use the existing plot blocks (in gnuradio/gr-wxgui) as reference. They're mostly written in C++, for a reason. It's quite complex to get this to work, so implementing your own visualization is not a beginner's task, especially since you also seem to struggle with some basic python concepts. This will quickly also get a multithreading problem. To be clear: What you're trying to do (call a plotting function from a block thread) is problematic and usually won't work.
  2. when extending GNU Radio's GUI capabilities today, don't use WX Gui. That will go away sooner or later; GNU Radio is concentrating very strongly on QT nowadays.
  3. Are you sure you can't implement exactly what you need by feeding an existing visualizer with samples? That would be so much easier, and better to implement, and more universal.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!