Python Hier block using callback

Hi all;

I created a python hier block using signal source and a VCO, but I want
to
be able to control parameters like amplitude, sensitivity etc il real
time
using sliders.

I used callback tag on xml together with the set method but it does not
work, the parameters does not seem to change at all.

is it possible to achieve what I am trying to do? how can I do it.

your help will be much appreciated.

Regards

Fanatic

Hi Themba,

in principle, what you describe sounds right; can you insert some ‘print
“set_foobar called”’’ in the set methods of your hier block, to check
whether they are actually being called?

Greetings,
Marcus

Thank you Marcus for the reply.
let me show you an example of what I did. but so far i am not getting
any
output from it

def set_parameters(self,amplitude):
    global d_amplitude
             d_amplitude= amplitude
             print d_amplitude

#then on the contructor
def_init_(self, amplitude)
self.set_parameter(amplitude)
analog_sig_source = analog.sig_source_f(sampling_rate,
analog.GR_TRI_WAVE, f, d_amplitude, 0)
#then connect the block to other blocks


View this message in context:
http://gnuradio.4.n7.nabble.com/python-Hier-block-using-callback-tp53486p53489.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi Themba,

the interesting point here is where you register your callback. You say
you’ve included the callback in the .grc file; if that’s the case, you
should find it searching for the name of the variable you change using a
slider etc in the python file GRC generates.

Greetings,
Marcus

the point is that if the print is not appearing, then the callback isn’t
working as you expect. You should really make sure to use the right
variable names.
You’re not really sharing all the interesting information; it’s a bit
hard to figure this out in what’s becoming a dialogue.
I’d like to ask you to read
http://gnuradio.org/redmine/projects/gnuradio/wiki/ReportingErrors

Best regards,
Marcus

the callback is on the .xml file from the grc folder, the parameters are
changing but the waveform is not updating.
on the other hand, all my custom blocks i get “AttributeError:
‘top_block_sptr’ object has no attribute ‘top_layout’”.

it was working all along but I just got that recently, I searched the
forum
I havent found where there is a solution to this :frowning:


View this message in context:
http://gnuradio.4.n7.nabble.com/python-Hier-block-using-callback-tp53486p53501.html
Sent from the GnuRadio mailing list archive at Nabble.com.