# How is the orientation of an Opal estimated?

Orientation Estimation

We use a state space model with a Kalman Filter for orientation estimation. This approach uses a complex fusion of the accelerometer, gyroscope, and magnetometer. A detailed description is beyond the scope of this article, but the approach is not uncommon and there is a lot of freely available literature on the subject. Our particular implementation uses in-depth knowledge of the specific sensors we use.

What different options do you provide for orientation estimation?

We provide 3 different models when estimating the orientation of an Opal. They each differ in how they use the magnetometer. The 3 models are:

• No Magnetometer: This model does not allow the magnetic field to influence the orientation at all. It is the best choice in an environment where there are large non-uniformities in the magnetic field or when the sensor will be subject to magnetic interference for more than a few seconds at a time.
• Constant Weight Magnetometer: This model uses a constant weight for the magnetic field. It is the best choice in an environment where there may be small magnetic field disturbances, and an absolute heading reference is desired. Large disturbances in the magnetic field will cause the heading estimate to slowly drift toward the measured heading.
• Variable Weight Magnetometer: This model attempts to decide how much weight to place on the magnetic field measurement based on how far the measured inclination angle and measured field magnitude are from the values determined during calibration. It is the best choice for an environment similar to where the field calibration was last performed, and where having an absolute heading reference is desired. It is tolerant of occasional long duration large disturbances. However, during large disturbances the orientation may drift slowly, and then be corrected when the magnetic field returns to an undisturbed state.

Which orientation option should I use?

These options largely affect the estimate of the heading. When using the "No Magnetometer" option, the heading will be relative to the initial heading in the recording, instead of relative to magnetic north. Due to the gravity vector, however, orientation relative to the ground plane will still be accurate. Note that even small bias in the gyroscope (which is typical for low power gyros like the ones in our monitors) will often result in a slow drift of the heading estimate.

As far as the advantages and disadvantages of each approach go, it all depends on your application, your environment, and the calibration of your monitors. The variable weight magnetometer is the default option and does its best to find a compromise. Questions you may want to ask are "is is important that I know the absolute heading?", "Do I need to estimate the heading while moving the monitor through a non-uniform magnetic field", and "if the variable weight approach doesn't fit my application and environment, would I rather live with rapidly changing heading estimates that follow a non-uniform magnetic field or live with slow drift through my recording by ignoring the magnetic field".

How do I change the orientation model in my recording?

• Right click on the file in Motion Studio's Data Explorer panel
• Select the "Reprocess Orientation" option
• Select the model you want to use
• You can select multiple recordings and reprocess them at the same time

Note that reprocessing the orientation is not currently an option withing the Mobility Lab interface.

How can I tell if I am in an environment with a uniform magnetic field?

The easiest way to tell is to:

Streaming:

• Start a streaming session
• Select the Opal you wish to check the magnetometer on
• Enable the magnetometer in the real-time plot
• Select the "Magnitude" option to view the magnitude of the combined signal, instead of the individual x/y/z components
• View the magnitude as you move about your typical recording environment while rotating the sensor

Logging:

• Make a recording in your typical environment, making sure to change the orientation of the Opal and to move it through the space that you will be recording in
• Import and convert the data to HDF format
• Plot the data using our software plotting tools (or your own)
• Look at the magnitude of the magnetometer signal

In a uniform magnetic environment, the magnitude of the magnetometer signal should remain fairly constant (within 5uT or so across the whole recording). If you see a significant difference in the magnitude across the recording, then you are either operating in a non-uniform magnetic field or your magnetometer needs to be recalibrated.

Why do my orientation estimates "drift" while my Opals are stationary?

Sometimes you may experience drift in the orientation estimates while your Opal is stationary. It will usually only occur in the heading estimation, since the gravity signal does not provide any information about heading. Because of this, he gyroscope and magnetometer are relied on for estimation of the heading. Small, low power gyroscopes like those in our devices are limited by noise and bias. The magnetometers are also susceptible to noise and bias, but the biggest limitation is variability in the local magnetic field. Bias in a gyroscope is hard to distinguish from a slowly rotating sensor. The magnetic field can provide another source of information to correct this, but only if the magnetometer can be "trusted" do to local disturbances. There are a couple of possible causes for drifting orientation estimates for a stationary Opal:

• When using the No Magnetometer model, bias in the gyroscope can result in slowly rotating orientation estimates
• When using the default Variable Weight Magnetometer model, if the magnetic field is not uniform (e.g., you move the Opal close to a magnetic disturbance), the orientation estimation algorithm will not "trust" the magnetometer as much as normal. The level of distrust depends on the magnitude of the disturbance. This behavior enables an Opal to pass through magnetic disturbances without having the orientation estimates rapidly (and inaccurately) change to follow the magnetic field. If the Opal remains in this new, distorted magnetic field, however, it will slowly begin to trust the magnetometer again. A stationary Opal whose orientation estimates slowly drift can result from this process of increasing the trust in the local magnetic field and slowly rotating to align the Opal to this magnetic field. It should eventually settle on a position and not drift anymore, but this can take a while (depending on the nature of the magnetic field).

When should I recalibrate my magnetometers?

Your magnetometers are calibrated before shipping at our facility. You should consider recalibration especially during the following scenarios:

• If you live at a significantly different latitude than Portland, OR, where we are located
• If your Opal is subjected to a strong magnetic field which may partially magnetize the components inside
• If you have questionable orientation estimates
• If the magnitude of the magnetometer is not relatively constant in a recording environment with a uniform magnetic field

How do I recalibrate the magnetometers?

• Click on Calibration->"Recalibrate Magnetometers" in the menu bar