Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
Scale and center x
using the minimum and maximum values of the sensor. scale
value indicates the maximum value x
will have after being scaled (i.e. values will range -scale to
+scale
).
1 | calibrate.axis(x, max, min, scale = 1)
|
x |
a numeric vector of axis values. |
max |
maximum uncalibrated value of the axis. This should be measured empirically through a series of calibration
rotations. For a magnetometer axis, |
min |
see |
scale |
the maximum value |
This function is useful for calibrating the axes of magnetometers/accelerometers and correcting for hard-iron distortion. Centering and scaling each axis will standardize and essentially calibrate each axis so that the simulaneous measurements of each will be trigonometrically accurate. This function effectively deals with hard iron distortion problems as well as small misalignments between axes. However, there are other factors that can cause discontinuity (e.g. temperature, electronic noise, etc.) that are not accounted for in this function. For a more complete discussion of dealing with compass errors see Caruso (2000).
object of scaled/centered values of x
.
If any dynamic acceleration is present during the calibration procedure or track, it will result in an erroneous calibration. This can be avoided by keeping the sensor still and by pausing during rotations. Once the calibration constants are known for the instrument, they can be applied to the raw signal from the deployment on the animal. But remember, the raw accelerometer signal will contain both static and dynamic acceleration, so the accelerometer signal must be filtered using a low-pass filter to extract the static signal.
If no distortion is present, plot(x,y)
will be circular and centered on (0,0). If hard-iron distortion is present, the center of the circle will not be (0,0), it will be shifted along the x, y, or both axes. However, the plot should still be circular. If the plot is not circular (e.g. ellipsoid), then soft-iron effects may be at play. In which case, a more complex calibration is needed. See Caruso (2000) for a discussion of compass and accelerometer errors. The hard-iron calibration used in this function is commonly implemented and can be found in Grygorenko (2011), among others.
Ed Farrell <edward.farrell27@gmail.com>
Caruso, M. J. (2000), Applications of magnetic sensors for low cost compass systems. Proc. Position Location and Navigation Symp., IEEE 2000, Mar. 2000, pp. 177-184
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## Import the missionbay_calib2 dataset. There is a calibration sequence
## at Mission Bay, CA. Use help(missionbay_calib2) for info.
data(missionbay_calib2)
mx <- missionbay_calib2$mx_raw
my <- missionbay_calib2$my_raw
mz <- missionbay_calib2$mz_raw
ax <- missionbay_calib2$ax_raw
ay <- missionbay_calib2$ay_raw
az <- missionbay_calib2$az_raw
## Scale and center the magnetometer axes. Also, make sure that each axis
## is in the NED (north-east-down) orientation (this is the reason for the
## negative signs).
Mxscaled <- calibrate.axis(mx, max(mx), min(mx))
Myscaled <- -calibrate.axis(my, max(my), min(my))
Mzscaled <- -calibrate.axis(mz, max(mz), min(mz))
## Scale and center the accelerometer axes. Also, make sure that each axis
## is in the NED (north-east-down) orientation.
Axscaled <- -calibrate.axis(ax, max(ax), min(ax))
Ayscaled <- calibrate.axis(ay, max(ay), min(ay))
Azscaled <- calibrate.axis(az, max(az), min(az))
## Compare
par(mfrow=c(2,3))
plot(mx,type="l",col="blue",xlab="time (s)",ylab="bits",main="Mx Raw",lwd=3)
plot(my,type="l",col="blue",xlab="time (s)",ylab="bits",main="My Raw",lwd=3)
plot(mz,type="l",col="blue",xlab="time (s)",ylab="bits",main="Mz Raw",lwd=3)
plot(Mxscaled,type="l",col="red",xlab="time (s)",ylab="bits",main="Mx Calibrated",lwd=3)
plot(Myscaled,type="l",col="red",xlab="time (s)",ylab="bits",main="My Calibrated",lwd=3)
plot(Mzscaled,type="l",col="red",xlab="time (s)",ylab="bits",main="Mz Calibrated",lwd=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.