Skip to content

Commit a62b67c

Browse files
Sun Yuxi (IFAG DES SDF FW)Sun Yuxi (IFAG DES SDF FW)
authored andcommitted
added fft threshold into BGT_RADAR_CONFIG_t
1 parent 1c0d327 commit a62b67c

File tree

6 files changed

+16
-24
lines changed

6 files changed

+16
-24
lines changed

arm/libraries/Radar/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This library offers support for Infineon's [24GHz Radar Series](https://www.infi
88
- [ ] Position2Go
99

1010
## Interfaces
11-
- [x] RadarDataProcessor
11+
- [x] RadarDataProcessor<br/>
1212
Several algorithms are implemented to process raw data from the radar. The following functions can be called to enable/disable these algorithms:
1313
```
1414
void enableSimpleMotionDetection();
@@ -17,11 +17,11 @@ This library offers support for Infineon's [24GHz Radar Series](https://www.infi
1717
void enableFft();
1818
void disableFft();
1919
```
20-
- [x] motion detection
20+
- [x] motion detection<br/>
2121
Motion detection (approaching & departing) is implemented based on the phase shift. `enableSimpleMotionDetection` runs the algorithm based on comparing wav shapes of I and Q data, whereas `enableFftMotionDetection` is based on the phase difference of the FFT peaks of I and Q data.
22-
- [x] speed detection
22+
- [x] speed detection<br/>
2323
FFT peak frequency is proportional to the doppler speed.
24-
- [x] BGTRadar
24+
- [x] BGTRadar<br/>
2525
Defines radar configurations and parameters for algorithms (different radars might have different data formats)
2626
- [x] BGT24LTR11 (Sense2GoL)
2727
- [ ] Communication Library

arm/libraries/Radar/examples/configure_radar/configure_radar.ino

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
int16_t magnitudes[SPECTRUM_SIZE];
1010
bool available = false;
1111

12-
BGT_RADAR_CONFIG_t user_config = {fft_size : 128,
13-
cycle_time : 100,
14-
sampling_rate : 3000};
12+
BGT_RADAR_CONFIG_t user_config = {
13+
fft_size : 128,
14+
fft_threshold : DETECTING_MAG_THRESH,
15+
cycle_time : 100,
16+
sampling_rate : 3000
17+
};
1518

1619
// this routine shouldn't take too long
17-
void callback(RESULT_t * result)
20+
void callback(RESULT_t *result)
1821
{
1922
for (int i = 0; i < SPECTRUM_SIZE; i++)
2023
{

arm/libraries/Radar/src/RadarDataProcessor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void RadarDataProcessorClass::computeFft()
160160

161161
//the first half of real fft values replaced by power spectrum
162162
_maxMagFreq = _fft.compute_magnitude(_result.realI, _result.imagI, _result.magnitudes, _radarFftSize / 2);
163-
bool detected = _maxMagFreq.mag > (_radar->_algoParams).magnitude_thresh;
163+
bool detected = _maxMagFreq.mag > (_radar->_config).fft_threshold;
164164
if (_algo.detectMotionFft)
165165
{
166166
float maxImagI = (float) _result.imagI[_maxMagFreq.freq];
@@ -172,7 +172,7 @@ void RadarDataProcessorClass::computeFft()
172172
_result.imagQ[i] = 0;
173173
}
174174

175-
// TODO: only one-point fft needed
175+
// TODO: only one-point fft needed for the Q data
176176
_fft.fix_fft(_result.realQ, _result.imagQ, _fftOrder, 0);
177177

178178
float maxImagQ = (float) _result.imagQ[_maxMagFreq.freq];

arm/libraries/Radar/src/radars/BGT24LTR11.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
#include "BGT24LTR11.h"
33

44
BGT_RADAR_CONFIG_t BGT24LTR11::default_config = {fft_size : SENSE2GO_BUFFER_SIZE,
5+
fft_threshold : SENSE2GO_MAG_THRESH,
56
cycle_time : SENSE2GO_CYCLE_TIME,
67
sampling_rate : SENSE2GO_SAMPLING_RATE,
78
settle_time : SENSE2GO_SETTLE_TIME};
89

9-
BGT_ALGO_PARAMS_t BGT24LTR11::default_params = {magnitude_thresh : SENSE2GO_MAG_THRESH};
10-
1110
BGT24LTR11::BGT24LTR11(BGT_RADAR_CONFIG_t radarConfig)
1211
{
1312
_config = radarConfig;

arm/libraries/Radar/src/radars/BGT24LTR11.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
class BGT24LTR11 : public BGTRadar
3333
{
3434
static BGT_RADAR_CONFIG_t default_config;
35-
static BGT_ALGO_PARAMS_t default_params;
3635

3736
public:
3837
BGT24LTR11(BGT_RADAR_CONFIG_t radarConfig = default_config);

arm/libraries/Radar/src/radars/BGTRadar.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
typedef struct
88
{
99
int fft_size;
10+
/** threshold of the FFT spectrum for motion detection */
11+
int fft_threshold;
1012
/** one cycle includes ADC sampling, running algorithms, user code, and some idle time*/
1113
int cycle_time;
1214
/** Rate of ADC sampling*/
@@ -15,12 +17,6 @@ typedef struct
1517
int settle_time;
1618
} BGT_RADAR_CONFIG_t;
1719

18-
typedef struct
19-
{
20-
int magnitude_thresh;
21-
} BGT_ALGO_PARAMS_t;
22-
23-
2420
class RadarDataProcessorClass;
2521

2622
/** @class BGTRadar Base class for different types of radars */
@@ -45,11 +41,6 @@ class BGTRadar
4541

4642
BGT_RADAR_CONFIG_t _config{};
4743

48-
/**
49-
* @brief Parameters for data processing algorithms. Defined here (not in RadarDataProcessor) since these may vary from radar to radar.
50-
*/
51-
BGT_ALGO_PARAMS_t _algoParams{};
52-
5344
int _samplingTime;
5445
};
5546

0 commit comments

Comments
 (0)