Skip to content

Class inertialsim::sensors::Accelerometer

ClassList > inertialsim > sensors > Accelerometer

Simulate accelerometer sensors. More...

  • #include <accelerometer.h>

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

Public Functions

Type Name
Accelerometer (const AccelerometerModel & model, const AccelerometerSpecification & specification, std::optional< uint64_t > seed=std::nullopt, SimulationMode mode=SimulationMode::BATCH, std::optional< double > max_duration=std::nullopt)
Construct an Accelerometer from a model and specification.
Accelerometer (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 an Accelerometer from anIMU model and specification.
AccelerometerData Simulate (const geometry::Vector & specific_force, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate accelerometer measurements from specific force.
AccelerometerData Simulate (const geometry::Vector & acceleration, const geodesy::GlobalPose & global_pose, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate accelerometer measurements from acceleration and pose.
AccelerometerData Simulate (const geodesy::GlobalPose & global_pose, const std::optional< Scalar1D > & temperature=std::nullopt)
Simulate accelerometer measurements from global pose.
virtual const AccelerometerSpecification & specification () override const
Get the accelerometer specification (covariant override).
~Accelerometer () 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.

Detailed Description

An accelerometer is "an inertial sensor that measures the component of translational acceleration minus the component of gravitational acceleration along 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 specific force is used for the resampling.

All inputs are reduced to specific force internally and sources of error from the accelerometer specification are then applied to produce the measurement outputs.

Public Functions Documentation

function Accelerometer [1/2]

Construct an Accelerometer from a model and specification.

inertialsim::sensors::Accelerometer::Accelerometer (
    const  AccelerometerModel & model,
    const  AccelerometerSpecification & specification,
    std::optional< uint64_t > seed=std::nullopt,
    SimulationMode mode=SimulationMode::BATCH,
    std::optional< double > max_duration=std::nullopt
) 

Accelerometers 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 Accelerometer [2/2]

Construct an Accelerometer from anIMU model and specification.

inertialsim::sensors::Accelerometer::Accelerometer (
    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 accelerometer 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/3]

Simulate accelerometer measurements from specific force.

AccelerometerData inertialsim::sensors::Accelerometer::Simulate (
    const  geometry::Vector & specific_force,
    const std::optional< Scalar1D > & temperature=std::nullopt
) 

The input must be the specific force (non-gravitational acceleration) acting on the accelerometer as measured in accelerometer coordinates. This option can be used if no information is known about the attitude and position of the accelerometer relative to Earth (global pose) but it implies that the input must already account for the effect of gravity.

Sources of error from the accelerometer 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:

  • specific_force Specific force experienced by the accelerometer, measured in accelerometer coordinates. Must include time data.
  • temperature Optional array of temperatures corresponding to the specific force inputs (degrees C).

Returns:

AccelerometerData with simulated specific force measurements.


function Simulate [2/3]

Simulate accelerometer measurements from acceleration and pose.

AccelerometerData inertialsim::sensors::Accelerometer::Simulate (
    const  geometry::Vector & acceleration,
    const  geodesy::GlobalPose & global_pose,
    const std::optional< Scalar1D > & temperature=std::nullopt
) 

The 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 acceleration input. For this reason, global_pose time stamps must match or span the entire duration of the acceleration input.

Sources of error from the accelerometer 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:

  • acceleration Total acceleration experienced by the accelerometer, measured in accelerometer coordinates. Must include time data.
  • global_pose Attitude and position of the accelerometer relative to Earth. Time stamps must span the acceleration time range.
  • temperature Optional array of temperatures corresponding to the acceleration inputs (degrees C).

Returns:

AccelerometerData with simulated specific force measurements.

Exception:

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

function Simulate [3/3]

Simulate accelerometer measurements from global pose.

AccelerometerData inertialsim::sensors::Accelerometer::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.

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 accelerometer 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, position, and velocity of the accelerometer 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:

AccelerometerData with simulated specific force measurements.

Exception:

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

function specification

Get the accelerometer specification (covariant override).

inline virtual const  AccelerometerSpecification & inertialsim::sensors::Accelerometer::specification () override const

Returns:

Accelerometer specification.

Implements inertialsim::sensors::Sensor::specification


function ~Accelerometer

inertialsim::sensors::Accelerometer::~Accelerometer () override


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