Added comments for utils class

gr-droneid-rewrite
David Protzman 2022-10-09 17:58:10 -04:00
rodzic 4ab63eee2e
commit c3c8320c8f
1 zmienionych plików z 47 dodań i 6 usunięć

Wyświetl plik

@ -24,18 +24,61 @@ namespace dji_droneid {
class DJI_DRONEID_API utils
{
public:
utils();
~utils();
utils() = default;
~utils() = default;
// Hz between each carrier in DroneID
static constexpr float CARRIER_SPACING = 15e3;
static constexpr uint32_t DATA_CARRIER_COUNT = 600;
static constexpr std::complex<float> I = std::complex<float>(0, 1);
// Number of OFDM data carriers in DroneID (independent of sample rate)
static constexpr uint32_t DATA_CARRIER_COUNT = 600;
/**
* Get the correct FFT size based on the sample rate
* @param sample_rate Sample rate (in Hz) of the collected samples
* @return Number of FFT bins required
*/
static uint32_t get_fft_size(float sample_rate);
/**
* Get the correct sample rate based on the FFT size
* @param fft_size Number of FFT bins
* @return Sample rate (in Hz)
*/
static float get_sample_rate(uint32_t fft_size);
/**
* Get a list of FFT bins (all positive, assuming that DC is in the middle) that should be used as data carriers
* @param sample_rate Sample rate (in Hz)
* @return List of utils::DATA_CARRIER_COUNT values denoting position of all data carriers
*/
static std::vector<uint32_t> get_data_carrier_indices(float sample_rate);
/**
* Create a Zadoff Chu sequence of `length` elements using the root index `root`
* @param root Root index
* @param length Number of elements to create
* @return Vector of complex floats
*/
static std::vector<std::complex<float>> zadoff_chu(uint32_t root, uint32_t length);
/**
* Create a time domain ZC sequence for the specified OFDM symbol index (4 or 6)
*
* Will be `fft_size` elements long
*
* <b>This only currently works for drones that have two ZC sequences present!!!</b>
* @param fft_size Number of FFT bins the sequence should be generated for
* @param symbol_idx Symbol index to generate the sequence for (must be 4 or 6)
* @return Complex float vector of `fft_bins` elements representing the gold ZC sequence in the time domain
*/
static std::vector<std::complex<float>> create_zc(uint32_t fft_size, uint8_t symbol_idx);
/**
* Get the long and short cyclic prefix lengths for the provided sample rate
* @param sample_rate Sample rate (in Hz)
* @return Pair with the first element being the long cyclic prefix length in samples, second being the short
*/
static std::pair<uint16_t, uint16_t> get_cyclic_prefix_lengths(float sample_rate);
private:
@ -44,6 +87,4 @@ private:
} // namespace dji_droneid
} // namespace gr
#endif /* INCLUDED_DJI_DRONEID_UTILS_H */