AccelerometerNormEstimator

class AccelerometerNormEstimator(context: Context, val sensorType: AccelerometerSensorType = AccelerometerSensorType.ACCELEROMETER_UNCALIBRATED, sensorDelay: SensorDelay = SensorDelay.FASTEST, maxSamples: Int = DEFAULT_MAX_SAMPLES, maxDurationMillis: Long = DEFAULT_MAX_DURATION_MILLIS, stopMode: StopMode = StopMode.MAX_SAMPLES_OR_DURATION, completedListener: AccumulatedMeasurementEstimator.OnEstimationCompletedListener<AccelerometerNormEstimator>? = null, unreliableListener: AccumulatedMeasurementEstimator.OnUnreliableListener<AccelerometerNormEstimator>? = null, var measurementListener: AccelerometerSensorCollector.OnMeasurementListener? = null) : AccumulatedMeasurementEstimator<AccelerometerNormEstimator, AccumulatedAccelerationMeasurementNoiseEstimator, AccelerometerSensorCollector, AccelerationUnit, Acceleration>

Estimates accelerometer norm. This estimator takes a given number of measurements during a given duration of time to estimate accelerometer norm average, standard deviation and variance, as well as average time interval between measurements. For best accuracy of estimated results, device should remain static while data is being collected. In such case, average accelerometer norm should match gravity norm at current location.

Parameters

context

Android context

sensorDelay

Delay of sensor between samples.

maxSamples

Maximum number of samples to take into account before completion. This is only taken into account if using either StopMode.MAX_SAMPLES_ONLY or StopMode.MAX_SAMPLES_OR_DURATION.

maxDurationMillis

Maximum duration expressed in milliseconds to take into account before completion. This is only taken into account if using either StopMode.MAX_DURATION_ONLY or StopMode.MAX_SAMPLES_OR_DURATION.

stopMode

Determines when this estimator will consider its estimation completed.

completedListener

Listener to notify when estimation is complete.

unreliableListener

Listener to notify when sensor becomes unreliable, and thus, estimation must be discarded.

measurementListener

Listener to notify collected sensor measurements.

Throws

when either maxSamples or maxDurationMillis is negative.

Constructors

Link copied to clipboard
constructor(context: Context, sensorType: AccelerometerSensorType = AccelerometerSensorType.ACCELEROMETER_UNCALIBRATED, sensorDelay: SensorDelay = SensorDelay.FASTEST, maxSamples: Int = DEFAULT_MAX_SAMPLES, maxDurationMillis: Long = DEFAULT_MAX_DURATION_MILLIS, stopMode: StopMode = StopMode.MAX_SAMPLES_OR_DURATION, completedListener: AccumulatedMeasurementEstimator.OnEstimationCompletedListener<AccelerometerNormEstimator>? = null, unreliableListener: AccumulatedMeasurementEstimator.OnUnreliableListener<AccelerometerNormEstimator>? = null, measurementListener: AccelerometerSensorCollector.OnMeasurementListener? = null)

Properties

Link copied to clipboard

Gets estimated average of measurement norm expressed in measurement unit (m/s^2 for acceleration, rad/s for angular speed or T for magnetic flux density). This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard
val averageNormAsMeasurement: Acceleration?

Gets estimated average measurement norm as a measurement. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets average time interval between measurements expressed in seconds (s). This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets average time interval between measurements. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard
Link copied to clipboard

Android context.

Link copied to clipboard
val elapsedTime: Time

Gets amount of elapsed time to compute sensor noise, either if computation succeeds or not.

Link copied to clipboard

Gets amount of elapsed time to compute sensor noise estimation expressed in nanoseconds (ns), either if computation succeeds or not.

Link copied to clipboard

Gets maximum duration expressed in milliseconds to take into account before completion. This is only taken into account if using either StopMode.MAX_DURATION_ONLY or StopMode.MAX_SAMPLES_OR_DURATION.

Link copied to clipboard

Gets maximum number of samples to take into account before completion. This is only taken into account if using either StopMode.MAX_SAMPLES_ONLY or StopMode.MAX_SAMPLES_OR_DURATION.

Link copied to clipboard

Gets estimated standard deviation of norm expressed in the default unit of measurement (m/s^2 for acceleration, rad/s for angular speed or T for magnetic flux density). This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets estimated standard deviation of norm as a measurement. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets estimated variance of measurement norm expressed in the default squared unit of measurement (m^2/s^4 for acceleration, rad^2/s^2 for angular speed or T^2 for magnetic flux density). This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Number of measurements that have been processed.

Link copied to clipboard
val psd: Double?

Gets PSD (Power Spectral Density) of norm noise expressed in (m^2 * s^-3) for accelerometer, (rad^2/s) for gyroscope or (T^2 * s) for magnetometer. This is only available when estimation completes successfully and average time interval between measurements is reliably estimated.

Link copied to clipboard

Indicates whether estimated average and time interval between measurements are available or not.

Link copied to clipboard

Indicates whether estimated result is unreliable or not.

Link copied to clipboard

Gets root PSD (Power Spectral Density) of norm expressed in (m * s^-1.5) for accelerometer, (rad * s^-0.5) for gyroscope or (T * s^0.5) for magnetometer. This is only available when estimation completes successfully and average time interval between measurements is reliably estimated.

Link copied to clipboard

Indicates whether this estimator is already running.

Link copied to clipboard

Gets sensor being used to obtain measurements or null if not available. This can be used to obtain additional information about the sensor.

Link copied to clipboard

Delay of sensor between samples.

Link copied to clipboard

One of the supported accelerometer sensor types.

Link copied to clipboard

Determines when this estimator will consider its estimation completed.

Link copied to clipboard

Gets estimated standard deviation of time interval between measurements expressed in seconds (s). This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets estimated standard deviation of time interval between measurements. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets estimated variance of time interval between measurements expressed in squared seconds (s^2). This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Listener to notify when sensor becomes unreliable, and thus, estimation must be discarded.

Functions

Link copied to clipboard
fun getAverageNormAsMeasurement(result: Acceleration): Boolean

Gets estimated average measurement norm as a measurement instance. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets average time interval between measurements. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard
fun getElapsedTime(result: Time)

Gets amount of time elapsed, either if computation succeeds or not.

Link copied to clipboard

Gets estimated standard deviation of norm as a measurement. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard

Gets estimated standard deviation of time interval between measurements. This is only available when estimation completes successfully and resultAvailable is true.

Link copied to clipboard
fun start()

Starts collection of sensor norm measurements.

Link copied to clipboard
fun stop()

Stops collection of sensor norm measurements.