# insAccelerometer

Model accelerometer readings for sensor fusion

## Description

The `insAccelerometer` object models accelerometer readings for sensor fusion. Passing an `insAccelerometer` object to an `insEKF` object enables the `insEKF` object to fuse accelerometer data. For details on the accelerometer model, see Algorithms.

## Creation

### Syntax

``sensor = insAccelerometer``

### Description

example

````sensor = insAccelerometer` creates an `insAccelerometer` object. Passing the created `sensor` to an `insEKF` object enables the `insEKF` object to fuse accelerometer data. When fusing data with the `fuse` object function of `insEKF`, pass `sensor` as the second argument to identify the data as obtained from an accelerometer. ```

## Examples

collapse all

Create two `insAccelerometer` objects and pass them to an `insEKF` object.

```sensor1 = insAccelerometer; sensor2 = insAccelerometer; filterOrientation = insEKF(sensor1,sensor2,insMotionOrientation)```
```filterOrientation = insEKF with properties: State: [13x1 double] StateCovariance: [13x13 double] AdditiveProcessNoise: [13x13 double] MotionModel: [1x1 insMotionOrientation] Sensors: {[1x1 insAccelerometer] [1x1 insAccelerometer]} SensorNames: {'Accelerometer' 'Accelerometer_1'} ReferenceFrame: 'NED' ```

Since the `insMotionOrientation` object does not model linear acceleration, the filter does not estimate acceleration.

`stateinfo(filterOrientation)`
```ans = struct with fields: Orientation: [1 2 3 4] AngularVelocity: [5 6 7] Accelerometer_Bias: [8 9 10] Accelerometer_1_Bias: [11 12 13] ```

Create another two `insAccelerometer` objects and pass them to a new `insEKF` object. Since the `insMotionPose` object models linear acceleration, the filter estimates acceleration.

```sensor3 = insAccelerometer; sensor4 = insAccelerometer; filterPose = insEKF(sensor3,sensor4,insMotionPose)```
```filterPose = insEKF with properties: State: [22x1 double] StateCovariance: [22x22 double] AdditiveProcessNoise: [22x22 double] MotionModel: [1x1 insMotionPose] Sensors: {[1x1 insAccelerometer] [1x1 insAccelerometer]} SensorNames: {'Accelerometer' 'Accelerometer_1'} ReferenceFrame: 'NED' ```
`stateinfo(filterPose)`
```ans = struct with fields: Orientation: [1 2 3 4] AngularVelocity: [5 6 7] Position: [8 9 10] Velocity: [11 12 13] Acceleration: [14 15 16] Accelerometer_Bias: [17 18 19] Accelerometer_1_Bias: [20 21 22] ```

Fuse a measurement from `sensor3`.

`fuse(filterPose,sensor3,[1 1 1],eye(3))`
```ans = 22×1 0.9958 0.0649 -0.0649 0 0 0 0 0 0 0 ⋮ ```

## Algorithms

The `insAccelerometer` object models the accelerometer reading as acceleration in the sensor frame. Depending on whether the `insEKF` object estimates linear acceleration in the state equations, the measurement equation takes one of two forms:

• If the `insEKF` object does not estimate the acceleration state, the measurement equation is:

`$h\left(x\right)={g}_{sensor}+\Delta$`

where h(x) is the three-dimensional measurement output, gsensor is the gravitational acceleration expressed in the sensor frame, and Δ is the three-dimensional bias of the sensor, modeled as a constant vector in the sensor frame.

• If the `insEKF` object estimates the acceleration state, the equation is:

`$h\left(x\right)={g}_{sensor}+{a}_{sensor}+\Delta$`

where asensor is the acceleration, excluding the gravity acceleration, expressed in the sensor frame.

Passing an `insAccelerometer` object to an `insEKF` filter object enables the filter object to additionally track the bias of the accelerometer. Internally, the `insEKF` object decides if the acceleration state is estimated by calling its `stateparts` object function.

## Version History

Introduced in R2022a