How is the orientation of an Opal estimated?

Orientation Estimation

We use a state space model with a causal 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 in our Opals and typical operational environments for these Opals.

The Complexities of Heading Estimation

In general, the pitch of the sensor relative to the ground plane is relatively easy to estimate due to the strong and constant effect of gravity on the tri-axial accelerometer. Centripetal and other accelerations can mask this signal, but the "ground truth" gravity signal is always there. The heading of the Opal in the plane that is perpendicular to the floor is more difficult, however. The gyroscope can be integrated to estimate rotation relative to starting point, but any noise or bias in the sensor (which is present in any real-word gyroscope) quickly accumulates as a source of significant error.  Fortunately, the earth's magnetic field can provide a "ground truth" signal to help constrain this error. In most recording environments, however, the magnetic field is far from constant due to the presence of metallic objects which may disturb the Earth's magnetic field or generate their own. The Kalman filter approach to orientation estimation can help mitigate this complexity, by dynamically adjusting how much the magnetic field should be used in the orientation estimates. As the detected non-uniformity of the magnetic field increases, the dependence on the magnetometer for heading estimation decreases. At the extreme, the gyroscope alone is used for estimating the heading. When this is true, the accumulated error from integrating the gyroscope noise can result in poor estimates. It may even appear that a stationary sensor is slowly rotating.

What is the format of the orientation estimates?

Our orientation estimates are provided using the quaternion format. You can find more information here. The first component of our quaternion representation is the scalar part, and the last three components are the x-y-z complex part.

What part of the recording is used for orientation estimates?

The results of orientation estimation using the Kalman Filter are dependent on starting conditions. This can result in different estimates for identical sections of a recording. Consider the following  cases:

  • Streaming. Once a streaming session has initiated and data is coming through (time point A), but before you have clicked on the record button to start saving the data to disk (time point B), orientation estimation begins. It may take several seconds for the orientation estimates to stabilize.
  • Re-estimating Orientation. This process, described below, enables you to re-estimate the orientation of an existing recording using different models. A streamed recording will not include the information from time point A to time point B (from the example above) in the saved recording, however. The Kalman Filter will therefore be initialized differently, and you may get different results. This is especially true at the beginning of the recording as the filter's estimates are stabilizing.
  • Logged recordings. Orientation estimation will be applied to whatever section of the recording is extracted. If, for example, you extract the recording starting from time point A (example above), you should get similar, if not identical, results of the orientation estimation between your streamed and logged recording. If instead you extract data starting from time point B (when the record button is pushed on a streamed recording), you may get different results than the original streamed recording.

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. Note that modifying the orientation model is only an option 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 there is no magnetic north to use as a reference.

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 the possibility of rapidly changing heading estimates that follow a non-uniform magnetic field or live with the possibility of 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 within Mobility Lab or Moveo Explorer (only in Motion Studio).

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 -- even if you are using fixed or variable weight orientation model. It will usually only occur in the heading estimation, since the gravity signal does not provide any information about heading. Because of this, the 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 their 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 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 can I tell that my magnetometer is out of calibration?

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 hold the sensor away from other objects (in case they are magnetized) and rotate the sensor in place

Logging:

  • Make a recording in your typical environment, making sure to hold the sensor away from other objects (in case they are magnetized) and rotate the sensor in place
  • 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

Since you are holding the sensor in a single location, the magnetic field should be constant and the magnitude of the magnetometer recording should also be (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 (you are moving the sensor in space, and not just rotating it) or your magnetometer needs to be recalibrated.

How do I recalibrate the magnetometers?

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

Magnetometer calibration can be a little tricky, so we have an example video linked to here.

 

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    Peter Xu

    Is this material related to Opal v2 only or both v1 and v2? Thanks.

  • 0
    Avatar
    Lars Holmstrom

    Peter - this article covers both our v1 and v2 sensors.

Article is closed for comments.