GNU Radio Radar Toolbox
os_cfar_c.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2014 Communications Engineering Lab, KIT.
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef INCLUDED_RADAR_OS_CFAR_C_H
22#define INCLUDED_RADAR_OS_CFAR_C_H
23
24#include <gnuradio/tagged_stream_block.h>
25#include <radar/api.h>
26
27namespace gr {
28namespace radar {
29
30/*!
31 * \brief This block estimates peaks of a given FFT spectrum as tagged stream. Multi peak
32 * detection is implemented with the OS-CFAR algorithm. The algorithm uses around the cell
33 * under test (CUT) on each side samp_compare samples to estimate the noise floor. This
34 * relative threshold is defined by the bin of the vector within the sorted samp_compare
35 * samples. A standard value is rel_threshold = 0.78. The value of this bin is multiplied
36 * by mult_threshold and compared with the CUT. samp_protect samples are a protected are
37 * which is not used for acquiring compare samples. If consecutive bins are detected as
38 * valid peaks it is possible to merge these detections with merge_consecutive = true.
39 * Output data are f32vectors with the information of frequency, power and phase. The
40 * identifiers (symbols) are 'frequency', 'power' and 'phase'.
41 *
42 * \param samp_rate Sample rate
43 * \param samp_compare Sample to be compared with each other
44 * \param samp_protect Samples which are protected and not used for peak detection
45 * \param rel_threshold Relative threshold
46 * \param mult_threshold Multiplier threshold
47 * \param merge_consectuive Toggle merging consecutive detected peaks
48 * \param len_key Packet length key for tagged stream
49 *
50 * \ingroup radar
51 *
52 */
53class RADAR_API os_cfar_c : virtual public gr::tagged_stream_block
54{
55public:
56 typedef std::shared_ptr<os_cfar_c> sptr;
57
58 /*!
59 * \brief Return a shared_ptr to a new instance of radar::os_cfar_c.
60 *
61 * To avoid accidental use of raw pointers, radar::os_cfar_c's
62 * constructor is in a private implementation
63 * class. radar::os_cfar_c::make is the public interface for
64 * creating new instances.
65 */
66 static sptr make(int samp_rate,
67 int samp_compare,
68 int samp_protect,
69 float rel_threshold,
70 float mult_threshold,
71 bool merge_consecutive = true,
72 const std::string& len_key = "packet_len");
73 virtual void set_rel_threshold(float inp) = 0;
74 virtual void set_mult_threshold(float inp) = 0;
75 virtual void set_samp_compare(int inp) = 0;
76 virtual void set_samp_protect(int inp) = 0;
77};
78
79} // namespace radar
80} // namespace gr
81
82#endif /* INCLUDED_RADAR_OS_CFAR_C_H */
#define RADAR_API
Definition api.h:31
This block estimates peaks of a given FFT spectrum as tagged stream. Multi peak detection is implemen...
Definition os_cfar_c.h:54
virtual void set_rel_threshold(float inp)=0
static sptr make(int samp_rate, int samp_compare, int samp_protect, float rel_threshold, float mult_threshold, bool merge_consecutive=true, const std::string &len_key="packet_len")
Return a shared_ptr to a new instance of radar::os_cfar_c.
virtual void set_mult_threshold(float inp)=0
std::shared_ptr< os_cfar_c > sptr
Definition os_cfar_c.h:56
virtual void set_samp_compare(int inp)=0
virtual void set_samp_protect(int inp)=0
Definition crop_matrix_vcvc.h:28