This class allows you to easily port to B4i a B4A app that uses the B4A PhoneSensors object with types TYPE_ACCELEROMETER, TYPE_MAGNETIC_FIELD and TYPE_GYROSCOPE.
"Out of the box" the Motion object of the iPhone library supplies:
"Out of the box" the Motion object of the iPhone library supplies:
- Uncalibrated magnetometer (GetMagnetometer) - this is not the same as the B4A TYPE_MAGNETIC_FIELD which is calibrated (i.e. corrected for device bias) - these calibration corrections can be large.
- User acceleration (GetUserAcceleration) - this is not the same as B4A TYPE_ACCELEROMETER which is user acceleration + gravity.
- Gyroscope.
- Calibrated magnetometer calibration accuracy - in this class this property can be 0 (unreliable/uncalibrated) , 1 (low), 2 (medium) or 3 (high). It is essential that this be 3 (high) before reliance is put on the calibrated magnetometer values.
Line 1: current total acceleration readings along device X Y Z axes
Line 2: max total acceleration
Line 3: min total acceleration
Line 4: current gyroscope readings about device X Y Z axes
Line 5: calibrated magnetometer calibration accuracy (if not 3, wave device around in a figure 8 pattern while slowly turning through 360 deg)
Line 6: current calibrated magnetometer readings along device X Y Z axes
Line 7: current magnetometer total intensity (should remain fairly constant regardless of device orientation)
References:
from which I was able to work out how to get calibrated magnetometer calibration accuracy.
Line 2: max total acceleration
Line 3: min total acceleration
Line 4: current gyroscope readings about device X Y Z axes
Line 5: calibrated magnetometer calibration accuracy (if not 3, wave device around in a figure 8 pattern while slowly turning through 360 deg)
Line 6: current calibrated magnetometer readings along device X Y Z axes
Line 7: current magnetometer total intensity (should remain fairly constant regardless of device orientation)
References:
- Gravity comes from this post:
from which I was able to work out how to get gyroscope.
- Calibrated magnetometer comes from this post:
from which I was able to work out how to get calibrated magnetometer calibration accuracy.
Attachments
Last edited: