Continuous Gesture Classification Real-time adquisition

Hi guys!
First I’d like to say that I really love Edge Impulse, it’s a very powerful tool!!
I’m running the continuous gesture classification example in my STM32F401RE with the IKS01A1 environmental board.
I already did the validation on target but It’s only with a static raw of features

static float features[] = {
-19.8800, -0.6900, 8.2300, -17.6600, -1.1300, 5.9700};

I’d like to acquire real time data from my accelerometer,make inference and then do something with the results, but I don’t know how to approach that. I think I need a buffer, store some data and then process it, but I don’t know how to do that! :frowning:
I’d love if you can provide some code for that :(.

I tryed Running Continuous Gesture Classification Locally with the code provided by @janjongboom but I got those errors:

10:23:23 **** Incremental Build of configuration Debug for project GestureRecogEdgeImpulse ****
make -j12 all
arm-none-eabi-g++ “…/Core/Src/main.cpp” -mcpu=cortex-m4 -std=gnu++14 -g3 -DUSE_HAL_DRIVER -DSTM32F401xE -DDEBUG -c -I…/Core/Inc -I…/Drivers/STM32F4xx_HAL_Driver/Inc -I…/Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I…/Drivers/CMSIS/Device/ST/STM32F4xx/Include -I…/Drivers/CMSIS/Include -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/ -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/Middlewares/ST/AI/Inc/ -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/cubeai-model/ -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/edge-impulse-sdk/ -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/edge-impulse-sdk/CMSIS/DSP/Include/ -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/edge-impulse-sdk/CMSIS/DSP/PrivateInclude/ -I…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/edge-impulse-sdk/CMSIS/NN/Include -O0 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-use-cxa-atexit -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o “Core/Src/main.o”
…/Core/Src/main.cpp:161:5: warning: "/" within comment [-Wcomment]

In file included from …/Core/Src/main.cpp:25:0:
…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/edge-impulse-sdk/classifier/ei_run_classifier.h: In function ‘EI_IMPULSE_ERROR {anonymous}::run_inference(ei::matrix_t*, ei_impulse_result_t*, bool)’:
…/Middlewares/Third_Party/EdgeImpulse_juacuegut-project-1_MachineLearning/edgeimpulse/edge-impulse-sdk/classifier/ei_run_classifier.h:590:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int ix = 0; ix < fmatrix->rows * fmatrix->cols; ix++) {
…/Core/Src/main.cpp: In function ‘int main()’:
…/Core/Src/main.cpp:166:5: error: ‘Timer’ was not declared in this scope
Timer timer;
…/Core/Src/main.cpp:166:5: note: suggested alternative: ‘timer_t’
Timer timer;
…/Core/Src/main.cpp:167:5: error: ‘timer’ was not declared in this scope
…/Core/Src/main.cpp:167:5: note: suggested alternative: ‘timer_t’
…/Core/Src/main.cpp:178:9: error: ‘BSP_ACCELERO_AccGetXYZ’ was not declared in this scope
…/Core/Src/main.cpp:193:9: error: ‘ThisThread’ has not been declared
ThisThread::sleep_for((wait_time / 1000) - 1);
…/Core/Src/main.cpp:204:8: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
…/Core/Src/main.cpp:209:22: warning: unused variable ‘res’ [-Wunused-variable]
EI_IMPULSE_ERROR res = run_classifier(&features_signal, &result, false);
make: *** [Core/Src/ Core/Src/main.o] Error 1
“make -j12 all” terminated with exit code 2. Build might be incomplete.

10:23:25 Build Failed. 6 errors, 3 warnings. (took 2s.157ms)

I would love if you can help me with a working code guys, it’s very important for me please :frowning:

Maybe those errors are because I need to link libraries but I don’t how what of them and how! :frowning:

Thank you for your help.

Hi @juacuegut the Timer class is for Mbed OS, you can safely remove those references to timer.

Then you need to replace the call to BSP_ACCELERO_AccGetXYZ() with the call to the driver for your own accelerometer. And that should be it!

Here’s a demo with CubeIDE and STM32 HAL (but you need to hook your own accelerometer calls in): STM32L476 (Disco)

Thank you for your help @janjongboom. I was having problems with STM32Cube IDE because they don’t support the IKS01A1 Environmental module anymore, so I moved to Arduino IDE, installing STM32 Libraries but I’ve some problems Filename or extension too long - STM32F401RE.
Can I have your help? :frowning: