Skip to content

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.

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
) 

Parameters:

  • model IMU model options.
  • specification IMU specification.
  • gyro_seed Random number generator seed for gyro (0 for random).
  • accelerometer_seed Random number generator seed for accelerometer. If gyro_seed is non-zero and accelerometer_seed is 0, accelerometer_seed defaults to gyro_seed + 1.
  • mode Simulation mode (batch or real-time).
  • max_duration Maximum simulation duration in seconds (required for real-time mode).

function Simulate [⅓]

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
) 

Parameters:

  • angular_rate Angular rate relative to inertial space.
  • specific_force Specific force Vector in sensor frame.
  • temperature Optional temperature array.

Returns:

IMUData with gyro and accelerometer measurements.


function Simulate [⅔]

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 global pose is used to add Earth rate to the angular rate and correct for gravity in the acceleration.

Parameters:

  • angular_rate Angular rate Vector relative to navigation frame.
  • acceleration Acceleration Vector in sensor frame.
  • global_pose GlobalPose for Earth effects compensation.
  • temperature Optional temperature array.

Returns:

IMUData with gyro and accelerometer measurements.


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
) 

Angular rate and specific force are computed from the pose.

Parameters:

  • global_pose GlobalPose with attitude, position, velocity, and time.
  • temperature Optional temperature array.

Returns:

IMUData with gyro and accelerometer measurements.


function accelerometer

Get the accelerometer.

inline const Accelerometer & inertialsim::sensors::IMU::accelerometer () const

Returns:

Reference to internal accelerometer.


function gyro

Get the gyro.

inline const Gyro & inertialsim::sensors::IMU::gyro () const

Returns:

Reference to internal gyro.


function mode

Get the simulation mode.

inline SimulationMode inertialsim::sensors::IMU::mode () const

Returns:

Simulation mode.


function model

Get the IMU model.

inline const IMUModel & inertialsim::sensors::IMU::model () const

Returns:

IMU model.


function specification

Get the IMU specification.

inline const IMUSpecification & inertialsim::sensors::IMU::specification () const

Returns:

IMU specification.


function ~IMU

inertialsim::sensors::IMU::~IMU () = default

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_rate Angular rate measurement.
  • specific_force Specific force measurement.
  • stride Integration stride.

Returns:

Pair of (delta_angle, delta_velocity) or nullopt if insufficient.



The documentation for this class was generated from the following file cpp/include/inertialsim/sensors/imu.h