Parking (envelope)#
An example of a detection algorithm for a parked car. The sensor position is intended to be either ground mounted or side mounted, either on the curb or on a pole. Perhaps on a Electric Vehicle charging station.
This example algorithm is meant as a starting point for parking detector implementations that can handle weak radar reflections as well. One issue with the use of weak reflections is that reflections from people or items near the sensor pose a risk of false detections. However, low update rate mitigates this issue, since a person needs to be relatively still in front of the sensor for consecutive frames in order to generate a detection.
The algorithm is designed to work with only one radar sweep every 10 seconds to keep power consumption low enough for a battery supply to last for several years. Designs that do not have this limitation can use a higher sweep rate.
The exclusion of moving objects leads to delayed detection of a car that just has parked. For default settings, the first two scans after a car stopped over the sensor will report false detection status. Hence, it takes up to 30 seconds before a parked car is detected with one scan every 10 seconds.
The quality of the radar data depends strongly on the design of the sensor casing. It’s important that the amount of radar waves that bounce back within the casing is minimized to enable detection of weak reflections from a parked car. If the default settings of this example detector lead to false detects when there is nothing in front of the sensor, it’s likely that the reflections within the casing are too strong for reliable detection. If that is the case, then consider a revisit of the sensor integration or tuning of the detector parameters (described below).
In the same manner, it is important that the sensor is angled towards the parking spot in a way so that the amount of reflection from a parked car is maximized.
Plots#
Top plot: The envelope data \(x(d)\) (blue) from the last sweep and the corresponding background estimate (green). The orange dots represent control parameters of the background estimate as described in the section “Leakage subtraction” below.
Middle plot: The weight distribution \(w(d)\) from the last sweep (blue), coordinates \((D, W)\) in the detector queue (orange and green), and visualization of the detection criterion (red) controlled by the parameters \(W_{\textrm{threshold}}\), \(Q\), and \(S\). The last coordinate (corresponding to the blue sweep data) is shown in orange and older coordinates that are still in the detector queue are shown in green. The red rectangle is drawn in such a way that the detection criterion is satisfied if and only if the detector queue is full and all coordinates in the detector queue (orange and green) fall within the rectangle. The width of the rectangle is \(S\) and the ratio of the weight coordinates between the top and bottom is \(Q\). The threshold \(W_{\textrm{threshold}}\) is marked with a dashed red line.
Bottom plot: Detection status (True or False) for sweeps in the last measurement sequence. This plot is cleared when a setting is changed or when data collection is restarted. Note that the first two results are false although there is a car above the sensor. Due to the exclusion of moving objects, the first \(K - 1\) scans always get false detection results. Similarly, a newly parked car will not be detected during the first \(K - 1\) scans immediately after it parked.
Technical description#
This example detector uses the Envelope service with settings that work well for detection of weak reflections in laboratory tests. Only the update rate is different from our recommended starting point for application development. This rate is set to 0.5 Hz instead of 0.1 Hz to work better for interactive exploration.
Leakage subtraction#
If the range is beyond the direct leakage (estimated for each profile, 0.10 m for profile 2 for example), the leakage subtraction is ignored in the algorithm. This is in order to generalize well for varying settings.
The default configuration for parking detection uses Profile 2 and a sweep range that starts 12 cm from the sensor. This setting excludes direct leakage caused by radar waves traveling directly between the Tx and Rx antennas. There is also an an indirect leakage of radar waves that bounce within the sensor casing. This form of leakage is very hard to avoid in typical sensor casing designs (for the above-mentioned settings). For this reason, the parking detection algorithm is designed to work as long as the leakage stays within some fixed limits.
The leakage is assumed to drop off linearly in the envelope amplitude from a sample distance \(d_{\textrm{leak sample}}\) to zero at a larger distance that is at most \(d_{\textrm{leak end}}\). A maximal value \(x_{\textrm{max leak}}\) is set for the envelope amplitude at \(d_{\textrm{leak sample}}\) as a result of leakage. Let \(x(d)\) denote envelope data and let \(x_{\textrm{BG}}\) denote the envelope sweep background level, i.e. an envelope sweep level taken at distances without leakage and without objects. Let
A leakage subtracted envelope \(y(d)\) is calculated from the envelope data according to
Calculation of weight and distance#
The parking detector needs to work for weak reflections with amplitudes that are not much larger than the background noise level. The noise-level normalization ensures that the background level is close to a typical value \(x_{\textrm{BG}}\) and that is useful for calculation of suitable observables.
A fixed threshold may be used to filter out amplitude values that are too close to the noise level. That approach has the drawback that it adds a parameter that can be hard to find a suitable value for. Instead, a smooth ramping is used for calculations that are likely to work well enough over varying circumstances. Define the ramp function \(f\) according to
With this ramp function, a smoothly filtered amplitude observable with background subtraction is calculated according to
The intensity of the radar reflection from a flat surface falls off as \(d^{-2}\) with distance and that corresponds to a proportionality to \(d^{-1}\) for the signal amplitude. To correct for that distance dependence, a weight function is calculated according to
From the weight function, a weight average \(W\) and a mean reflection distance \(D\) are calculated for each sweep according to
and
where \(d_1, d_2, \ldots, d_N\) are the distance points that are sampled by the envelope service.
Detector queue and detection criterion#
Reflections from non-stationary objects and people standing near the parking sensor shall not be classified as a parked car. For that reason, the weights and distances for a few sweeps need to be considered and if there is a sufficiently large variation in \(W\) or \(D\), the detected reflections are unlikely to come from a parked car.
Value pairs \((W, D)\) for recent sweeps are stored in a queue called the detector queue. The queue has a fixed size denoted by \(K\), and the value pair for the oldest sweep in the queue is dropped when a new pair is added to a full queue. No detection is generated before the queue is filled. The detection criterion operates on the minimum and maximum values of \(W\) and \(D\) denoted by \(W_{\textrm{min}}\), \(D_{\textrm{min}}\), \(W_{\textrm{max}}\), and \(D_{\textrm{max}}\), respectively.
The criterion detecting a car and excluding moving objects is
where \(W_{\textrm{threshold}}\), \(Q\), and \(S\) are configurable parameters.
Configuration parameters#
- class acconeer.exptool.a111.algo.parking._processor.ProcessingConfiguration#
- depth_leak_sample#
Distance from the sensor for the leak sample position
Type: floatUnit: mDefault value: 0.15
- depth_leak_end#
Worst case distance from the sensor for the end of leak reflections
Type: floatUnit: mDefault value: 0.3
- detector_queue_target_length#
Car detection criterion parameter: The number of sweep value pairs (weight, distance) in the detector queue
Type: intDefault value: 3
- weight_threshold#
Car detection criterion parameter: Minimal value of the weights in the detector queue
Type: floatDefault value: 5
- weight_ratio_limit#
Car detection criterion parameter: Maximal ratio between the maximal and the minimal weights in the detector queue
Type: floatDefault value: 3
- distance_difference_limit#
Car detection criterion parameter: Maximal difference between the maximal and minimal distances in the detector queue
Type: floatDefault value: 0.2
- history_length_s#
The time interval that is shown in the “Detection history” plot
Type: floatUnit: sDefault value: 300