Skip to content

Sensor models

Control over sensor behaviors is provided by both sensor specifications and the sensor model. Gyros and accelerometers share common enough operating principles that the same model can be applied to both. GyroModel and AccelerometerModel are aliases for InertialSensorModel.

Magnetometers have a very similar model with fewer noise parameters, MagnetometerModel.

Inertial navigation systems (INS) are sensors but unlike gyros, accelerometers, IMUs, or magnetometers they do not directly measure physical phenomena. Instead they use IMU data and software algorithms to calculate attitude (orientation), position, and velocity. INSModel, has similar syntax but is otherwise distinct from the other sensor types.

Set both model and specification options

For an effect to be seen in a simulated sensor measurement, both the corresponding model options and specifications must be set. If the specification value is left unset, it defaults to zero (or identity). The behavior will be simulated but it will have no effect.

Model equation

A common model equation is used for accelerometers, gyros, magnetometers and, by extension, IMUs. This is consistent with the model found in Standard [05] and Standard [06] (Sections 8.3).

\[ O = Q\left(\frac{L(\mathbf{M}\mathbf{I}) + B + N}{1+\epsilon}\right) \]

Where the terms have the following meanings:

  • \(O\) is the measured output along a single sensing axis.
  • \(Q\) is quantization due to digitization.
  • \(L\) clamps the input between minimum and maximum sensing limits.
  • \(\mathbf{M}\) is a matrix of misalignment terms that relate output axes to the case reference axes.
  • \(\mathbf{I}\) is the true 3-axis orthogonal inertial input.
  • \(B\) are measurement biases.
  • \(N\) are measurement noise sources.
  • \(\epsilon\) is scale factor error.

When specifying a sensor, care should be taken to reference this equation. It is also important to ensure that other tools use consistent definitions. For example, scale factor is a divisor here but may equivalently be specified as a multiplier with the inverse value.

Default model options

Errors are applied as per Standard [05], Section 8.3. Misalignment causes the true motion of the device to be sensed along misaligned sensing axes. Input limits, biases, and noise, represent the effects of physical and digital processes superimposed on the true input. Scaling errors and digital quantization then affect the final output.

The default model options are shown below:

from inertialsim.sensors import InertialSensorModel
from inertialsim.sensors.magnetometer import MagnetometerModel

#
# Inertial sensor model options
#
model = InertialSensorModel()
# Default data interface options
model.data_interface.simulate_sample_rate = True
model.data_interface.simulate_quantization = True
model.data_interface.simulate_delta_outputs = False
# Default axis misalignment options
model.misalignment.simulate_random = True
# Default input limits options
model.input_limits.simulate_minimum = True
model.input_limits.simulate_maximum = True
# Default bias options
model.bias.simulate_fixed = True
model.bias.simulate_random = True
model.bias.simulate_temperature = True
# Default random noise options
model.noise.simulate_quantization = True
model.noise.simulate_random_walk = True
model.noise.simulate_bias_instability = True
model.noise.simulate_rate_random_walk = True
model.noise.simulate_rate_ramp = True
# Default scale factor options
model.scale_factor.simulate_fixed = True
model.scale_factor.simulate_random = True

#
# Magnetometer model options
#
model = MagnetometerModel()
# Default data interface options
model.data_interface.simulate_sample_rate = True
model.data_interface.simulate_quantization = True
# Default axis misalignment options
model.misalignment.simulate_random = True
# Default input limits options
model.input_limits.simulate_minimum = True
model.input_limits.simulate_maximum = True
# Default bias options
model.bias.simulate_fixed = True
model.bias.simulate_random = True
model.bias.simulate_temperature = True
# Default random noise options
model.noise.simulate_wgn = True
# Default scale factor options
model.scale_factor.simulate_fixed = True
model.scale_factor.simulate_random = True

IMU Model

The IMUModel is a composite that includes both a GyroModel and an AccelerometerModel with a single data interface section. This allows for separate options to apply to gyro and accelerometer sensors in the IMU.

from inertialsim.sensors.imu import IMUModel

#
# IMU model options
#
model = IMUModel()
# Default data interface options
model.data_interface.simulate_sample_rate = True
model.data_interface.simulate_quantization = True
model.data_interface.simulate_delta_outputs = False
# Gyro defaults are same as InertialSensorModel()
model.gyro = ...
# Accelerometer defaults are same as InertialSensorModel()
model.accelerometer = ...

INS Model

The INSModel supports the simulation of errors in initial conditions, gravity, and timing. INS outputs also exhibit the effect of any errors present in the IMU inputs. If those inputs are simulated using InertialSim, those errors are controlled via the models described above. If the IMU inputs come from third party tools or real data, the errors (and their exact effect on the INS output) may be unknown.

INS Model equation

Denote the attitude (orientation), position, and velocity of the sensor at time \(t_{k}\) by \(\mathbf{P}_{k}(\boldsymbol{\phi}, \mathbf{p}, \mathbf{v})\). This is a tuple of vectors or matrices, \(\boldsymbol{\phi}\) for attitude, \(\mathbf{p}\) for position, and \(\mathbf{v}\) for velocity. It is sometimes referred to as extended pose (pose + velocity) and can be thought of as a member of the \(SE_{2}(3)\) Lie group when the global or navigation frame is a Cartesian coordinate system.

Inertial sensors take an initial condition \(\mathbf{P}_{0}\), IMU data, a gravity model, and an Earth rotation model and numerically calculate the current pose through frame transforms and numerical integration.

\[ \mathbf{P}_{k} = \mathbf{P}_{0} \int_{t_{0}}^{t_{k}} f(\boldsymbol{\omega}_{0:k}, \mathbf{a}_{0:k}, \mathbf{g}(\mathbf{p}), \boldsymbol{\omega}_{e}) \]

where:

  • \(\boldsymbol{\omega}\) is angular rate data as measured by gyros.
  • \(\mathbf{a}\) is specific force (non-gravitational acceleration) data as measured by accelerometers.
  • \(\mathbf{g}(\mathbf{p})\) is gravity model, which is typically a function of changing position, \(\mathbf{p}\).
  • \(\boldsymbol{\omega}_{e}\) models Earth's rotation relative to inertial space.

Errors in INS output, \(\mathbf{P}_{k}\), are therefore functions of errors in all these inputs and of numerical integration error. Typically IMU sensor errors dominate but in certain applications, the other sources of error may be more significant.

INS model options

In addition to specifying sources of error to simulate, the INS model also specifies the format of attitude (orientation) data to output from the INS and the numerical integration technique to use in solving the model equation.

Three formats for attitude (orientation) data are supported: Euler angles, quaternion, and rotation matrix. See the Rotation class for details on the geometric conventions of those representations.

Three numerical integrators are supported: Euler's method, the trapezoidal method, and the Runge-Kutta 4th order (RK4) method. The Euler method typically exhibits significant numerical error, the RK4 method can approach floating point precision in most applications, and the trapezoidal method is a middle ground.

The default INS model options are shown below.

from inertialsim.sensors.ins import INSModel

# Shorter enum aliases
AttitudeFormat = INSModel.DataInterface.AttitudeFormat
Integrator = INSModel.NumericalMethods.Integrator

#
# INS model options
#
model = INSModel()
# Default data interface options.
model.data_interface.attitude_format = AttitudeFormat.EULER_ANGLE
model.data_interface.simulate_sample_rate = True
# Numerical integration options
model.numerical_methods.integrator = Integrator.EULER
model.numerical_methods.simulate_time_jitter = True
# Default initial condition error options. Each option applies to attitude,
# position, and velocity initial conditions.
model.initial_conditions.simulate_bias = True
model.initial_conditions.simulate_random_error = True
# Default gravity model options.
model.gravity.simulate_noise = True
model.gravity.simulate_scale_factor = True