ref_app_parking.h
Go to the documentation of this file.
1 // Copyright (c) Acconeer AB, 2024
2 // All rights reserved
3 // This file is subject to the terms and conditions defined in the file
4 // 'LICENSES/license_acconeer.txt', (BSD 3-Clause License) which is part
5 // of this source code package.
6 
7 #ifndef REF_APP_PARKING_H_
8 #define REF_APP_PARKING_H_
9 
10 
11 #include <stdbool.h>
12 #include <stdint.h>
13 
14 #include "acc_definitions_a121.h"
15 #include "acc_definitions_common.h"
16 
17 
18 /**
19  * @brief Parking application handle
20  */
22 
24 
25 
26 /**
27  * @brief Configuration presets - a set of configurations for a specific sensor placement
28  */
29 typedef enum
30 {
31  /*! No preset, user needs to set each specific parameter themselves */
33  /*! Sensor placed on ground beneath car, obstruction detection enabled */
35  /*! Sensor placed on pole beside car, obstruction detection disabled */
38 
39 
40 /**
41  * @brief Configuration for car detection
42  */
43 typedef struct
44 {
46  float range_end_m;
47  uint16_t hwaas;
49  uint8_t subsweep_index;
50 
51  uint16_t queue_length_n;
56 
57 
58 /**
59  * @brief Configuration for obstruction detection
60  */
61 typedef struct
62 {
64  float range_end_m;
65  uint16_t hwaas;
67  uint8_t subsweep_index;
68 
69  float threshold;
72 
73 
74 /**
75  * @brief Overall configuration for parking application
76  */
77 typedef struct
78 {
80  float frame_rate;
83 
87 
88 
89 /**
90  * @brief Set parking config according to specified preset
91  *
92  * @param[in] preset The preset used to set parking config
93  * @param[out] parking_config The parking config to be set
94  */
96 
97 
98 /**
99  * @brief Create parking handle
100  *
101  * The handle is used for both control and processing
102  *
103  * This function enables the sensor
104  *
105  * @param[in] parking_config The parking config used to create the parking handle
106  * @param[in] sensor_id The sensor_id for the sensor to be used
107  * @return A parking handle, or NULL if creation failed
108  */
110 
111 
112 /**
113  * @brief Destroy parking handle
114  *
115  * This function disables the sensor
116  *
117  * @param[in] handle The handle to destroy
118  */
120 
121 
122 /**
123  * @brief Sensor calibration
124  *
125  * @param[in] handle The handle to calibrate sensor for
126  * @return true if successful, false otherwise
127  */
129 
130 
131 /**
132  * @brief Noise calibration
133  *
134  * @param[in] handle The handle to calibrate noise for
135  * @return true if successful, false otherwise
136  */
138 
139 
140 /**
141  * @brief Obstruction calibration
142  *
143  * Note that the sensor must be free from obstruction when
144  * calling this function.
145  *
146  * @param[in] handle The handle to calibrate obstruction for
147  * @return true if successful, false otherwise
148  */
150 
151 
152 /**
153  * @brief Prepare sensor for measurement
154  *
155  * @param[in] handle The handle to prepare sensor for
156  * @return true if successful, false otherwise
157  */
159 
160 
161 /**
162  * @brief Perform a sensor measurement
163  *
164  * @param[in] handle The handle to do a sensor measurement for
165  * @param[in] hibernate Hibernate sensor between measurements
166  * @return true if successful, false otherwise
167  */
169 
170 
171 /**
172  * @brief Handle indications from a measurement
173  *
174  * @param[in] handle The handle to do a sensor measurement for
175  * @param[out] data_reliable Flag to determine if data from measurement is reliable.
176  * Se log for more details if false
177  * @return true if successful, false otherwise
178  */
180 
181 
182 /**
183  * @brief Do obstruction processing
184  *
185  * @param[in] handle The handle to do obstruction processing for
186  * @param[out] obstruction_detected true if obstruction detected, false otherwise
187  */
188 void ref_app_parking_obstruction_process(ref_app_parking_handle_t *handle, bool *obstruction_detected);
189 
190 
191 /**
192  * @brief Do parking processing
193  *
194  * @param[in] handle The handle to do parking processing for
195  * @param[out] car_detected true if car detected, false otherwise
196  */
197 void ref_app_parking_process(ref_app_parking_handle_t *handle, bool *car_detected);
198 
199 
200 #endif
ref_app_parking_car_config_t
Configuration for car detection.
Definition: ref_app_parking.h:43
ref_app_parking_sensor_calibration
bool ref_app_parking_sensor_calibration(ref_app_parking_handle_t *handle)
Sensor calibration.
Definition: ref_app_parking.c:355
PARKING_PRESET_GROUND
@ PARKING_PRESET_GROUND
Definition: ref_app_parking.h:34
PARKING_PRESET_POLE
@ PARKING_PRESET_POLE
Definition: ref_app_parking.h:36
ref_app_parking_obstruction_config_t::time_constant
float time_constant
Definition: ref_app_parking.h:70
ref_app_parking_config_t
Overall configuration for parking application.
Definition: ref_app_parking.h:77
ref_app_parking_set_config
void ref_app_parking_set_config(ref_app_parking_parking_preset_t preset, ref_app_parking_config_t *parking_config)
Set parking config according to specified preset.
Definition: ref_app_parking.c:201
ref_app_parking_car_config_t::signature_similarity_threshold
float signature_similarity_threshold
Definition: ref_app_parking.h:54
ref_app_parking_car_config_t::range_end_m
float range_end_m
Definition: ref_app_parking.h:46
ref_app_parking_obstruction_config_t
Configuration for obstruction detection.
Definition: ref_app_parking.h:61
ref_app_parking_measure
bool ref_app_parking_measure(ref_app_parking_handle_t *handle, bool hibernate)
Perform a sensor measurement.
Definition: ref_app_parking.c:554
ref_app_parking_obstruction_process
void ref_app_parking_obstruction_process(ref_app_parking_handle_t *handle, bool *obstruction_detected)
Do obstruction processing.
Definition: ref_app_parking.c:663
ref_app_parking_obstruction_config_t::profile
acc_config_profile_t profile
Definition: ref_app_parking.h:66
ref_app_parking_obstruction_config_t::subsweep_index
uint8_t subsweep_index
Definition: ref_app_parking.h:67
ref_app_parking_config_t::frame_rate_app_driven
bool frame_rate_app_driven
Definition: ref_app_parking.h:81
ref_app_parking_obstruction_config_t::threshold
float threshold
Definition: ref_app_parking.h:69
ref_app_parking_config_t::obstruction_detection_enabled
bool obstruction_detection_enabled
Definition: ref_app_parking.h:82
ref_app_parking_car_config_t::amplitude_threshold
float amplitude_threshold
Definition: ref_app_parking.h:52
ref_app_parking_car_config_t::weighted_distance_threshold_m
float weighted_distance_threshold_m
Definition: ref_app_parking.h:53
ref_app_parking_car_config_t::queue_length_n
uint16_t queue_length_n
Definition: ref_app_parking.h:51
ref_app_parking_sensor_prepare
bool ref_app_parking_sensor_prepare(ref_app_parking_handle_t *handle)
Prepare sensor for measurement.
Definition: ref_app_parking.c:537
ref_app_parking_obstruction_config_t::hwaas
uint16_t hwaas
Definition: ref_app_parking.h:65
ref_app_parking_process
void ref_app_parking_process(ref_app_parking_handle_t *handle, bool *car_detected)
Do parking processing.
Definition: ref_app_parking.c:711
ref_app_parking_handle
Definition: ref_app_parking.c:34
ref_app_parking_obstruction_config_t::range_start_m
float range_start_m
Definition: ref_app_parking.h:63
handle
cargo_handle_t * handle
Definition: i2c_example_cargo.c:35
ref_app_parking_noise_calibration
bool ref_app_parking_noise_calibration(ref_app_parking_handle_t *handle)
Noise calibration.
Definition: ref_app_parking.c:390
ref_app_parking_config_t::obstruction_config
ref_app_parking_obstruction_config_t obstruction_config
Definition: ref_app_parking.h:85
ref_app_parking_config_t::frame_rate
float frame_rate
Definition: ref_app_parking.h:80
ref_app_parking_obstruction_config_t::range_end_m
float range_end_m
Definition: ref_app_parking.h:64
ref_app_parking_handle::parking_config
ref_app_parking_config_t parking_config
Definition: ref_app_parking.c:37
ref_app_parking_handle_create
ref_app_parking_handle_t * ref_app_parking_handle_create(ref_app_parking_config_t *parking_config, acc_sensor_id_t sensor_id)
Create parking handle.
Definition: ref_app_parking.c:252
ref_app_parking_obstruction_calibration
bool ref_app_parking_obstruction_calibration(ref_app_parking_handle_t *handle)
Obstruction calibration.
Definition: ref_app_parking.c:445
ref_app_parking_config_t::car_config
ref_app_parking_car_config_t car_config
Definition: ref_app_parking.h:84
PARKING_PRESET_NONE
@ PARKING_PRESET_NONE
Definition: ref_app_parking.h:32
ref_app_parking_car_config_t::subsweep_index
uint8_t subsweep_index
Definition: ref_app_parking.h:49
acc_sensor_id_t
uint32_t acc_sensor_id_t
Type representing a sensor ID.
Definition: acc_definitions_common.h:13
ref_app_parking_car_config_t::profile
acc_config_profile_t profile
Definition: ref_app_parking.h:48
ref_app_parking_handle_destroy
void ref_app_parking_handle_destroy(ref_app_parking_handle_t *handle)
Destroy parking handle.
Definition: ref_app_parking.c:284
ref_app_parking_handle::sensor_id
acc_sensor_id_t sensor_id
Definition: ref_app_parking.c:41
ref_app_parking_handle_indications
bool ref_app_parking_handle_indications(ref_app_parking_handle_t *handle, bool *data_reliable)
Handle indications from a measurement.
Definition: ref_app_parking.c:597
acc_config_profile_t
acc_config_profile_t
Profile.
Definition: acc_definitions_a121.h:49
acc_definitions_common.h
ref_app_parking_parking_preset_t
ref_app_parking_parking_preset_t
Configuration presets - a set of configurations for a specific sensor placement.
Definition: ref_app_parking.h:29
ref_app_parking_car_config_t::range_start_m
float range_start_m
Definition: ref_app_parking.h:45
ref_app_parking_config_t::preset
ref_app_parking_parking_preset_t preset
Definition: ref_app_parking.h:79
ref_app_parking_car_config_t::hwaas
uint16_t hwaas
Definition: ref_app_parking.h:47
acc_definitions_a121.h