acc_detector_presence.h
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2022-2023
2 // All rights reserved
3
4 #ifndef ACC_DETECTOR_PRESENCE_H_
5 #define ACC_DETECTOR_PRESENCE_H_
6
7 #include <stdbool.h>
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include "acc_definitions_a121.h"
12 #include "acc_definitions_common.h"
13 #include "acc_processing.h"
14 #include "acc_sensor.h"
15
16 /**
17 * @defgroup Presence Presence Detector
18 * @ingroup Detectors
19 *
20 * @brief Presence detector API description
21 *
22 * For a detailed description of the presence detector algorithm and its
23 * configuration parameters, see
24 * <a href="https://docs.acconeer.com/en/latest/exploration_tool/algo/a121/detectors/presence_detection.html">
25 * docs.acconeer.com</a>
26 *
27 * @{
28 */
29
30
31 /**
32 * @brief Presence detector handle
33 */
34 struct acc_detector_presence_handle;
35
36 typedef struct acc_detector_presence_handle acc_detector_presence_handle_t;
37
38
39 /**
40 * @brief Presence detector configuration container
41 */
42 struct acc_detector_presence_config;
43
44 typedef struct acc_detector_presence_config acc_detector_presence_config_t;
45
46
47 /**
48 * @brief Presence detector results container
49 */
50 typedef struct
51 {
52 /**
53 * true if presence was detected, false otherwise
54 */
55 bool presence_detected;
56 /**
57 * A measure of the amount of fast motion detected
58 */
59 float intra_presence_score;
60 /**
61 * A measure of the amount of slow motion detected
62 */
63 float inter_presence_score;
64 /**
65 * The distance, in meters, to the detected object
66 */
67 float presence_distance;
68 /**
69 * An array of measures of the amount of fast motion detected per distance point.
70 * This will point to memory in the buffer supplied to @ref acc_detector_presence_process
71 */
72 float *depthwise_intra_presence_scores;
73 /**
74 * An array of measures of the amount of slow motion detected per distance point.
75 * This will point to memory in the buffer supplied to @ref acc_detector_presence_process
76 */
77 float *depthwise_inter_presence_scores;
78 /**
79 * The number of elements in the depthwise presence scores arrays
80 */
81 uint32_t depthwise_presence_scores_length;
82 /**
83 * Radar data that the presence detection is based on.
84 * This will point to memory in the buffer supplied to @ref acc_detector_presence_process
85 */
86 acc_processing_result_t processing_result;
87 } acc_detector_presence_result_t;
88
89
90 /**
91 * brief Metadata for presence detector
92 */
93 typedef struct
94 {
95 /**
96 * Actual start point of measurement in m.
97 * This can be useful to know the exact start point of the measurement in m.
98 * The resolution of each point is approximately 2.5mm
99 */
100 float start_m;
101 /**
102 * Actual step length between each data point of the measurement in m.
103 * This can be useful when automatic selection of step length based on the profile
104 * is enabled through @ref acc_detector_presence_config_auto_step_length_set
105 */
106 float step_length_m;
107 /**
108 * Number of data points in measurement.
109 * This is calculated from the requested start and end point and the resulting
110 * step length. This corresponds to the length of the depthwise inter/intra
111 * presence score results, which can be useful to know already at detector creation.
112 */
113 uint16_t num_points;
114 /**
115 * Profile used.
116 * This can be useful when automatic selection of profile based on start point
117 * is enabled through @ref acc_detector_presence_config_auto_profile_set
118 */
119 acc_config_profile_t profile;
120 } acc_detector_presence_metadata_t;
121
122
123 /**
124 * @brief Create a configuration for a presence detector
125 *
126 * @return Presence detector configuration, NULL if creation was not possible
127 */
128 acc_detector_presence_config_t *acc_detector_presence_config_create(void);
129
130
131 /**
132 * @brief Destroy a presence detector configuration
133 *
134 * @param[in] presence_config The configuration to destroy
135 */
136 void acc_detector_presence_config_destroy(acc_detector_presence_config_t *presence_config);
137
138
139 /**
140 * @brief Print a configuration to the log
141 *
142 * @param[in] presence_config The configuration to log
143 */
144 void acc_detector_presence_config_log(const acc_detector_presence_config_t *presence_config);
145
146
147 /**
148 * @brief Get the buffer size needed for the provided presence detector handle
149 *
150 * This buffer size can be used to allocate a memory buffer in the
151 * application, which is needed for several functions in the detector library.
152 * This size will also include memory for holding the depthwise inter/intra presence
153 * score arrays that will be part of the result, see @ref acc_detector_presence_result_t
154 *
155 * @param[in] presence_handle The presence detector handle to to get the buffer size for
156 * @param[out] buffer_size The buffer size
157 * @return true if successful, false otherwise
158 */
159 bool acc_detector_presence_get_buffer_size(const acc_detector_presence_handle_t *presence_handle, uint32_t *buffer_size);
160
161
162 /**
163 * @brief Create a presence detector with the provided configuration
164 *
165 * @param[in] presence_config The presence detector configuration to create a presence detector with
166 * @param[out] metadata Metadata for the presence detector given the presence_config
167 * @return Presence detector handle, NULL if presence detector was not possible to create
168 */
169 acc_detector_presence_handle_t *acc_detector_presence_create(acc_detector_presence_config_t *presence_config,
170 acc_detector_presence_metadata_t *metadata);
171
172
173 /**
174 * @brief Destroy a presence detector identified with the provided handle
175 *
176 * Destroy the context of a presence detector allowing another presence detector to be created using the
177 * same resources.
178 * If NULL is sent in, nothing happens.
179 *
180 * @param[in] presence_handle A reference to the presence detector handle to destroy
181 */
182 void acc_detector_presence_destroy(acc_detector_presence_handle_t *presence_handle);
183
184
185 /**
186 * @brief Prepare the detector to do a measurement
187 *
188 * @param[in] presence_handle The presence detector handle to prepare for
189 * @param[in] presence_config The configuration to prepare with
190 * @param[in] sensor The sensor instance to prepare
191 * @param[in] cal_result The calibration result to prepare with
192 * @param[in] buffer Memory used by the detector to prepare the sensor for measurements
193 * The buffer will only be used during the duration of this call
194 * @param[in] buffer_size The size in bytes of the buffer, should be at least buffer_size
195 * from @ref acc_detector_presence_get_buffer_size
196 * @return true if successful, false otherwise
197 */
198 bool acc_detector_presence_prepare(acc_detector_presence_handle_t *presence_handle, acc_detector_presence_config_t *presence_config,
199 acc_sensor_t *sensor, const acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size);
200
201
202 /**
203 * @brief Process the data according to the configuration used in @ref acc_detector_presence_config_create
204 *
205 * @param[in] presence_handle The presence detector handle for the presence detector to get the next result for
206 * @param[in] buffer A reference to the buffer (populated by @ref acc_sensor_read) containing the
207 * data to be processed.
208 * After this function returns, the depthwise inter/intra presence that is part of the
209 * result (@ref acc_detector_presence_result_t) will point to memory located in this buffer.
210 * If these arrays are of interest for the application they need to be processed
211 * before the buffer is used in any other function.
212 * @param[out] result Presence detector results
213 * @return true if successful, otherwise false
214 */
215 bool acc_detector_presence_process(acc_detector_presence_handle_t *presence_handle, void *buffer,
216 acc_detector_presence_result_t *result);
217
218
219 /**
220 * @brief Set the start point of measurement interval in meters
221 *
222 * @param[in] presence_config The configuration
223 * @param[in] start The start point of measurement interval in meters
224 */
225 void acc_detector_presence_config_start_set(acc_detector_presence_config_t *presence_config, float start);
226
227
228 /**
229 * @brief Get the start point of measurement interval in meters
230 *
231 * @param[in] presence_config The configuration
232 * @return The start point of measurement interval in meters
233 */
234 float acc_detector_presence_config_start_get(const acc_detector_presence_config_t *presence_config);
235
236
237 /**
238 * @brief Set the end point of measurement interval in meters
239 *
240 * @param[in] presence_config The configuration
241 * @param[in] end The end point of measurement interval in meters
242 */
243 void acc_detector_presence_config_end_set(acc_detector_presence_config_t *presence_config, float end);
244
245
246 /**
247 * @brief Get the end point of measurement interval in meters
248 *
249 * @param[in] presence_config The configuration
250 * @return The end point of measurement interval in meters
251 */
252 float acc_detector_presence_config_end_get(const acc_detector_presence_config_t *presence_config);
253
254
255 /**
256 * @brief Set the step length in points
257 *
258 * This sets the number of steps between each data point.
259 *
260 * The set step length will only be used if step length auto selection was disabled
261 * through @ref acc_detector_presence_config_auto_step_length_set
262 *
263 * Sampling produces complex (IQ) data points with configurable distance spacing,
264 * starting from ~2.5mm.
265 *
266 * @param[in] presence_config The configuration
267 * @param[in] step_length The step length
268 */
269 void acc_detector_presence_config_step_length_set(acc_detector_presence_config_t *presence_config, uint16_t step_length);
270
271
272 /**
273 * @brief Get the step length in points
274 *
275 * @see acc_detector_presence_config_step_length_set
276 *
277 * @param[in] presence_config The configuration
278 * @return The step length
279 */
280 uint16_t acc_detector_presence_config_step_length_get(const acc_detector_presence_config_t *presence_config);
281
282
283 /**
284 * @brief Enable automatic selection of step length based on the profile
285 *
286 * The highest possible step length based on the fwhm of the set profile
287 * with the goal to achieve detection on the complete range with minimum number
288 * of sampling points
289 *
290 * @param[in] presence_config The configuration
291 * @param[in] enable true to enable auto selection, false to disable
292 */
293 void acc_detector_presence_config_auto_step_length_set(acc_detector_presence_config_t *presence_config, bool enable);
294
295
296 /**
297 * @brief Get if automatic selection of step length based on the profile is enabled
298 *
299 * See @ref acc_detector_presence_config_auto_step_length_set
300 *
301 * @param[in] presence_config The configuration
302 * @return true if automatic selection of step length is enabled, false if disabled
303 */
304 bool acc_detector_presence_config_auto_step_length_get(const acc_detector_presence_config_t *presence_config);
305
306
307 /**
308 * @brief Set a profile
309 *
310 * Each profile consists of a number of settings for the sensor that configures
311 * the RX and TX paths. Lower profiles have higher depth resolution while
312 * higher profiles have higher SNR.
313 *
314 * The set profile will only be used if profile auto selection was disabled
315 * through @ref acc_detector_presence_config_auto_profile_set
316 *
317 * @param[in] presence_config The configuration
318 * @param[in] profile The profile to set
319 */
320 void acc_detector_presence_config_profile_set(acc_detector_presence_config_t *presence_config, acc_config_profile_t profile);
321
322
323 /**
324 * @brief Get the currently set profile
325 *
326 * See @ref acc_detector_presence_config_profile_set
327 *
328 * @param[in] presence_config The configuration
329 * @return The profile currently used
330 */
331 acc_config_profile_t acc_detector_presence_config_profile_get(const acc_detector_presence_config_t *presence_config);
332
333
334 /**
335 * @brief Enable automatic selection of profile based on start point of measurement
336 *
337 * The highest possible profile without interference of direct leakage will used to maximize SNR
338 *
339 * @param[in] presence_config The configuration
340 * @param[in] enable true to enable auto selection, false to disable
341 */
342 void acc_detector_presence_config_auto_profile_set(acc_detector_presence_config_t *presence_config, bool enable);
343
344
345 /**
346 * @brief Get if automatic selection of profile based on start point of measurement is enabled
347 *
348 * See @ref acc_detector_presence_config_auto_profile_set
349 *
350 * @param[in] presence_config The configuration
351 * @return true if automatic selection of profile is enabled, false if disabled
352 */
353 bool acc_detector_presence_config_auto_profile_get(const acc_detector_presence_config_t *presence_config);
354
355
356 /**
357 * @brief Set inter frame idle state
358 *
359 * The 'inter-frame idle state' is the state the sensor idles in between each frame.
360 *
361 * See also @ref acc_config_idle_state_t.
362 *
363 * @param[in] presence_config The configuration
364 * @param[in] idle_state The idle state to use between frames
365 */
366 void acc_detector_presence_config_inter_frame_idle_state_set(acc_detector_presence_config_t *presence_config,
367 acc_config_idle_state_t idle_state);
368
369
370 /**
371 * @brief Get inter frame idle state
372 *
373 * See @ref acc_detector_presence_config_inter_frame_idle_state_set
374 *
375 * @param[in] presence_config The configuration
376 * @return The idle state to use between frames
377 */
378 acc_config_idle_state_t acc_detector_presence_config_inter_frame_idle_state_get(const acc_detector_presence_config_t *presence_config);
379
380
381 /**
382 * @brief Set the hardware accelerated average samples (HWAAS)
383 *
384 * See @ref acc_config_hwaas_set for more details
385 *
386 * @param[in] presence_config The configuration
387 * @param[in] hwaas Hardware accelerated average samples
388 */
389 void acc_detector_presence_config_hwaas_set(acc_detector_presence_config_t *presence_config, uint16_t hwaas);
390
391
392 /**
393 * @brief Get the hardware accelerated average samples (HWAAS)
394 *
395 * See @ref acc_detector_presence_config_hwaas_set
396 *
397 * @param[in] presence_config The configuration
398 * @return Hardware accelerated average samples
399 */
400 uint16_t acc_detector_presence_config_hwaas_get(const acc_detector_presence_config_t *presence_config);
401
402
403 /**
404 * @brief Set the number of sweeps per frame
405 *
406 * Sets the number of sweeps that will be captured in each frame (measurement).
407 *
408 * @param[in] presence_config The configuration
409 * @param[in] sweeps_per_frame Sweeps per frame, must be at least 6
410 */
411 void acc_detector_presence_config_sweeps_per_frame_set(acc_detector_presence_config_t *presence_config, uint16_t sweeps_per_frame);
412
413
414 /**
415 * @brief Get the number of sweeps per frame
416 *
417 * See @ref acc_detector_presence_config_sweeps_per_frame_set
418 *
419 * @param[in] presence_config The configuration
420 * @return Sweeps per frame
421 */
422 uint16_t acc_detector_presence_config_sweeps_per_frame_get(const acc_detector_presence_config_t *presence_config);
423
424
425 /**
426 * @brief Set the frame rate
427 *
428 * This frame rate is maintained by the sensor if @ref acc_detector_presence_config_frame_rate_app_driven_set
429 * is invoked with false (default) and the application must maintain the given frame rate if invoked with true.
430 * If the application maintains the frame rate it is important that it doesn't deviate more than 10%
431 * from the set value for the presence algorithm to work optimally.
432 * See @ref acc_config_frame_rate_set for details
433 *
434 * @param[in] presence_config The configuration
435 * @param[in] frame_rate Frame rate in Hz. Must be > 0
436 */
437 void acc_detector_presence_config_frame_rate_set(acc_detector_presence_config_t *presence_config, float frame_rate);
438
439
440 /**
441 * @brief Get the frame rate
442 *
443 * See @ref acc_detector_presence_config_frame_rate_set
444 *
445 * @param[in] presence_config The configuration
446 * @return Frame rate in Hz
447 */
448 float acc_detector_presence_config_frame_rate_get(const acc_detector_presence_config_t *presence_config);
449
450
451 /**
452 * @brief Set if the application should maintain the requested frame rate
453 *
454 * If set to true, the application must maintain the frame rate set using
455 * @ref acc_detector_presence_config_frame_rate_set
456 * If set to false, the frame rate is maintained by the sensor at the frame rate given by
457 * @ref acc_detector_presence_config_frame_rate_set.
458 *
459 * @param[in] presence_config The configuration
460 * @param[in] enable true to enable application driven frame rate, false to disable
461 */
462 void acc_detector_presence_config_frame_rate_app_driven_set(acc_detector_presence_config_t *presence_config, bool enable);
463
464
465 /**
466 * @brief Get if the application should maintain the requested frame rate
467 *
468 * See @ref acc_detector_presence_config_frame_rate_app_driven_set
469 *
470 * @param[in] presence_config The configuration
471 * @return true if application driven frame rate is enabled, false if disabled
472 */
473 bool acc_detector_presence_config_frame_rate_app_driven_get(const acc_detector_presence_config_t *presence_config);
474
475
476 /**
477 * @brief Set sensor ID
478 *
479 * @param[in] presence_config The configuration to set the sensor ID for
480 * @param[in] sensor_id The sensor ID
481 */
482 void acc_detector_presence_config_sensor_set(acc_detector_presence_config_t *presence_config, acc_sensor_id_t sensor_id);
483
484
485 /**
486 * @brief Get sensor ID
487 *
488 * @param[in] presence_config The configuration to get the sensor ID for
489 * @return sensor ID
490 */
491 acc_sensor_id_t acc_detector_presence_config_sensor_get(const acc_detector_presence_config_t *presence_config);
492
493
494 /**
495 * @brief Set if the presence filters should reset on prepare
496 *
497 * If set to true, the presence filters will be reset when
498 * @ref acc_detector_presence_prepare is invoked.
499 *
500 * @param[in] presence_config The configuration
501 * @param[in] enable true to reset the filters on prepare, false to not reset
502 */
503 void acc_detector_presence_config_reset_filters_on_prepare_set(acc_detector_presence_config_t *presence_config, bool enable);
504
505
506 /**
507 * @brief Get if the presence filters should reset on prepare
508 *
509 * See @ref acc_detector_presence_config_reset_filters_on_prepare_set
510 *
511 * @param[in] presence_config The configuration
512 * @return true if filters should reset on prepare, false otherwise
513 */
514 bool acc_detector_presence_config_reset_filters_on_prepare_get(const acc_detector_presence_config_t *presence_config);
515
516
517 /**
518 * @brief Set the inter-frame presence timeout in seconds
519 *
520 * Number of seconds the inter-frame presence score needs to decrease before exponential
521 * scaling starts for faster decline. Should be between 0 and 30 where 0 means no timeout
522 *
523 * @param[in] presence_config The configuration
524 * @param[in] inter_frame_presence_timeout Timeout in seconds between 0 and 30
525 */
526 void acc_detector_presence_config_inter_frame_presence_timeout_set(acc_detector_presence_config_t *presence_config,
527 uint16_t inter_frame_presence_timeout);
528
529
530 /**
531 * @brief Get the inter-frame presence timeout in seconds
532 *
533 * See @ref acc_detector_presence_config_inter_frame_presence_timeout_set
534 *
535 * @param[in] presence_config The configuration
536 * @return Inter-frame presence timeout in s
537 */
538 uint16_t acc_detector_presence_config_inter_frame_presence_timeout_get(const acc_detector_presence_config_t *presence_config);
539
540
541 /**
542 * @brief Set inter-frame phase boost
543 *
544 * Used to increase detection of slow motions by utilizing the phase information in the Sparse IQ data.
545 *
546 * @param[in] presence_config The configuration to set inter phase boost for
547 * @param[in] enable true if inter phase boost should be enabled
548 */
549 void acc_detector_presence_config_inter_phase_boost_set(acc_detector_presence_config_t *presence_config, bool enable);
550
551
552 /**
553 * @brief Get if inter-frame phase boost is enabled
554 *
555 * See @ref acc_detector_presence_config_inter_phase_boost_set
556 *
557 * @param[in] presence_config The configuration to get inter phase boost for
558 * @return true if inter-frame phase boost is enabled, false otherwise
559 */
560 bool acc_detector_presence_config_inter_phase_boost_get(const acc_detector_presence_config_t *presence_config);
561
562
563 /**
564 * @brief Set intra-frame presence detection
565 *
566 * This is used for detecting faster movements inside frames
567 *
568 * @param[in] presence_config The configuration to set intra-frame detection for
569 * @param[in] enable true if intra-frame detection should be enabled
570 */
571 void acc_detector_presence_config_intra_detection_set(acc_detector_presence_config_t *presence_config, bool enable);
572
573
574 /**
575 * @brief Get if frame intra-frame presence detection is enabled
576 *
577 * See @ref acc_detector_presence_config_intra_detection_set
578 *
579 * @param[in] presence_config The configuration to get intra detection for
580 * @return true if intra-frame detection is enabled, false otherwise
581 */
582 bool acc_detector_presence_config_intra_detection_get(const acc_detector_presence_config_t *presence_config);
583
584
585 /**
586 * @brief Set the detection threshold for the intra-frame presence detection
587 *
588 * This is the threshold for detecting faster movements inside frames
589 *
590 * @param[in] presence_config The configuration to set the detection threshold for
591 * @param[in] intra_detection_threshold The intra-frame detection threshold to set
592 */
593 void acc_detector_presence_config_intra_detection_threshold_set(acc_detector_presence_config_t *presence_config,
594 float intra_detection_threshold);
595
596
597 /**
598 * @brief Get the detection threshold for the intra-frame presence detection
599 *
600 * See @ref acc_detector_presence_config_intra_detection_threshold_set
601 *
602 * @param[in] presence_config The configuration to get the detection threshold for
603 * @return The intra-frame detection threshold
604 */
605 float acc_detector_presence_config_intra_detection_threshold_get(const acc_detector_presence_config_t *presence_config);
606
607
608 /**
609 * @brief Set inter-frame presence detection
610 *
611 * This is used for detecting slower movements between frames
612 *
613 * @param[in] presence_config The configuration to set inter-frame detection for
614 * @param[in] enable true if inter-frame presence detection should be enabled
615 */
616 void acc_detector_presence_config_inter_detection_set(acc_detector_presence_config_t *presence_config, bool enable);
617
618
619 /**
620 * @brief Get if inter-frame presence detection is enabled
621 *
622 * See @ref acc_detector_presence_config_inter_detection_set
623 *
624 * @param[in] presence_config The configuration to get inter-frame presence detection for
625 * @return true if inter-frame presence detection is enabled, false otherwise
626 */
627 bool acc_detector_presence_config_inter_detection_get(const acc_detector_presence_config_t *presence_config);
628
629
630 /**
631 * @brief Set the detection threshold for the inter-frame presence detection
632 *
633 * This is the threshold for detecting slower movements between frames
634 *
635 * @param[in] presence_config The configuration to set the detection threshold for
636 * @param[in] inter_detection_threshold The threshold
637 */
638 void acc_detector_presence_config_inter_detection_threshold_set(acc_detector_presence_config_t *presence_config,
639 float inter_detection_threshold);
640
641
642 /**
643 * @brief Get the detection threshold for the inter-frame presence detection
644 *
645 * See @ref acc_detector_presence_config_inter_detection_threshold_set
646 *
647 * @param[in] presence_config The configuration to get the detection threshold for
648 * @return detection threshold
649 */
650 float acc_detector_presence_config_inter_detection_threshold_get(const acc_detector_presence_config_t *presence_config);
651
652
653 /**
654 * @brief Set the time constant of the low pass filter for the inter-frame deviation between fast and slow
655 *
656 * @param[in] presence_config The configuration
657 * @param[in] inter_frame_deviation_time_const Time constant to set
658 */
659 void acc_detector_presence_config_inter_frame_deviation_time_const_set(acc_detector_presence_config_t *presence_config,
660 float inter_frame_deviation_time_const);
661
662
663 /**
664 * @brief Get the time constant of the low pass filter for the inter-frame deviation between fast and slow
665 *
666 * @param[in] presence_config The configuration to get the time constant for
667 * @return time constant in s
668 */
669 float acc_detector_presence_config_inter_frame_deviation_time_const_get(const acc_detector_presence_config_t *presence_config);
670
671
672 /**
673 * @brief Set the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean
674 *
675 * No filtering is applied if the cutoff is set over half the frame rate (Nyquist limit).
676 *
677 * @param[in] presence_config The configuration
678 * @param[in] inter_frame_fast_cutoff Cutoff frequency to set
679 */
680 void acc_detector_presence_config_inter_frame_fast_cutoff_set(acc_detector_presence_config_t *presence_config,
681 float inter_frame_fast_cutoff);
682
683
684 /**
685 * @brief Get the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean
686 *
687 * @param[in] presence_config The configuration to get the cutoff frequency for
688 * @return the cutoff frequency in Hz
689 */
690 float acc_detector_presence_config_inter_frame_fast_cutoff_get(const acc_detector_presence_config_t *presence_config);
691
692
693 /**
694 * @brief Set the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean
695 *
696 * @param[in] presence_config The configuration
697 * @param[in] inter_frame_slow_cutoff Cutoff frequency to set
698 */
699 void acc_detector_presence_config_inter_frame_slow_cutoff_set(acc_detector_presence_config_t *presence_config,
700 float inter_frame_slow_cutoff);
701
702
703 /**
704 * @brief Get the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean
705 *
706 * @param[in] presence_config The configuration to get the cutoff frequency for
707 * @return the cutoff frequency in Hz
708 */
709 float acc_detector_presence_config_inter_frame_slow_cutoff_get(const acc_detector_presence_config_t *presence_config);
710
711
712 /**
713 * @brief Set the time constant for the depthwise filtering in the intra-frame part
714 *
715 * @param[in] presence_config The configuration
716 * @param[in] intra_frame_time_const Time constant to set
717 */
718 void acc_detector_presence_config_intra_frame_time_const_set(acc_detector_presence_config_t *presence_config,
719 float intra_frame_time_const);
720
721
722 /**
723 * @brief Get the time constant for the depthwise filtering in the intra-frame part
724 *
725 * @param[in] presence_config The configuration to get the time constant for
726 * @return time constant in s
727 */
728 float acc_detector_presence_config_intra_frame_time_const_get(const acc_detector_presence_config_t *presence_config);
729
730
731 /**
732 * @brief Set the time constant for the output in the intra-frame part
733 *
734 * @param[in] presence_config The configuration
735 * @param[in] intra_output_time_const Time constant to set
736 */
737 void acc_detector_presence_config_intra_output_time_const_set(acc_detector_presence_config_t *presence_config,
738 float intra_output_time_const);
739
740
741 /**
742 * @brief Get the time constant for the output in the intra-frame part
743 *
744 * @param[in] presence_config The configuration to get the time constant for
745 * @return time constant in s
746 */
747 float acc_detector_presence_config_intra_output_time_const_get(const acc_detector_presence_config_t *presence_config);
748
749
750 /**
751 * @brief Set the time constant for the output in the inter-frame part
752 *
753 * @param[in] presence_config The configuration
754 * @param[in] inter_output_time_const Time constant to set
755 */
756 void acc_detector_presence_config_inter_output_time_const_set(acc_detector_presence_config_t *presence_config,
757 float inter_output_time_const);
758
759
760 /**
761 * @brief Get the time constant for the output in the inter-frame part
762 *
763 * @param[in] presence_config The configuration to get the time constant for
764 * @return time constant in s
765 */
766 float acc_detector_presence_config_inter_output_time_const_get(const acc_detector_presence_config_t *presence_config);
767
768
769 /**
770 * @}
771 */
772
773 #endif
acc_detector_presence_result_t::inter_presence_score
float inter_presence_score
Definition: acc_detector_presence.h:63
acc_detector_presence_config_inter_detection_set
void acc_detector_presence_config_inter_detection_set(acc_detector_presence_config_t *presence_config, bool enable)
Set inter-frame presence detection.
acc_detector_presence_config_sweeps_per_frame_set
void acc_detector_presence_config_sweeps_per_frame_set(acc_detector_presence_config_t *presence_config, uint16_t sweeps_per_frame)
Set the number of sweeps per frame.
acc_detector_presence_prepare
bool acc_detector_presence_prepare(acc_detector_presence_handle_t *presence_handle, acc_detector_presence_config_t *presence_config, acc_sensor_t *sensor, const acc_cal_result_t *cal_result, void *buffer, uint32_t buffer_size)
Prepare the detector to do a measurement.
acc_detector_presence_destroy
void acc_detector_presence_destroy(acc_detector_presence_handle_t *presence_handle)
Destroy a presence detector identified with the provided handle.
acc_detector_presence_config_hwaas_set
void acc_detector_presence_config_hwaas_set(acc_detector_presence_config_t *presence_config, uint16_t hwaas)
Set the hardware accelerated average samples (HWAAS)
acc_processing_result_t
Result provided by the processing module.
Definition: acc_processing.h:71
acc_detector_presence_config_log
void acc_detector_presence_config_log(const acc_detector_presence_config_t *presence_config)
Print a configuration to the log.
acc_detector_presence_result_t::depthwise_presence_scores_length
uint32_t depthwise_presence_scores_length
Definition: acc_detector_presence.h:81
acc_detector_presence_config_inter_phase_boost_set
void acc_detector_presence_config_inter_phase_boost_set(acc_detector_presence_config_t *presence_config, bool enable)
Set inter-frame phase boost.
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:39
acc_detector_presence_config_inter_frame_deviation_time_const_set
void acc_detector_presence_config_inter_frame_deviation_time_const_set(acc_detector_presence_config_t *presence_config, float inter_frame_deviation_time_const)
Set the time constant of the low pass filter for the inter-frame deviation between fast and slow.
acc_detector_presence_metadata_t::step_length_m
float step_length_m
Definition: acc_detector_presence.h:106
acc_detector_presence_config_reset_filters_on_prepare_get
bool acc_detector_presence_config_reset_filters_on_prepare_get(const acc_detector_presence_config_t *presence_config)
Get if the presence filters should reset on prepare.
acc_detector_presence_config_auto_profile_set
void acc_detector_presence_config_auto_profile_set(acc_detector_presence_config_t *presence_config, bool enable)
Enable automatic selection of profile based on start point of measurement.
acc_detector_presence_result_t::processing_result
acc_processing_result_t processing_result
Definition: acc_detector_presence.h:86
acc_detector_presence_config_start_get
float acc_detector_presence_config_start_get(const acc_detector_presence_config_t *presence_config)
Get the start point of measurement interval in meters.
acc_cal_result_t
Definition: acc_definitions_a121.h:19
acc_detector_presence_config_frame_rate_set
void acc_detector_presence_config_frame_rate_set(acc_detector_presence_config_t *presence_config, float frame_rate)
Set the frame rate.
acc_detector_presence_config_inter_output_time_const_get
float acc_detector_presence_config_inter_output_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant for the output in the inter-frame part.
acc_detector_presence_metadata_t::start_m
float start_m
Definition: acc_detector_presence.h:100
acc_detector_presence_metadata_t::profile
acc_config_profile_t profile
Definition: acc_detector_presence.h:119
acc_detector_presence_get_buffer_size
bool acc_detector_presence_get_buffer_size(const acc_detector_presence_handle_t *presence_handle, uint32_t *buffer_size)
Get the buffer size needed for the provided presence detector handle.
acc_detector_presence_result_t::presence_detected
bool presence_detected
Definition: acc_detector_presence.h:55
acc_detector_presence_config_intra_detection_threshold_set
void acc_detector_presence_config_intra_detection_threshold_set(acc_detector_presence_config_t *presence_config, float intra_detection_threshold)
Set the detection threshold for the intra-frame presence detection.
acc_detector_presence_config_inter_frame_slow_cutoff_get
float acc_detector_presence_config_inter_frame_slow_cutoff_get(const acc_detector_presence_config_t *presence_config)
Get the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean.
acc_detector_presence_config_inter_frame_idle_state_get
acc_config_idle_state_t acc_detector_presence_config_inter_frame_idle_state_get(const acc_detector_presence_config_t *presence_config)
Get inter frame idle state.
acc_detector_presence_config_end_get
float acc_detector_presence_config_end_get(const acc_detector_presence_config_t *presence_config)
Get the end point of measurement interval in meters.
acc_detector_presence_config_inter_detection_get
bool acc_detector_presence_config_inter_detection_get(const acc_detector_presence_config_t *presence_config)
Get if inter-frame presence detection is enabled.
acc_detector_presence_config_hwaas_get
uint16_t acc_detector_presence_config_hwaas_get(const acc_detector_presence_config_t *presence_config)
Get the hardware accelerated average samples (HWAAS)
acc_sensor.h
acc_detector_presence_config_inter_frame_presence_timeout_get
uint16_t acc_detector_presence_config_inter_frame_presence_timeout_get(const acc_detector_presence_config_t *presence_config)
Get the inter-frame presence timeout in seconds.
acc_detector_presence_result_t
Presence detector results container.
Definition: acc_detector_presence.h:50
acc_detector_presence_config_inter_frame_presence_timeout_set
void acc_detector_presence_config_inter_frame_presence_timeout_set(acc_detector_presence_config_t *presence_config, uint16_t inter_frame_presence_timeout)
Set the inter-frame presence timeout in seconds.
acc_detector_presence_metadata_t::num_points
uint16_t num_points
Definition: acc_detector_presence.h:113
acc_detector_presence_config_destroy
void acc_detector_presence_config_destroy(acc_detector_presence_config_t *presence_config)
Destroy a presence detector configuration.
acc_detector_presence_metadata_t
Definition: acc_detector_presence.h:93
acc_detector_presence_config_intra_detection_get
bool acc_detector_presence_config_intra_detection_get(const acc_detector_presence_config_t *presence_config)
Get if frame intra-frame presence detection is enabled.
acc_detector_presence_config_end_set
void acc_detector_presence_config_end_set(acc_detector_presence_config_t *presence_config, float end)
Set the end point of measurement interval in meters.
acc_detector_presence_config_intra_output_time_const_set
void acc_detector_presence_config_intra_output_time_const_set(acc_detector_presence_config_t *presence_config, float intra_output_time_const)
Set the time constant for the output in the intra-frame part.
acc_config_idle_state_t
acc_config_idle_state_t
Idle state.
Definition: acc_definitions_a121.h:61
acc_detector_presence_result_t::intra_presence_score
float intra_presence_score
Definition: acc_detector_presence.h:59
acc_detector_presence_config_inter_detection_threshold_get
float acc_detector_presence_config_inter_detection_threshold_get(const acc_detector_presence_config_t *presence_config)
Get the detection threshold for the inter-frame presence detection.
acc_detector_presence_config_inter_frame_idle_state_set
void acc_detector_presence_config_inter_frame_idle_state_set(acc_detector_presence_config_t *presence_config, acc_config_idle_state_t idle_state)
Set inter frame idle state.
acc_detector_presence_result_t::depthwise_intra_presence_scores
float * depthwise_intra_presence_scores
Definition: acc_detector_presence.h:72
acc_detector_presence_process
bool acc_detector_presence_process(acc_detector_presence_handle_t *presence_handle, void *buffer, acc_detector_presence_result_t *result)
Process the data according to the configuration used in acc_detector_presence_config_create.
acc_detector_presence_config_inter_output_time_const_set
void acc_detector_presence_config_inter_output_time_const_set(acc_detector_presence_config_t *presence_config, float inter_output_time_const)
Set the time constant for the output in the inter-frame part.
acc_detector_presence_config_reset_filters_on_prepare_set
void acc_detector_presence_config_reset_filters_on_prepare_set(acc_detector_presence_config_t *presence_config, bool enable)
Set if the presence filters should reset on prepare.
acc_detector_presence_config_inter_frame_deviation_time_const_get
float acc_detector_presence_config_inter_frame_deviation_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant of the low pass filter for the inter-frame deviation between fast and slow.
acc_detector_presence_config_sensor_set
void acc_detector_presence_config_sensor_set(acc_detector_presence_config_t *presence_config, acc_sensor_id_t sensor_id)
Set sensor ID.
acc_detector_presence_config_intra_detection_set
void acc_detector_presence_config_intra_detection_set(acc_detector_presence_config_t *presence_config, bool enable)
Set intra-frame presence detection.
acc_detector_presence_result_t::depthwise_inter_presence_scores
float * depthwise_inter_presence_scores
Definition: acc_detector_presence.h:77
acc_detector_presence_config_step_length_get
uint16_t acc_detector_presence_config_step_length_get(const acc_detector_presence_config_t *presence_config)
Get the step length in points.
acc_detector_presence_config_t
struct acc_detector_presence_config acc_detector_presence_config_t
Definition: acc_detector_presence.h:44
acc_detector_presence_config_auto_profile_get
bool acc_detector_presence_config_auto_profile_get(const acc_detector_presence_config_t *presence_config)
Get if automatic selection of profile based on start point of measurement is enabled.
acc_detector_presence_config_auto_step_length_get
bool acc_detector_presence_config_auto_step_length_get(const acc_detector_presence_config_t *presence_config)
Get if automatic selection of step length based on the profile is enabled.
acc_sensor_id_t
uint32_t acc_sensor_id_t
Type representing a sensor ID.
Definition: acc_definitions_common.h:14
acc_detector_presence_config_inter_frame_slow_cutoff_set
void acc_detector_presence_config_inter_frame_slow_cutoff_set(acc_detector_presence_config_t *presence_config, float inter_frame_slow_cutoff)
Set the cutoff frequency of the low pass filter for the slow filtered absolute sweep mean.
acc_detector_presence_config_sweeps_per_frame_get
uint16_t acc_detector_presence_config_sweeps_per_frame_get(const acc_detector_presence_config_t *presence_config)
Get the number of sweeps per frame.
acc_detector_presence_config_frame_rate_app_driven_get
bool acc_detector_presence_config_frame_rate_app_driven_get(const acc_detector_presence_config_t *presence_config)
Get if the application should maintain the requested frame rate.
acc_detector_presence_config_frame_rate_get
float acc_detector_presence_config_frame_rate_get(const acc_detector_presence_config_t *presence_config)
Get the frame rate.
acc_detector_presence_config_profile_set
void acc_detector_presence_config_profile_set(acc_detector_presence_config_t *presence_config, acc_config_profile_t profile)
Set a profile.
acc_detector_presence_result_t::presence_distance
float presence_distance
Definition: acc_detector_presence.h:67
acc_definitions_common.h
acc_detector_presence_create
acc_detector_presence_handle_t * acc_detector_presence_create(acc_detector_presence_config_t *presence_config, acc_detector_presence_metadata_t *metadata)
Create a presence detector with the provided configuration.
acc_detector_presence_config_intra_detection_threshold_get
float acc_detector_presence_config_intra_detection_threshold_get(const acc_detector_presence_config_t *presence_config)
Get the detection threshold for the intra-frame presence detection.
acc_detector_presence_config_inter_frame_fast_cutoff_get
float acc_detector_presence_config_inter_frame_fast_cutoff_get(const acc_detector_presence_config_t *presence_config)
Get the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean.
acc_detector_presence_config_profile_get
acc_config_profile_t acc_detector_presence_config_profile_get(const acc_detector_presence_config_t *presence_config)
Get the currently set profile.
acc_detector_presence_handle_t
struct acc_detector_presence_handle acc_detector_presence_handle_t
Definition: acc_detector_presence.h:36
acc_detector_presence_config_inter_phase_boost_get
bool acc_detector_presence_config_inter_phase_boost_get(const acc_detector_presence_config_t *presence_config)
Get if inter-frame phase boost is enabled.
acc_detector_presence_config_create
acc_detector_presence_config_t * acc_detector_presence_config_create(void)
Create a configuration for a presence detector.
acc_detector_presence_config_intra_frame_time_const_get
float acc_detector_presence_config_intra_frame_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant for the depthwise filtering in the intra-frame part.
acc_detector_presence_config_start_set
void acc_detector_presence_config_start_set(acc_detector_presence_config_t *presence_config, float start)
Set the start point of measurement interval in meters.
acc_detector_presence_config_intra_output_time_const_get
float acc_detector_presence_config_intra_output_time_const_get(const acc_detector_presence_config_t *presence_config)
Get the time constant for the output in the intra-frame part.
acc_detector_presence_config_inter_detection_threshold_set
void acc_detector_presence_config_inter_detection_threshold_set(acc_detector_presence_config_t *presence_config, float inter_detection_threshold)
Set the detection threshold for the inter-frame presence detection.
acc_detector_presence_config_auto_step_length_set
void acc_detector_presence_config_auto_step_length_set(acc_detector_presence_config_t *presence_config, bool enable)
Enable automatic selection of step length based on the profile.
acc_processing.h
acc_sensor_t
struct acc_sensor acc_sensor_t
Definition: acc_sensor.h:31
acc_detector_presence_config_sensor_get
acc_sensor_id_t acc_detector_presence_config_sensor_get(const acc_detector_presence_config_t *presence_config)
Get sensor ID.
acc_detector_presence_config_intra_frame_time_const_set
void acc_detector_presence_config_intra_frame_time_const_set(acc_detector_presence_config_t *presence_config, float intra_frame_time_const)
Set the time constant for the depthwise filtering in the intra-frame part.
acc_detector_presence_config_step_length_set
void acc_detector_presence_config_step_length_set(acc_detector_presence_config_t *presence_config, uint16_t step_length)
Set the step length in points.
acc_definitions_a121.h
acc_detector_presence_config_frame_rate_app_driven_set
void acc_detector_presence_config_frame_rate_app_driven_set(acc_detector_presence_config_t *presence_config, bool enable)
Set if the application should maintain the requested frame rate.
acc_detector_presence_config_inter_frame_fast_cutoff_set
void acc_detector_presence_config_inter_frame_fast_cutoff_set(acc_detector_presence_config_t *presence_config, float inter_frame_fast_cutoff)
Set the cutoff frequency of the low pass filter for the fast filtered absolute sweep mean.