Class inertialsim::sensors::IMU¶
ClassList > inertialsim > sensors > IMU
Simulate an Inertial Measurement Unit (IMU ).More...
#include <imu.h>
Public Functions¶
| Type | Name |
|---|---|
| IMU (const IMUModel & model, const IMUSpecification & specification, std::optional< uint64_t > gyro_seed=std::nullopt, std::optional< uint64_t > accelerometer_seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt) Construct an IMU from a model and specification. |
|
| IMUData | Simulate (const geometry::Vector & angular_rate, const geometry::Vector & specific_force, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate IMU measurements from angular rate and specific force. |
| IMUData | Simulate (const geometry::Vector & angular_rate, const geometry::Vector & acceleration, const geodesy::GlobalPose & global_pose, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate IMU measurements from angular rate, acceleration, and global pose. |
| IMUData | Simulate (const geodesy::GlobalPose & global_pose, const std::optional< Scalar1D > & temperature=std::nullopt) Simulate IMU measurements from global pose. |
| const Accelerometer & | accelerometer () const Get the accelerometer. |
| const Gyro & | gyro () const Get the gyro. |
| SimulationMode | mode () const Get the simulation mode. |
| const IMUModel & | model () const Get the IMU model. |
| const IMUSpecification & | specification () const Get the IMU specification. |
| ~IMU () = default |
Protected Static Functions¶
| Type | Name |
|---|---|
| std::pair< std::optional< Measurement >, std::optional< Measurement > > | Preintegrate (const Measurement & angular_rate, const Measurement & specific_force, int stride) Pre-integrate measurements to delta angle and velocity. |
Detailed Description¶
An IMU combines a gyro and an accelerometer to measure angular rate and specific force. This class provides a unified interface for simulating both sensors with a common data interface.
Measurement output sample rates will match the input sample rate. In batch mode (default), if the simulate_sample_rate model option is true, the output sample rates will match the sample rates in the sensor specification. Linear interpolation of angular rate and specific force is used for the resampling.
All inputs are reduced to specific force and angular rate internally and sources of error from the IMU specification are then applied to produce the measurement outputs.
Public Functions Documentation¶
function IMU¶
Construct an IMU from a model and specification.
inertialsim::sensors::IMU::IMU (
const IMUModel & model,
const IMUSpecification & specification,
std::optional< uint64_t > gyro_seed=std::nullopt,
std::optional< uint64_t > accelerometer_seed=std::nullopt,
SimulationMode mode=SimulationMode::BATCH,
std::optional< double > max_duration=std::nullopt
)
IMUs require a model which specifies which sources of error to simulate; a specification which includes the parameters necessary to model deterministic and random errors; and optionally random number generator seeds to control determinism and repeatability of the simulation.
Two modes are supported: BATCH (default) and REAL_TIME. In BATCH mode, the Simulate() method should be called once with all inputs to return all simulated measurement outputs. In REAL_TIME mode, the Simulate() method can be called repeatedly to incrementally simulate measurements. In REAL_TIME mode, a max_duration input (specified in seconds) should supply an upper bound on the expected simulation duration. If the expected duration is unknown it is safe and efficient to specify a value up to several hours.
Parameters:
modelOptions specifying error sources.specificationSpecification with error parameters.gyro_seedRandom number generator seed for gyro (nullopt for random, 0 for deterministic default).accelerometer_seedRandom number generator seed for accelerometer (nullopt for random). If gyro_seed is specified and accelerometer_seed is nullopt, defaults to gyro_seed + 1.modeSimulation mode: BATCH (default) or REAL_TIME.max_durationMaximum simulation duration in seconds (required for REAL_TIME mode to precompute correlated noise terms).
function Simulate [1/3]¶
Simulate IMU measurements from angular rate and specific force.
IMUData inertialsim::sensors::IMU::Simulate (
const geometry::Vector & angular_rate,
const geometry::Vector & specific_force,
const std::optional< Scalar1D > & temperature=std::nullopt
)
The angular rate input must be the angular rate of the gyro relative to an inertial frame as measured in gyro coordinates. With these inputs, it is not possible to include the effect of Earth's rotation in the measured output. For this reason, the angular rate can also be relative to a fixed navigation frame (also known as world, or global frame) if Earth's rotation is not important for the application.
The specific force input must be the specific force (non-gravitational acceleration) acting on the accelerometer as measured in accelerometer coordinates. The input must already account for the effect of gravity.
Sources of error from the IMU specification are applied to produce the measurement outputs. Inputs must have matching time data.
The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.
Parameters:
angular_rateAngular rate experienced by the gyro, measured in gyro coordinates relative to an inertial frame (or navigation frame if Earth's rotation is not important). Must include time data.specific_forceSpecific force experienced by the accelerometer, measured in accelerometer coordinates. Must include time data.temperatureOptional array of temperatures corresponding to the inputs (degrees C).
Returns:
IMUData with gyro and accelerometer measurements.
function Simulate [2/3]¶
Simulate IMU measurements from angular rate, acceleration, and global pose.
IMUData inertialsim::sensors::IMU::Simulate (
const geometry::Vector & angular_rate,
const geometry::Vector & acceleration,
const geodesy::GlobalPose & global_pose,
const std::optional< Scalar1D > & temperature=std::nullopt
)
The angular rate input must be the angular rate of the gyro relative to an Earth-fixed navigation frame (also known as world, or global frame) as measured in gyro coordinates. The effect of Earth's rotation will be added to the input based on the global_pose data to produce angular rate relative to inertial space.
The acceleration input must be the total acceleration (including gravity) acting on the accelerometer as measured in accelerometer coordinates. The effect of Earth's gravity (not measured by the accelerometer) will be compensated based on the global_pose data to produce specific force.
If needed, the global_pose input will be interpolated to match the times of the angular_rate and acceleration inputs. For this reason, global_pose time stamps must match or span the entire duration of the other inputs.
Sources of error from the IMU specification are applied to produce the measurement outputs.
The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.
Parameters:
angular_rateAngular rate experienced by the gyro, measured in gyro coordinates relative to an Earth-fixed navigation frame. Must include time data.accelerationTotal acceleration experienced by the accelerometer, measured in accelerometer coordinates. Must include time data.global_poseAttitude and position of the IMU relative to Earth. Time stamps must span the input time ranges.temperatureOptional array of temperatures corresponding to the inputs (degrees C).
Returns:
IMUData with gyro and accelerometer measurements.
Exception:
std::invalid_argumentif global_pose time span does not cover input time spans.
function Simulate [3/3]¶
Simulate IMU measurements from global pose.
IMUData inertialsim::sensors::IMU::Simulate (
const geodesy::GlobalPose & global_pose,
const std::optional< Scalar1D > & temperature=std::nullopt
)
Acceleration is numerically calculated as the first forward difference of the global velocity (if available) or the second forward difference of the global position. The effect of Earth's gravity (not measured by the accelerometer) will be compensated to produce specific force.
Angular rate is numerically calculated as the first forward difference of the global attitude. The effect of Earth's rotation will be compensated to produce angular rate relative to inertial space.
At least two poses must be supplied. In REAL_TIME mode, overlapping inputs should be supplied, e.g., pairwise poses (1-2, 2-3, 3-4, ...).
Sources of error from the IMU specification are applied to produce the measurement outputs.
The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.
Parameters:
global_poseAttitude, position, and velocity of the IMU relative to Earth. Must include time data and at least two poses.temperatureOptional array of temperatures corresponding to the pose inputs (degrees C).
Returns:
IMUData with gyro and accelerometer measurements.
Exception:
std::invalid_argumentif fewer than two poses are provided.
function accelerometer¶
Get the accelerometer.
Returns:
Reference to internal accelerometer.
function gyro¶
Get the gyro.
Returns:
Reference to internal gyro.
function mode¶
Get the simulation mode.
Returns:
Simulation mode.
function model¶
Get the IMU model.
Returns:
IMU model.
function specification¶
Get the IMU specification.
Returns:
IMU specification.
function ~IMU¶
Protected Static Functions Documentation¶
function Preintegrate¶
Pre-integrate measurements to delta angle and velocity.
static std::pair< std::optional< Measurement >, std::optional< Measurement > > inertialsim::sensors::IMU::Preintegrate (
const Measurement & angular_rate,
const Measurement & specific_force,
int stride
)
Static method for batch pre-integration.
Parameters:
angular_rateAngular rate measurement.specific_forceSpecific force measurement.strideIntegration stride.
Returns:
Pair containing:
- Delta angle (nullopt if insufficient data to compute)
- Delta velocity (nullopt if insufficient data to compute)
The documentation for this class was generated from the following file cpp/include/inertialsim/sensors/imu.h