mirror of
https://github.com/30hours/blah2.git
synced 2024-11-28 13:07:35 +00:00
Fixed centroid process
This commit is contained in:
parent
b2ce7302e1
commit
0c308dfec6
7 changed files with 62 additions and 10 deletions
|
@ -26,6 +26,7 @@ process:
|
|||
nTrain: 20
|
||||
minDelay: 5
|
||||
minDoppler: 20
|
||||
nCentroid: 6
|
||||
|
||||
network:
|
||||
ip: 0.0.0.0
|
||||
|
|
|
@ -26,6 +26,7 @@ process:
|
|||
nTrain: 6
|
||||
minDelay: 5
|
||||
minDoppler: 15
|
||||
nCentroid: 6
|
||||
|
||||
network:
|
||||
ip: 0.0.0.0
|
||||
|
|
|
@ -148,7 +148,8 @@ int main(int argc, char **argv)
|
|||
|
||||
// setup process detection
|
||||
double pfa, minDoppler;
|
||||
int8_t nGuard, nTrain, minDelay;
|
||||
int8_t nGuard, nTrain;
|
||||
int8_t minDelay;
|
||||
tree["process"]["detection"]["pfa"] >> pfa;
|
||||
tree["process"]["detection"]["nGuard"] >> nGuard;
|
||||
tree["process"]["detection"]["nTrain"] >> nTrain;
|
||||
|
@ -157,7 +158,9 @@ int main(int argc, char **argv)
|
|||
CfarDetector1D *cfarDetector1D = new CfarDetector1D(pfa, nGuard, nTrain, minDelay, minDoppler);
|
||||
|
||||
// setup process centroid
|
||||
Centroid *centroid = new Centroid(nGuard, nGuard, 1/tCpi);
|
||||
uint16_t nCentroid;
|
||||
tree["process"]["detection"]["nCentroid"] >> nCentroid;
|
||||
Centroid *centroid = new Centroid(nCentroid, nCentroid, 1/tCpi);
|
||||
|
||||
// setup output data
|
||||
bool saveMap;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <cmath>
|
||||
|
||||
// constructor
|
||||
Centroid::Centroid(int8_t _nDelay, int8_t _nDoppler, double _resolutionDoppler)
|
||||
Centroid::Centroid(uint16_t _nDelay, uint16_t _nDoppler, double _resolutionDoppler)
|
||||
{
|
||||
// input
|
||||
nDelay = _nDelay;
|
||||
|
@ -25,7 +25,7 @@ Detection *Centroid::process(Detection *x)
|
|||
snr = x->get_snr();
|
||||
|
||||
// centroid data
|
||||
int8_t delayMin, delayMax;
|
||||
uint16_t delayMin, delayMax;
|
||||
double dopplerMin, dopplerMax;
|
||||
bool isCentroid;
|
||||
std::vector<double> delay2, doppler2, snr2;
|
||||
|
@ -33,8 +33,8 @@ Detection *Centroid::process(Detection *x)
|
|||
// loop over every detection
|
||||
for (size_t i = 0; i < snr.size(); i++)
|
||||
{
|
||||
delayMin = delay[i] - nDelay;
|
||||
delayMax = delay[i] + nDelay;
|
||||
delayMin = (int)(delay[i]) - nDelay;
|
||||
delayMax = (int)(delay[i]) + nDelay;
|
||||
dopplerMin = doppler[i] - (nDoppler * resolutionDoppler);
|
||||
dopplerMax = doppler[i] + (nDoppler * resolutionDoppler);
|
||||
isCentroid = true;
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
/// @brief A class to remove duplicate target detections.
|
||||
/// @details If detection SNR is larger than neighbours, then remove.
|
||||
/// @author 30hours
|
||||
/// @todo Still a bug where sometimes 2 consecutive range detections get through.
|
||||
|
||||
#ifndef CENTROID_H
|
||||
#define CENTROID_H
|
||||
|
@ -15,10 +14,10 @@ class Centroid
|
|||
{
|
||||
private:
|
||||
/// @brief Number of delay bins to check.
|
||||
int8_t nDelay;
|
||||
uint16_t nDelay;
|
||||
|
||||
/// @brief Number of Doppler bins to check.
|
||||
int8_t nDoppler;
|
||||
uint16_t nDoppler;
|
||||
|
||||
/// @brief Doppler resolution to convert Hz to bins (Hz).
|
||||
double resolutionDoppler;
|
||||
|
@ -32,7 +31,7 @@ public:
|
|||
/// @param nDoppler Number of Doppler bins to check.
|
||||
/// @param resolutionDoppler Doppler resolution to convert Hz to bins (Hz).
|
||||
/// @return The object.
|
||||
Centroid(int8_t nDelay, int8_t nDoppler, double resolutionDoppler);
|
||||
Centroid(uint16_t nDelay, uint16_t nDoppler, double resolutionDoppler);
|
||||
|
||||
/// @brief Destructor.
|
||||
/// @return Void.
|
||||
|
|
0
src/process/detection/Interpolate.cpp
Normal file
0
src/process/detection/Interpolate.cpp
Normal file
48
src/process/detection/Interpolate.h
Normal file
48
src/process/detection/Interpolate.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/// @file Interpolate.h
|
||||
/// @class Interpolate
|
||||
/// @brief A class to remove duplicate target detections.
|
||||
/// @details If detection SNR is larger than neighbours, then remove.
|
||||
/// @author 30hours
|
||||
/// @todo Still a bug where sometimes 2 consecutive range detections get through.
|
||||
|
||||
#ifndef CENTROID_H
|
||||
#define CENTROID_H
|
||||
|
||||
#include <Map.h>
|
||||
#include <Detection.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class Centroid
|
||||
{
|
||||
private:
|
||||
/// @brief Number of delay bins to check.
|
||||
int8_t nDelay;
|
||||
|
||||
/// @brief Number of Doppler bins to check.
|
||||
int8_t nDoppler;
|
||||
|
||||
/// @brief Doppler resolution to convert Hz to bins (Hz).
|
||||
double resolutionDoppler;
|
||||
|
||||
/// @brief Pointer to detection data to store result.
|
||||
Detection *detection;
|
||||
|
||||
public:
|
||||
/// @brief Constructor.
|
||||
/// @param nDelay Number of delay bins to check.
|
||||
/// @param nDoppler Number of Doppler bins to check.
|
||||
/// @param resolutionDoppler Doppler resolution to convert Hz to bins (Hz).
|
||||
/// @return The object.
|
||||
Interpolate(int8_t nDelay, int8_t nDoppler, double resolutionDoppler);
|
||||
|
||||
/// @brief Destructor.
|
||||
/// @return Void.
|
||||
~Interpolate();
|
||||
|
||||
/// @brief Implement the 1D CFAR detector.
|
||||
/// @param x Detections from the 1D CFAR detector.
|
||||
/// @return Centroided detections.
|
||||
Detection *process(Detection *x);
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue