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