# class

InertialInitializerInitializer for visual-inertial system.

### Contents

This class has a series of functions that can be used to initialize your system. Right now we have our implementation that assumes that the imu starts from standing still. In the future we plan to add support for structure-from-motion dynamic initialization.

To initialize from standstill:

- Collect all inertial measurements
- See if within the last window there was a jump in acceleration
- If the jump is past our threshold we should init (i.e. we have started moving)
- Use the
*previous*window, which should have been stationary to initialize orientation - Return a roll and pitch aligned with gravity and biases.

## Constructors, destructors, conversion operators

- InertialInitializer(double gravity_mag, double window_length, double imu_excite_threshold)
- Default constructor.

## Public functions

- void feed_imu(const ImuData& message)
- Feed function for inertial data.
- auto initialize_with_imu(double& time0, Eigen::Matrix<double, 4, 1>& q_GtoI0, Eigen::Matrix<double, 3, 1>& b_w0, Eigen::Matrix<double, 3, 1>& v_I0inG, Eigen::Matrix<double, 3, 1>& b_a0, Eigen::Matrix<double, 3, 1>& p_I0inG, bool wait_for_jerk = true) -> bool
- Try to initialize the system using just the imu.

## Protected variables

- Eigen::Matrix<double, 3, 1> _gravity
- Gravity vector.
- double _window_length
- Amount of time we will initialize over (seconds)
- double _imu_excite_threshold
- Variance threshold on our acceleration to be classified as moving.
- std::vector<ImuData> imu_data
- Our history of IMU messages (time, angular, linear)

## Function documentation

###
ov_core::InertialInitializer:: InertialInitializer(double gravity_mag,
double window_length,
double imu_excite_threshold)

Default constructor.

Parameters | |
---|---|

gravity_mag | Global gravity magnitude of the system (normally 9.81) |

window_length | Amount of time we will initialize over (seconds) |

imu_excite_threshold | Variance threshold on our acceleration to be classified as moving |

###
bool ov_core::InertialInitializer:: initialize_with_imu(double& time0,
Eigen::Matrix<double, 4, 1>& q_GtoI0,
Eigen::Matrix<double, 3, 1>& b_w0,
Eigen::Matrix<double, 3, 1>& v_I0inG,
Eigen::Matrix<double, 3, 1>& b_a0,
Eigen::Matrix<double, 3, 1>& p_I0inG,
bool wait_for_jerk = true)

Try to initialize the system using just the imu.

Parameters | |
---|---|

time0 out | Timestamp that the returned state is at |

q_GtoI0 out | Orientation at initialization |

b_w0 out | Gyro bias at initialization |

v_I0inG out | Velocity at initialization |

b_a0 out | Acceleration bias at initialization |

p_I0inG out | Position at initialization |

wait_for_jerk | If true we will wait for a "jerk" |

Returns | True if we have successfully initialized our system |

This will check if we have had a large enough jump in our acceleration. If we have then we will use the period of time before this jump to initialize the state. This assumes that our imu is sitting still and is not moving (so this would fail if we are experiencing constant acceleration).

In the case that we do not wait for a jump (i.e. `wait_for_jerk`

is false), then the system will try to initialize as soon as possible. This is only recommended if you have zero velocity update enabled to handle the stationary cases. To initialize in this case, we need to have the average angular variance be below the set threshold (i.e. we need to be stationary).