Peak detector block does not really work. It need to be fixed

Hello,

I’m working now with peak_detector block and find out that some
functions
don’t really work.
I’ve used the following 2 blocks:

  • Peak Detector (gr_peak_detector): the parameter “look ahead” seems
    have no
    function. I gave “look ahead” many values but the peak value did not
    change.
    I’ve seen in the gr_peak_detector_xx.cc that the variable d_look_ahead
    is
    called but it is not used in the main program. So I think the developer
    has
    forgotten this function.

  • Peak Detector 2 (gr_peak_detector2): in this block “look ahead” is
    used,
    but sometimes the peak detector freezes (output signal stops running in
    scope sink).
    I’ve changed the cpp code a little bit and it does not freeze anymore.
    But
    I’m not sure if the detector will work correctly after that.
    Here is what I’ve changed:
    original code: return tmp - 1;
    changed code: return tmp;

Can anyone of the development team have a look at the 2 cpp ?

best regards
Phong Do

C++ code:
http://old.nabble.com/file/p29349773/gr_peak_detector_fb.cc
gr_peak_detector_fb.cc
http://old.nabble.com/file/p29349773/gr_peak_detector2_fb.cc
gr_peak_detector2_fb.cc


View this message in context:
http://old.nabble.com/Peak-detector-block-does-not-really-work.-It-need-to-be-fixed-tp29415858p29415858.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Thu, Aug 12, 2010 at 8:26 AM, Phong Do [email protected] wrote:

called but it is not used in the main program. So I think the developer has

Can anyone of the development team have a look at the 2 cpp ?

best regards
Phong Do

Keep in mind that the gr_peak_detector actually expects negative
inputs. So if your signal goes from 0 to 100, adjust it so that it
goes from -100 to 0.

Of course, I say “keep in mind” even though we probably haven’t
provided any documentation in the code to that affect…

Tom

Hello Tom,

Can you explain me why should gr_peak_detector need negative inputs ?
What about the variable “look ahead” ? I wrote in the last message that
“look ahead” has no function in gr_peak_detector. Do you know how can I
add
this feature in peak detector ?

Thanks in advance
Phong Do

On Thu, Aug 12, 2010 at 8:26 AM, Phong Do [email protected] wrote:

change.
Here is what I’ve changed:
original code: return tmp - 1;
changed code: return tmp;

Can anyone of the development team have a look at the 2 cpp ?

best regards
Phong Do

Keep in mind that the gr_peak_detector actually expects negative
inputs. So if your signal goes from 0 to 100, adjust it so that it
goes from -100 to 0.

Of course, I say “keep in mind” even though we probably haven’t
provided any documentation in the code to that affect…

Tom


Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


View this message in context:
http://old.nabble.com/Peak-detector-block-does-not-really-work.-It-need-to-be-fixed-tp29415858p29526305.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Tue, Aug 24, 2010 at 01:49:09PM -0700, Phong Do wrote:

Hello Tom,

Can you explain me why should gr_peak_detector need negative inputs ?

If you use grep, you can find places in the code where it is used, and
then answer your own question.

What about the variable “look ahead” ? I wrote in the last message that
“look ahead” has no function in gr_peak_detector.

My guess is that look_ahead was a feature that turned out not to be
needed to solve the problem at hand, but was accidentally left in the
constructor.

Do you know how can I add this feature in peak detector ?

Yes. Write the code that implements it.

Eric