# Usage ## prepare Request algorithm library and place the algorithm library to `${SDK}/vendor/amlogic/aml_csi/alg_lib/libaaisdk.so`. And place related header files to following path: `${SDK}/vendor/amlogic/aml_csi/alg_lib/include/iva/iva_wisense_ppd.hpp` `${SDK}/vendor/amlogic/aml_csi/alg_lib/include/iva/iva.hpp` `${SDK}/vendor/amlogic/aml_csi/alg_lib/include/iva/iva_wisense_ppd.hpp` ## Custom led `${SDK}/vendor/amlogic/aml_csi/main.cpp` adaptation wisense_led_init()& wisense_led_set() function. ## Compile Take ba401 as an example, add the following configuration to `${SDK}/buildroot/configs/amlogic/a4_ba401.config` file: ``` BR2_PACKAGE_AML_CSI=y ``` run the following command to compile: ```bash make aml-csi-rebuild && make ``` ## Config network Start the system and then close system log(Optional): ```bash echo 1 4 1 7 > /proc/sys/kernel/printk ``` Connect to wifi: ```bash wpa_cli -iwlan0 remove_network 0 wpa_cli -iwlan0 add_network 0 wpa_cli -iwlan0 set_network 0 ssid '"WiFi name"' wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK wpa_cli -iwlan0 set_network 0 psk '"password"' wpa_cli -iwlan0 set_network 0 pairwise CCMP TKIP wpa_cli -iwlan0 set_network 0 group CCMP TKIP wpa_cli -iwlan0 set_network 0 proto RSN wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 status wpa_cli -iwlan0 save dhcpcd wlan0 ``` ## Run aml_wisense demo ```bash aml_wisense -l level ``` level represents the detection sensitivity level, and the specified parameters are 1, 2, 3, and 4. The larger of the number, the higher the detection sensitivity of the algorithm. # Development ## Pipeline csi data csi data wi_out_ret wifi driver ---------> aml_wisense --------> wisense alg ----------> result ## parameter aml_wisense will automatically obtain csi data and send it to the algorithm interface, and the algorithm will return the operation result(wi_out_ret). wi_out_ret as follows: - wi_out_ret.motion_status(int): - 1: There is motion that meets the level requirements. - 0: There is no motion that meets the level requirements. - wi_out_ret.motion_class(int): The motion level detected by the algorithm, the larger of the value, the smaller the motion. - 1 or 2: Small motion, detect close range motion. A single person is within 3m range, and multiple people is within 5m range. - 3 or 4: Large motion, detect long distance motion or close range slight motion. Range up to 12m. - 0: There is no motion. - wi_out_ret.motion_value(float): Motion complex value. Float value from 0 to 1, it reflects the complexity of the current motion environment. The larger of the value, the more complex of the current motion environment is.