Imu temp calibration
-
Hello, I have a voxl2 mini that I'm doing development on and I'm running in to issues with the temperature calibration on the imu, mostly that I can't get it to work. When I try to run the calibration it doesn't complete and says "not enough samples, need at least 3" It feels like I'm missing something obvious but I've tried it a few times to the same result. Any help or guidance is appreciated.
-
the source code is here
You can run in debug mode to get more info, but it seems the temperature of the IMU has not really changed from the start (34C vs 31C). The cpu stressing may not be enough. You should check output of
top
while the stressing of CPU is running (the application just burns cpu cycles in order to heat up the cpu, which will heat up the IMU to help with temperature calibration). How long did the procedure run before it stopped? -
@Alex-Kushleyev
it runs for about a minute and it seems to be stressing the cpu but not enough to raise the temp significantly, in my setup the voxl is sitting in a metal housing so does it just not get hot enough for it to run the calibration properly?
-
@mkriesel , yes, i believe your conclusion is correct. Something must be cooling down the board (enclosure).
It tested this myself and have a small tip for you: setting cpu mode to performance helps to burn more power in the cpu (run this right before starting the temp calibration):
voxl-set-cpu-mode perf
Also you should start the calibration when the board is a bit colder, maybe room temp 20-25C
Try it!
-
we can also the stress function for the cpu, to make it consume more power. i will follow up about it a bit later.
-
If you need the cpu stress function to generate more heat, here is something that works. you can replace the current function with this one. It adds a memcpy() operation which uses a lot of power. You can tune
do_memcpy_every_nth
to control more or less heat (decreasing the number will use heat up cpu more).Original function is here
#define STRESS_ARRAY_SIZE (128*1024) static void* _stress_function(__attribute__((unused)) void* arg) { uint8_t * _stress_array = malloc(sizeof(uint8_t)*STRESS_ARRAY_SIZE); uint32_t cntr = 0; while(stress_running){ cntr++; volatile double s = sqrt(rand()); //this helps slow down the while loop const int do_memcpy_every_nth = 50; //do not perform memcpy every loop because cpu can get hot very quickly if ((cntr % do_memcpy_every_nth) == 0){ memcpy(_stress_array,_stress_array+STRESS_ARRAY_SIZE/2,sizeof(uint8_t)*STRESS_ARRAY_SIZE/2); } } //printf("stress thread exiting\n"); free(_stress_array); return NULL; }