Distance detector (envelope)

This is a distance detector algorithm built on top of the Envelope service – based on comparing the envelope sweep to a threshold and identifying one or more peaks in the envelope sweep, corresponding to objects in front of the radar. The algorithm both detects the presence of objects and estimates their distance to the radar. The algorithm can be divided into four main parts:

1. Average envelope sweeps: To decrease the effect of noise, a number of sweeps can be averaged into a single envelope sweep.

2. Comparing envelope sweep to a threshold: Three different methods for constructing a threshold can be employed: Fixed, Recorded or Stationary clutter and CFAR, explained below.

3. Identifying peaks above the threshold: First, all peaks in the averaged envelope sweep above the threshold are identified. Secondly, if any peaks are too close, these are merged. For details about algorithms, please see the Python code.

4. Sort found peaks: If multiple peaks are found in a sweep, four different sorting methods can be employed, each suitable for different use-cases.

Sweep averaging

To increase the signal quality, multiple envelope sweeps can be averaged. Averaging many sweeps will stabilize the signal and reduce the influence from noise. Collecting sweeps takes time and consumes power, so the optimal number of sweeps collected for averaging is use-case dependent.

In this detector, sweep averaging is performed in the detector. Therefore, the running_average_factor in the Envelope service is set to zero so no exponential averaging is performed in the service.

Setting threshold

To be able to determine if no objects are present, the measurement needs to be compared to a threshold. Here, three different thresholds can be employed, each suitable for different use-cases.

Fixed threshold

The most simple approach to setting the threshold is choosing a fixed threshold over the full range. This approach requires that no background objects are present that can trigger detection.

To maximize the performance with this type of threshold, it is important that the noise_level_normalization functionality in the Envelope service has not been disabled. Otherwise, there can be variation in noise level over different sensors and different temperatures, which leads to less performance with a fixed threshold.

Recorded or Stationary clutter threshold

In situations where stationary objects are present, or when measuring very close to the sensor, the background envelope signal is not flat. In these situations it is recommended to use a threshold based on sweeps recorded of only the background, in order to only detect new objects in the scene. The threshold calculation based on background measurements is called Stationary Clutter and sets the threshold from the mean and standard deviation of collected background sweeps. It is important that no object that should be detected is present during the recording of the background.

The parameters for this type of threshold are the number of sweeps collected for the background estimation and a sensitivity parameter, \(\alpha\), between zero and one adjusting the threshold. The threshold at distance \(r\), \(t[r]\) is

\[t[r] = \mathrm{mean}_s Env[s,r] + \left( \frac{1}{\alpha} - 1 \right) \mathrm{std}_s Env[s,r]\]

where \(Env[s,r]\) is envelope sweep number \(s\) from the background measurement at distance \(r\).

The distance detector in Python stores both the mean and standard deviation, so the sensitivity can be changed from a loaded threshold. The distance detector in C only stores the final threshold, so the sensitivity cannot be changed after the calculation of the Stationary Clutter threshold.

Constant False Alarm Rate (CFAR) threshold

A final method to construct a threshold for a certain distance is to use the envelope signal from neighboring distances from the same sweep. This requires that the object gives rise to a single strong peak, such as a water surface and not, for example, the level in a large waste container. The main advantage is that the memory consumption is minimal and that no noise normalization is required.

The parameters for this type of threshold are the window from which the neighboring envelope sweep is averaged, and the guard or gap around the distance of interest where the sweep is omitted. Also, a sensitivity parameter, \(\alpha\), between zero and one adjusting the threshold. For example, if the guard is 6 cm and the window is 2 cm, the threshold at \(r\) = 20 cm will be \(1/\alpha\) times the mean of the sweep from 15 to 17 and 23 to 25 cm.

Peak sorting - Which peak is the most important?

The main feature of the distance detector algorithm is that multiple peaks can be found in the same envelope sweep. Depending on use-case, one is often the most important. Therefore, four different peak sorting methods are available.

For example, if the threshold is low (high sensitivity), the noise can give false alarms and the strongest peak is probably of interest. With a high threshold, on the other hand, all detected peaks are likely real objects and the closest peak is probably of highest interest.

Closest
This method simply sorts the peaks by distance, with the closest first.
Strongest
Here, the peaks are sorted after their envelope amplitude, with the strongest first.
Strongest reflector

The same object at a larger distance from the radar will give a weaker signal. The radar equation tells us that the envelope signal falls over distance squared,

\[A \propto \frac{\sqrt{\sigma}}{R^2},\]

where \(A\) is the amplitude of the peak in the envelope sweep, \(\sigma\) is the radar cross section of the object and \(R\) is the distance to the object. To sort the reflectors after their radar cross section, the peaks are sorted by their \(A_i \cdot R_i^2\).

Strongest flat reflector

For large flat reflectors, such as fluid surfaces, the radar equation from the previous section gets modified to

\[A \propto \frac{\sqrt{\sigma}}{R}.\]

Therefore, using this peak sorting method, the peaks are sorted by their \(A_i \cdot R_i\).

In the lower plot in the Distance detector GUI, the first peak after sorting is plotted as the Main peak, the rest of the found peaks in the same sweep are plotted as Minor peaks.

Measuring close to the sensor

Measuring the distance to objects very close to the sensor is difficult due to the presence of the strong direct leakage closer than approximately 6 cm to the radar. However, often the presence of strongly reflecting objects, such as fluid surfaces, can be detected. Optimal performance is obtained by using profile 1, setting gain to zero and enabling maximize_signal_attenuation to not saturate the sensor and using Recorded threshold. Often, the presence of an object only slightly alters the shape of the direct leakage, so that a well shaped peak is not found. Instead, it is recommended to see if the envelope signal is above threshold by enabling show_first_above_threshold.

Configuration parameters

class examples.processing.distance_detector.ProcessingConfiguration
class ThresholdType

An enumeration.

class PeakSorting

An enumeration.

nbr_average

The number of envelope sweeps to be average into one then used for distance detection.

Type: float
Default value: 5
threshold_type

Setting the type of threshold

Default value: ThresholdType.FIXED
fixed_threshold

Sets the value of fixed threshold. The threshold has this constant value over the full sweep.

Type: float
Default value: 800
sc_nbr_sweep_for_bg

The number of (non-averaged) sweeps collected for calculating the Stationary Clutter threshold.

Type: float
Default value: 20
sc_load_save_bg

Load/Save a recorded threshold from/to disk.

sc_sensitivity

Value between 0 and 1 that sets the threshold. A low sensitivity will set a high threshold, resulting in only few false alarms but might result in missed detections.

Type: float
Default value: 0.3
cfar_sensitivity

Value between 0 and 1 that sets the threshold. A low sensitivity will set a high threshold, resulting in only few false alarms but might result in missed detections.

Type: float
Default value: 0.5
cfar_guard_cm

Range around the distance of interest that is omitted when calculating CFAR threshold. Can be low, ~4 cm, for Profile 1, and should be increased for higher Profiles.

Type: float
Unit: cm
Default value: 12
cfar_window_cm

Range next to the CFAR guard from which the threshold level will be calculated.

Type: float
Unit: cm
Default value: 3
cfar_one_sided

Instead of determining the CFAR threshold from sweep amplitudes from distances both closer and a farther, use only closer. Helpful e.g. for fluid level in small tanks, where many multipath signal can apprear just after the main peak.

Type: bool
Default value: False
peak_sorting_type

Setting the type of peak sorting method.

Default value: PeakSorting.STRONGEST
history_length_s

Length of time history for plotting.

Type: float
Unit: s
Default value: 10
show_first_above_threshold

When detect in the presence of object very close to the sensor, the strong direct leakage might cause that no well shaped peaks are detected, even though the envelope signal is above the threshold. Therefore the first distace where the signal is above the threshold can be used as an alternative to peak detection.

Type: bool
Default value: False