Hi guys,
First of all, many thanks to luisrodenas for sharing this work! And to all who contributed on the thread along this years.
Studying the code, I have stumbled on a doubt that many here have posted without a definitive answer, which was asked also in many other sources that refers to this calibration code.
What is the motivation for the division by 8 and 4 in the calibration function?
ax_offset=-mean_ax/8;
ay_offset=-mean_ay/8;
az_offset=(16384-mean_az)/8;
gx_offset=-mean_gx/4;
gy_offset=-mean_gy/4;
gz_offset=-mean_gz/4;
I have searched a lot but couldn't figure it out. Was it based on trial and error?
Also, when we use the setOffset functions, what those really do in the sensor?
accelgyro.setXAccelOffset(ax_offset);
accelgyro.setYAccelOffset(ay_offset);
accelgyro.setZAccelOffset(az_offset);
accelgyro.setXGyroOffset(gx_offset);
accelgyro.setYGyroOffset(gy_offset);
accelgyro.setZGyroOffset(gz_offset);
For example, if I took the ax_offset, ay_offset, az_offset, gx_offset, gy_offset, and gz_offset values, and subtract from raw data taken from the sensor (without any offset configuration), would that have the same effect? I am looking forward to experiment it myself, but I still don't have access to the resources yet.
Many thanks