IMU, Calibration and Drift
Last updated
Last updated
On board a Head Tracker there is a sensor known as IMU or Inertial Measurement Unit. These integrated circuits are actually built up of up to three sensors on one chip.
Accelerometer - measures acceleration and Earth's gravity
Gyroscope - can measure the rotational speed of the board
Magnetometer - measures the magnetic field, we are interested in the Earth's field here
Only when you incorporate all three of the above sensors it's possible to build an absolute orientation relative to the earth. The process of incorporating all these sensors is done in a Sensor Fusion algorithm. The algorithm used here is the Madgwick filter. A Gyroscope is really good at telling your head's rotational speed. You could use it alone but it has two issues: drift and integration error.
- Every gyroscope either in an IC or even a physical one used on a spacecraft all experience drift. We can counter act some of this drift with a calibration step. In the versions older than 2.2 this is done in the GUI. You must leave it sitting still in this step long enough so the majority of the drift can be canceled out. The long time to wait is due to the system noise and finding the average values. In versions 2.2+ this is done as soon as you turn it on. Leave the board sitting still until the red light stops blinking.
- Integration error is the other issue. The processor takes rotational readings as fast as possible. Each reading is multiplied by the time since the last one. This gives the change in degrees since the last measurement. The change is then added to the last one. Since it's stepped measurements all the data in between is lost causing inaccuracy. The Accelerometer can be used to cancel out the Gyro's drift in two axis, tilt and roll. Because it's known that earths gravity always pulls straight down the algorithm can now cancel drift on the tilt and roll. The accelerometer readings are fairly clean, they always points straight down. You could even calculate the tilt and roll directly since as a Head Tracker you are stationary. This is why the tilt and roll are always quite stable.
The Magnetometer is used to cancel out the drift on the pan axis. This sensor is where a lot of problems arise. The problem lies in that the strength of the magnetic field of the Earth can easily be overpowered by local sources of magnetic field such as:
- Electric currents - Permanent magnets - Iron and other permeable metals objects
Every location on the earth has different direction of the Earth's magnetic field. It will be pretty much unusable on the north and south poles as it will mostly just point downwards like an accelerometer. The calibration step can only alleviate two of these issues. You can only correct the sensors offset's and the warping caused by metal objects nearby. This is what the calibration step is doing. It is trying to find a way from the readings it took to incorporate them back into a perfect sphere.
This is the most important step. Without a good magnetic calibration you are going to get drift/instability in the pan axis. Be sure to do this far away from magnetic field sources (computers, speakers, power cables, etc.)... as far away as your USB cable length will allow.
You need to do the calibration with the board mounted on your goggles. Everything including goggles should be powered up. If you cannot get the calibration step to pass like this it will not give good results while flying. You can test with the board alone but if you can't get a good calibration while mounted and powered up you need to re-mount the board in a different location.
The readings of the LSM9DS1 magnetometer on the Nano33BLE board are very noisy. The drift adjustment needs to be filtered quite a bit and is then slowly applied. Due to this you may see drift after startup if the initial orientation guess wasn't good. Just let it sit, rotate around a bit and it should stabilize, then re-center.
After a calibration in versions less than v2.2. Choose Save Settings then Reboot. Every time the Head Tracker boots it re-finds the initial orientation your pointing. The more stable it is on startup the better the initial guess will be. Since the values on the board change after calibration you would otherwise need to wait a while for the values to stabilize and may appear that it didn't work correctly. In v2.2+ it will re-find initial orientation after completing reducing the amount of time to stabilize.
When doing the calibration don't worry about trying to get all the values super low. It the save button shows up it has enough data.