Refs: 1
Refs: 1
In attitude estimation, two prevalent approaches are utilized:
-
Instantaneous estimation: This method is most effective when the system is quasi-static state, and hence, it is often referred to as Static Attitude Determination.
-
Recursive estimation: Incorporates the system's dynamics to understand and forecast the system's behavior. By factoring in the system kinematics, this approach is known as Dynamic Attitude Determination. Dynamic estimators mainly use angular motions to compute the attitude. These displacements are normally measured by gyroscopes
Refs: 1
Accelerometer sensors measure the difference between any linear acceleration in the accelerometer’s reference frame and can be used to determine the accelerometer pitch and roll orientation angles.
the accelerometer will give us
and we are looking for
that relate gravity to out measurement to extract roll and pitch.
Since the gravity express as it means that the
Z
axis of world coordinate frame is up, East, North, Up (ENU), used in geography (z is up and x is in the direction of move, y is pointing left)
▲ z
| ▲
| / x
| /
y | /
◀---------|/
We have six different rotation matrix depending on the order of rotation around axis:
and in 4 of them we will have to determine
,
For instance in
However in the following rotation matrix, we have to determine only
or
The lack of any dependence on the yaw rotation angle is easy to understand physically
since the first rotation is in yaw
around the smartphone z-axis which is initially aligned with the
gravitational field and pointing downwards. All accelerometers are completely insensitive to rotations
about the gravitational field vector and cannot be used to determine such a rotation.
It is conventional therefore to select either the rotation sequence or
Refs: 1
A quaternion is updated via integration of angular rate measurements of a gyroscope.
matrix exponential:
Euler's formula:
proof of Euler's formula using Taylor series:
if we write it for around point zero (a=0):
Letting be the rotation vector, representing a rotation of
radians around the unitary axis
we can get its exponential series as:
This exponential map is formerly defined as:
The order of rotations is important and must always be specified when referring to specific orientation angles.
Refs: 1
The IMU (local sensor) frame is labeled as , and the global (Earth) frame as
. The measured acceleration,
, and the true Earth gravitational acceleration,
, are defined as unit vectors:
The gyroscopes measure the angular velocity (are not normalized unlike the other sensors), and are usually expressed in radians per second.
:
relats the global frame
to the local frame
through the inverse orientation which rotates the measured quantities
into the reference quantities
:
The alignment of the gravity vector from global frame into local frame can be achieved by infinite rotations with definite roll and pitch angles and arbitrary yaw. To restrict the solutions to a finite number
is chosen.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
An orientation is described by at a time
t . This is after a rotation change
during
seconds is performed on the local frame
Accelerometer gives estimate in non accelerating conditions (they have problem when they are in acceleration motion) and Gyroscope gives estimate of short period of times (bias drift)
Refs: 1
Allan variance plot (also known as the two-sample variance plot or the Hadamard variance plot) is a graphical tool used in signal processing to analyze the stability of a signal over time
The Allan deviation measures the fluctuations of a signal between two time intervals, and the integration time is the length of the time interval over which the fluctuations are averaged. By analyzing the slope of the plot, one can determine the dominant sources of noise in the signal and estimate the noise power spectral density.
In general, a flat line on an Allan variance plot indicates white noise, while a slope of -1/2 indicates flicker noise, and a slope of -1 indicates random walk noise. These noise types are commonly found in electronic systems, such as oscillators and clocks, and the Allan variance plot can help engineers optimize the design of these systems for their intended applications.
Gyro noise Allan variance is calculated by measuring the difference in rotation or angular velocity measurements taken at different times, and then averaging those differences over different time intervals. The result is a plot of the Allan deviation versus the averaging time,
The Allan deviation is defined as the square root of the variance of the difference between two rotation or angular velocity measurements taken at time intervals τ
apart, divided by the mean value of the measurements. It is often expressed in units of degrees per hour or radians per second.
The Allan variance is defined as:
Refs: 1
Refs: 1
Refs: 1
The IMU measurement model used in Kalibr contains two types of sensor errors: , an additive noise term that fluctuates very rapidly ("white noise"), and
, a slowly varying sensor bias. The angular rate measurement
(for one single axis of the gyro, in this case) is therefore written as:
The same model is independently used to model all three sensor axes. The same model (with different parameters, as we will later see) is also used to model the accelerometer measurement errors (on each axis independently). This model is tractable and often used to model inertial sensors.
The rapid fluctuations in the sensor signal are modelled heuristically with a zero-mean, independent, continuous-time white Gaussian noise process of strength
:
In other words, the higher is, the more "noisy" your gyro measurements. The parameters
gyroscope_noise_density
and accelerometer_noise_density
in the YAML file specify exactly these noise strengths (gyro) and
(accel) for the continuous-time model.
This process can be simulated in discrete-time as follows:
with
where is the sampling time. This is identical to the discrete-time implementation within Kalibr.
Note: This assumes that the noise was filtered with an ideal low-pass filter that filters noise above
(in other words, an ideal decimation stage). This may or may not be the case, depending on your sensor settings. If you simply "subsample" your gyro or accel, you are not allowed to scale your "white noise density" in that way.
How you can determine this parameter for your particular IMU is explained below.
IMU biases are systematic errors that can be caused by various factors like temperature changes, manufacturing imperfections, or aging.
In Kalibr, slow variations in the sensor bias are modelled with a "Brownian motion" process, also termed a "Wiener process", or "random walk" in discrete-time. Formally, this process is generated by integrating "white noise" of strength (gyro) or
(accel):
represents the rate of change of the gyroscope bias with respect to time
. Here:
denotes the derivative of the bias
at time
.
is the standard deviation of the gyroscope bias noise.
is a white noise process at time
.
This equation models the gyroscope bias as a stochastic process, where the rate of change of the bias is driven by a white noise process scaled by a standard deviation parameter .
where is "white noise" of unit strength.
The parameters gyroscope_random_walk
and accelerometer_random_walk
in the YAML file specify these noise strengths and
. The higher the bias variations in your gyro or accel are, the higher these parameters need to be set.
This process can be simulated in discrete-time as follows:
with
This corresponds to the implementation in Kalibr.
The formula following the mentioned line models the bias of an IMU sensor as a random walk process, by integrating a white noise. In this formula:
represents the bias at time
.
is the bias at the previous time step
.
denotes white noise at time
.
is the white noise strength, determining the rate at which the bias changes over time.
This model suggests that the bias at each time step is the sum of the bias at the previous time step and a white noise term, which is scaled by the white noise strength .
In Kalibr, the sensor errors are modelled for each sensor axis independently. Unless you are using inertial sensors whose axes have very different noise properties, this is legitimate. Internally, Kalibr will therefore model the "white" noise processes as follows:
The bias variations ("random walks") are also modelled independently on each sensor axis. Table 1 summarizes all the parameters, and links them to the entries that you can specify in the YAML file.
Table 1: Summary of the IMU noise model parameters as they can be specified in the IMU configuration YAML file of Kalibr. A discussion of these units can be found in this thread for those interested.
This section describes how you can obtain the Kalibr IMU noise model parameters for your particular IMU. While there are many methods available, we focus on how to get the parameters from the datasheet or using the "Allan standard deviation".
White Noise Terms: The parameters for the "white noise" processes (,
) are often specified in the datasheet of the sensor manufacturer. A bit misleading, they are commonly denoted as angular random walk in case of the gyro, and velocity random walk for the accel. The name comes from the fact that if this white noise on rate or acceleration is integrated (in the navigation equations), it becomes a "random walk" on the angle or the velocity.
Other manufacturers specify it directly as rate noise density, acceleration noise density, or simply noise density. The name comes from the fact that corresponds to the power spectral density of
. Using the discrete-time implementation outlined above, you can check if you interpreted the values in the datasheet correctly.
Bias Terms: In contrast to the "white noise sigmas", and
are rarely directly specified in the datasheet. The reason is that in practice, the bias does not truly behave like a "random walk" for longer integration times. Often, the so-called in-run bias (in)stability is specified instead. This sensor parameter indicates (approximately) the accuracy with which the bias can be determined (if a random process is the sum of "white noise" and a "random walk" bias, the bias cannot be estimated with arbitrarily low uncertainty at any point in time). In combination with the strength of the "white noise", however, one can often use the in-run bias stability (the lowest point in the Allan standard deviation, see below) to determine reasonable values for
and
(assuming that the noise is dominated by "white noise" and a "random walk").
While many (parametric and non-parametric) methods have been proposed to (automatically) determine the noise model parameters from samples, deriving the parameters from an Allan standard deviation plot is probably the most common and standardized procedure. It derives the AD for different random processes, including "white noise" (slope -1/2 in a log-log AD plot) and "random walk" (slope +1/2 in a log-log AD plot) that are used in Kalibr. The noise model parameters can be determined directly from the Allan standard deviation.
and
correspond to the values at (AD(\tau=1s)) (point (1) in the figure below). This is only true since the noise power in most inertial sensors is dominated by "white noise" at a frequency of approximately 1Hz.
and
are identified as the value of the (fitted) "random walk" diagonal at an integration time of (AD(\tau=3s)) (point (2) in the figure below). This can be seen immediately when the Allan standard deviation is derived for a "random walk" process.
Figure 1: Allan standard deviation of a MEMS gyro with manually identified noise processes.
Some manufacturers provide an Allan standard deviation plot in the datasheet of the device. Otherwise, it needs to be computed from sensor data. A useful open source tool for computing IMU parameters using Allan Deviation is ori-drs/allan_variance_ros which seems to be actively maintained. We recommend using this tool directly on ~15-24 hour dataset recording of the IMU being stationary.
It is important to note that the IMU measurement error model used here is derived from a sensor which does not undergo motion, and at constant temperature. Hence scale factor errors and bias variation caused by temperature changes, for example, are not accounted for. So clearly, the model is optimistic. Particularly when using low-cost MEMS IMUs with Kalibr, you may have to increase the noise model parameters to "capture" these errors as well. In other words, if you use directly the "sigmas" obtained from static sensor data, Kalibr will tend to trust your IMU measurements too much, and its solution will not be optimal.
From our experience, for lowest-cost sensors, increasing the noise model parameters by a factor of 10x or more may be necessary. If you use Kalibr with such a device, please give us feedback, such that we can develop specific guidelines, device-specific parameter suggestions, or more advanced methods to determine these parameters.
where is the Dirac delta function and
is the variance of the noise process.
The expression represents the autocorrelation function of the additive white noise process. Here's a breakdown of why relates to the standard deviation:
-
White noise by definition has a constant power spectrum across all frequencies. In the time domain, this is reflected in its autocorrelation function: the noise values at different times are uncorrelated.
-
The expectation
quantifies how two noise values at times
and
are related. If the noise is white (i.e., purely random and uncorrelated), then the only non-zero expectation value is when
.
-
The Dirac delta function
is a function that's zero everywhere except at
, where it's "infinitely high" such that its integral over all time is 1. This ensures that the expectation is only non-zero when the two times are the same.
-
The factor
in front of the Dirac delta function is the variance of the noise process. The standard deviation of the noise is
, so
is the variance. The reason the variance appears here is that the autocorrelation function at zero time-lag (i.e.,
) represents the variance of the noise.
So, while as a whole represents the autocorrelation function, the term
in the expression is indeed the variance of the noise process, and its square root would be the standard deviation.
A discrete-time simulation of additive white noise in an Inertial Measurement Unit (IMU). Here's the breakdown of the equation and the terms involved:
Here:
represents the discrete-time white noise at a specific time index (k).
is a standard normal random variable with a mean of (0) and a variance of (1), denoted as
.
is the discrete-time noise standard deviation, calculated as
, where
is the continuous-time noise standard deviation, and
is the sampling interval.
The subscript ( g ) typically stands for "gyroscope" when discussing noise characteristics in the context of Inertial Measurement Units (IMUs). IMUs consist of a combination of sensors including accelerometers, gyroscopes, and sometimes magnetometers. Each of these sensors has its own noise characteristics. In the equations discussed, represents the standard deviation of the continuous-time white noise process associated with the gyroscope measurements. Similarly,
represents the standard deviation of the discrete-time white noise process for the gyroscope. This notation helps differentiate the noise characteristics of the gyroscope from those of other sensors within the IMU.
Now, let's dive deeper into the components and related concepts:
-
Discrete-Time White Noise: In discrete time, a white noise process is characterized by a sequence of uncorrelated random variables with zero mean and constant variance. This is in contrast to continuous-time white noise, which has issues due to the peculiarities of the continuum. The discrete-time white noise process is denoted by
in the equation and follows a standard normal distribution
.
-
IMU Noise Simulation: IMUs are prone to various types of noise, including white noise. The simulation of IMU noise, especially in discrete time, helps in understanding and mitigating the effects of noise on sensor readings. This is crucial for applications like navigation and tracking, where precise sensor readings are vital.
-
Noise Standard Deviation: The term
in the equation represents the standard deviation of the discrete-time noise process. It's computed from the continuous-time noise standard deviation
and the sampling interval
, as
. This conversion is essential for simulating the continuous-time noise process in a discrete-time setting, aligning with the sampling rate of the IMU.
The standard deviation of the discrete-time noise process is derived from the continuous-time noise standard deviation by accounting for the sampling interval. This conversion is essential for simulating the continuous-time noise process in a discrete-time setting.
The formula to compute the standard deviation of the discrete-time noise process () from the continuous-time noise standard deviation (
) is given by:
where:
is the standard deviation of the discrete-time noise process.
is the continuous-time noise standard deviation.
is the sampling interval (time between successive samples).
Suppose we have a continuous-time noise standard deviation of rad/s, and our IMU is sampling at a rate of 100 Hz, which means the sampling interval is
seconds. We can use the formula to compute the standard deviation of the discrete-time noise process:
import math
# Given values
sigma_g = 0.2 # continuous-time noise standard deviation (rad/s)
sampling_rate = 100 # Hz
delta_t = 1 / sampling_rate # sampling interval (s)
# Computing the standard deviation of the discrete-time noise process
sigma_g_d = sigma_g / math.sqrt(delta_t)
print(f'The standard deviation of the discrete-time noise process is {sigma_g_d} rad/s')
The standard deviation of the discrete-time noise process is 2.0 rad/s
In this code:
- We first import the
math
module to use thesqrt
function. - We then define the given values: the continuous-time noise standard deviation
sigma_g
, the sampling rate, and the sampling intervaldelta_t
. - Finally, we compute the standard deviation of the discrete-time noise process
sigma_g_d
using the formula and print the result.
The standard deviation of continuous-time noise for an IMU, denoted as for the gyroscope and possibly
for the accelerometer, is typically obtained through one of the following ways:
-
Manufacturer Specifications:
- IMU manufacturers often provide noise characteristics in their datasheets. This includes the standard deviation or other statistical measures of sensor noise.
-
Experimental Measurement:
- Collect raw data from the IMU in a controlled environment, and compute the standard deviation of the noise.
- One common method is the Allan Variance analysis, which helps determine various noise characteristics including the standard deviation of the white noise.
-
Noise Analysis:
- By analyzing the sensor output data and comparing it against known references or ground truth, you can compute or estimate the standard deviation of the noise.
Suppose you collect a set of gyroscope data over a period, with the IMU kept stationary to minimize motion-induced readings:
import numpy as np
# Assume gyro_data is a numpy array containing your gyroscope readings
gyro_data = np.array([...]) # replace with your data
# Compute the standard deviation
sigma_g = np.std(gyro_data)
print(f'Standard deviation of continuous-time noise: {sigma_g}')
In this code snippet:
- We assume
gyro_data
is a numpy array containing your gyroscope readings. - We use
np.std
to compute the standard deviation of these readings, which gives an estimate of.
- The accuracy of
obtained through experimental measurement depends on the quality and duration of data collection, as well as the conditions under which the data is collected.
- If possible, it's always a good practice to cross-verify the obtained
with manufacturer specifications or other reputable sources.