Skip to content

Class inertialsim::sensors::Gyro

ClassList > inertialsim > sensors > Gyro

Simulate gyroscope (gyro) sensors. More...

  • #include <gyro.h>

Inherits the following classes: GyroImuComponents, inertialsim::sensors::InertialSensor

Public Functions

Type Name
Gyro (const GyroModel & model, const GyroSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt)
Construct a Gyro from a gyro model and specification.
Gyro (const IMUModel & model, const IMUSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt)
Construct a Gyro from anIMU model and specification.
GyroData Simulate (const geometry::Vector & angular_rate, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate gyro measurements from angular rate.
GyroData Simulate (const geometry::Vector & angular_rate, const geodesy::GlobalPose & global_pose, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate gyro measurements from angular rate and global pose.
GyroData Simulate (const geometry::Rotation & attitude, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate gyro measurements from attitude.
GyroData Simulate (const geodesy::GlobalPose & global_pose, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate gyro measurements from global pose.
virtual const GyroSpecification & specification () override const
Get the gyro specification (covariant override).
~Gyro () override

Public Functions inherited from inertialsim::sensors::InertialSensor

See inertialsim::sensors::InertialSensor

Type Name
InertialSensor (const InertialSensorModel & model, const InertialSensorSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt)
Construct an InertialSensor .
virtual const InertialSensorModel & model () override const
Get the inertial sensor model.
virtual const InertialSensorSpecification & specification () override const
Get the inertial sensor specification.
virtual InertialSensorState & state () override
Get the inertial sensor state.
virtual const InertialSensorState & state () override const
~InertialSensor () override

Public Functions inherited from inertialsim::sensors::Sensor

See inertialsim::sensors::Sensor

Type Name
Sensor (const SensorModel & model, const SensorSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt)
Construct a Sensor .
virtual const SensorModel & model () const
Get the sensor model.
const std::mt19937_64 & rng () const
Get the rng generator.
virtual const SensorSpecification & specification () const
Get the sensor specification.
virtual SensorState & state ()
Get the sensor state.
virtual const SensorState & state () const
virtual ~Sensor () = default

Public Static Functions inherited from inertialsim::sensors::Sensor

See inertialsim::sensors::Sensor

Type Name
Array ApplyQuantization (const Array & signal, const SpecificationArray & quantization)
Apply quantization to a signal.

Protected Static Functions

Type Name
std::optional< Measurement > Preintegrate (const Measurement & angular_rate, int stride)
Pre-integrate angular rates to delta angles (batch mode).

Detailed Description

A gyro is "an inertial sensor that measures angular rotation with respect to inertial space about its input axis(es)." [Standard 03].

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 is used for the resampling.

All inputs are reduced to angular rate (with respect to inertial space) internally and sources of error from the gyro specification are then applied to produce the measurement outputs.

Public Functions Documentation

function Gyro [1/2]

Construct a Gyro from a gyro model and specification.

inertialsim::sensors::Gyro::Gyro (
    const  GyroModel & model,
    const  GyroSpecification & specification,
    std::optional< uint64_t > seed=std::nullopt,
    SimulationMode mode=SimulationMode::BATCH,
    std::optional< double > max_duration=std::nullopt
) 

Gyros 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 a random number generator seed 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:

  • model Options specifying error sources.
  • specification Specification with error parameters.
  • seed Random number generator seed (nullopt for random, 0 for deterministic default).
  • mode Simulation mode: BATCH (default) or REAL_TIME.
  • max_duration Maximum simulation duration in seconds (required for REAL_TIME mode to precompute correlated noise terms).

function Gyro [2/2]

Construct a Gyro from anIMU model and specification.

inertialsim::sensors::Gyro::Gyro (
    const  IMUModel & model,
    const  IMUSpecification & specification,
    std::optional< uint64_t > seed=std::nullopt,
    SimulationMode mode=SimulationMode::BATCH,
    std::optional< double > max_duration=std::nullopt
) 

Extracts the gyro model and specification from the IMU inputs. See the primary constructor for detailed parameter documentation.

Parameters:

  • model IMU model options.
  • specification IMU specification.
  • seed Random number generator seed (nullopt for random).
  • mode Simulation mode: BATCH (default) or REAL_TIME.
  • max_duration Maximum simulation duration in seconds (required for REAL_TIME mode).

function Simulate [1/4]

Simulate gyro measurements from angular rate.

GyroData inertialsim::sensors::Gyro::Simulate (
    const  geometry::Vector & angular_rate,
    const std::optional< Scalar1D > & temperature=std::nullopt
) 

The input must be the angular rate of the gyro relative to an inertial frame as measured in gyro coordinates. When angular rate is used alone, 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.

Sources of error from the gyro specification are applied to produce the measurement output.

The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.

Parameters:

  • angular_rate Angular 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.
  • temperature Optional array of temperatures corresponding to the angular rate inputs (degrees C).

Returns:

GyroData with simulated angular rate measurements.


function Simulate [2/4]

Simulate gyro measurements from angular rate and global pose.

GyroData inertialsim::sensors::Gyro::Simulate (
    const  geometry::Vector & angular_rate,
    const  geodesy::GlobalPose & global_pose,
    const std::optional< Scalar1D > & temperature=std::nullopt
) 

The 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.

If needed, the global_pose input will be interpolated to match the times of the angular_rate input. For this reason, global_pose time stamps must match or span the entire duration of the angular_rate input.

Sources of error from the gyro specification are applied to produce the measurement output.

The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.

Parameters:

  • angular_rate Angular rate experienced by the gyro, measured in gyro coordinates relative to an Earth-fixed navigation frame. Must include time data.
  • global_pose Attitude and position of the gyro relative to Earth. Time stamps must span the angular_rate time range.
  • temperature Optional array of temperatures corresponding to the angular rate inputs (degrees C).

Returns:

GyroData with simulated angular rate measurements.

Exception:

  • std::invalid_argument if global_pose time span does not cover angular_rate time span.

function Simulate [3/4]

Simulate gyro measurements from attitude.

GyroData inertialsim::sensors::Gyro::Simulate (
    const  geometry::Rotation & attitude,
    const std::optional< Scalar1D > & temperature=std::nullopt
) 

The input must be the attitude (orientation) of the gyro relative to an inertial frame. Angular rate is numerically calculated as the first forward difference of the attitude. When attitude is used alone, it is not possible to include the effect of Earth's rotation in the measured output. For this reason, the attitude 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.

At least two attitudes must be supplied. In REAL_TIME mode, overlapping inputs should be supplied, e.g., pairwise attitudes (1-2, 2-3, 3-4, ...).

Sources of error from the gyro specification are applied to produce the measurement output.

The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.

Parameters:

  • attitude Attitude (orientation) of the gyro relative to an inertial frame (or navigation frame if Earth's rotation is not important). Must include time data and at least two attitudes.
  • temperature Optional array of temperatures corresponding to the attitude inputs (degrees C).

Returns:

GyroData with simulated angular rate measurements.

Exception:

  • std::invalid_argument if fewer than two attitudes are provided.

function Simulate [4/4]

Simulate gyro measurements from global pose.

GyroData inertialsim::sensors::Gyro::Simulate (
    const  geodesy::GlobalPose & global_pose,
    const std::optional< Scalar1D > & temperature=std::nullopt
) 

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 gyro specification are applied to produce the measurement output.

The temperature input is optional. If included, it will be used in combination with any temperature dependent specifications when simulating measurement outputs.

Parameters:

  • global_pose Attitude and position of the gyro relative to Earth. Must include time data and at least two poses.
  • temperature Optional array of temperatures corresponding to the pose inputs (degrees C).

Returns:

GyroData with simulated angular rate measurements.

Exception:

  • std::invalid_argument if fewer than two poses are provided.

function specification

Get the gyro specification (covariant override).

inline virtual const  GyroSpecification & inertialsim::sensors::Gyro::specification () override const

Returns:

Gyro specification.

Implements inertialsim::sensors::Sensor::specification


function ~Gyro

inertialsim::sensors::Gyro::~Gyro () override

Protected Static Functions Documentation

function Preintegrate

Pre-integrate angular rates to delta angles (batch mode).

static std::optional< Measurement > inertialsim::sensors::Gyro::Preintegrate (
    const  Measurement & angular_rate,
    int stride
) 

Static method for batch pre-integration.

Parameters:

  • angular_rate Angular rate measurement.
  • stride Integration stride.

Returns:

Delta angle measurement, or nullopt if insufficient samples.



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