example_processing_static_presence.c Example program that shows how the spread of the phase values can be used to determine if there is a static object in front of the radar.In this example we use the the ratio of the coherent average to the noncoherent average to calculate the spread and determine if the phase values are aligned or not. It is also possible to measure the spread in other way, for example by calculating the standard deviation of the phase values.
Note that this example is mainly intended for detecting the precense of static objects in front of the radar sensor, while Acconeer's presence detector detects objects that moves or vibrates sligtly, ignoring static objects.
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#define SENSOR_ID (1U)
#define SWEEPS_PER_FRAME 16
#define PHASE_SPREAD_TRESHOLD (0.01f)
{
(void)argc;
(void)argv;
{
return EXIT_FAILURE;
}
if (!res)
{
printf(
"acc_control_helper_create() failed\n");
return EXIT_FAILURE;
}
if (!res)
{
printf(
"acc_control_helper_activate() failed\n");
return EXIT_FAILURE;
}
bool mem_ok = (phase_spread != NULL) && (point_vector != NULL);
if (!mem_ok)
{
printf(
"Memory allocation for vectors failed\n");
goto clean_up;
}
uint32_t iterations = 5U;
for (uint32_t i = 0U; i < iterations; i++)
{
if (!res)
{
printf(
"acc_control_helper_get_next() failed\n");
break;
}
for (uint32_t p = 0U; p < sweep_data_length; p++)
{
phase_spread->
data[p] = 1 - coherent_mean / noncoherent_mean;
}
for (uint32_t p = 0U; p < sweep_data_length; p++)
{
}
}
clean_up:
if (res && mem_ok)
{
printf(
"Application finished OK\n");
return EXIT_SUCCESS;
}
else
{
return EXIT_FAILURE;
}
}
{
int32_t start_point = 100;
uint16_t step_length = 24;
uint16_t num_points = 20;
}
void acc_config_start_point_set(acc_config_t *config, int32_t start_point)
Set the starting point of the sweep.
bool acc_control_helper_create(acc_control_helper_t *radar, acc_sensor_id_t sensor_id)
Create a helper instance.
float acc_vector_iq_coherent_mean_amplitude(const acc_vector_iq_t *vector_a)
Coherent mean amplitude of IQ vector.
void acc_get_iq_point_vector(const acc_control_helper_t *control_helper_state, uint32_t point, acc_vector_iq_t *vector_out)
Extract an IQ vector with sweep data for a specific point from a newly captured IQ frame with multipl...
void acc_vector_float_free(acc_vector_float_t *vector)
Free storage of data elements in a float vector.
int acconeer_main(int argc, char *argv[])
Assembly test example.
void acc_vector_iq_free(acc_vector_iq_t *vector)
Free storage of data elements in an IQ vector.
#define PHASE_SPREAD_TRESHOLD
void acc_config_profile_set(acc_config_t *config, acc_config_profile_t profile)
Set a profile.
void acc_config_sweeps_per_frame_set(acc_config_t *config, uint16_t sweeps)
Set sweeps per frame.
void acc_control_helper_destroy(acc_control_helper_t *radar)
Destroy a helper instance.
const acc_hal_a121_t * acc_hal_rss_integration_get_implementation(void)
Get hal implementation reference.
acc_processing_metadata_t proc_meta
@ ACC_CONFIG_PRF_13_0_MHZ
void acc_config_hwaas_set(acc_config_t *config, uint16_t hwaas)
Set the hardware accelerated average samples (HWAAS)
static void update_configuration(acc_config_t *config)
const char * acc_version_get(void)
Get the version of the Acconeer software.
struct acc_config acc_config_t
void acc_config_step_length_set(acc_config_t *config, uint16_t step_length)
Set the step length in a sweep.
void acc_config_num_points_set(acc_config_t *config, uint16_t num_points)
Set the number of data points to measure.
acc_vector_iq_t * acc_vector_iq_alloc(uint32_t data_length)
Allocate storage for an IQ vector.
acc_vector_float_t * acc_vector_float_alloc(uint32_t data_length)
Allocate storage for a float vector.
float acc_vector_iq_noncoherent_mean_amplitude(const acc_vector_iq_t *vector_a)
Non-coherent mean amplitude of IQ vector.
bool acc_control_helper_activate(acc_control_helper_t *radar)
Activate the sensor.
void acc_config_prf_set(acc_config_t *config, acc_config_prf_t prf)
Set Pulse Repetition Frequency.
bool acc_control_helper_get_next(acc_control_helper_t *radar)
Perform a radar measurement and wait for the result.