LevelingEstimator

Estimates leveling of device (roll and pitch angle) by estimating gravity vector using accelerometer measurements only. This estimator does not estimate attitude yaw angle, as either a magnetometer or gyroscope would be needed. When device is placed vertically (pitch values close to 90 degrees), this estimator might become unreliable. If device is expected to be in this orientation, avoid using this estimator and use AccurateLevelingEstimator instead.

Constructors

Link copied to clipboard
constructor(context: Context, sensorDelay: SensorDelay = SensorDelay.GAME, useAccelerometer: Boolean = true, accelerometerSensorType: AccelerometerSensorType = AccelerometerSensorType.ACCELEROMETER_UNCALIBRATED, accelerometerAveragingFilter: AveragingFilter = LowPassAveragingFilter(), estimateCoordinateTransformation: Boolean = false, estimateEulerAngles: Boolean = true, levelingAvailableListener: LevelingEstimator.OnLevelingAvailableListener? = null, gravityEstimationListener: GravityEstimator.OnEstimationListener? = null, accelerometerMeasurementListener: AccelerometerSensorCollector.OnMeasurementListener? = null, gravityMeasurementListener: GravitySensorCollector.OnMeasurementListener? = null)

Constructor.

Types

Link copied to clipboard

Properties

Link copied to clipboard

an averaging filter for accelerometer samples to obtain sensed gravity component of specific force. (Only used if useAccelerometer is true).

Link copied to clipboard

Listener to notify new accelerometer measurements. (Only used if useAccelerometer is true).

Link copied to clipboard

One of the supported accelerometer sensor types. (Only used if useAccelerometer is true).

Link copied to clipboard

Android context.

Link copied to clipboard

true to estimate coordinate transformation, false otherwise. If not needed, it can be disabled to improve performance and decrease cpu load.

Link copied to clipboard

true to estimate euler angles, false otherwise. If not needed, it can be disabled to improve performance and decrease cpu load.

Link copied to clipboard

listener to notify when a new gravity estimation is available.

Link copied to clipboard
protected open lateinit override var gravityEstimator: GravityEstimator

Internal gravity estimator sensed as a component of specific force.

Link copied to clipboard

listener to notify new gravity measurements. (Only used if useAccelerometer is false).

Link copied to clipboard

listener to notify when a new leveling measurement is available.

Link copied to clipboard

Indicates whether this estimator is running or not.

Link copied to clipboard

Delay of accelerometer or gravity sensor between samples.

Link copied to clipboard

true to use accelerometer sensor, false to use system gravity sensor.

Functions

Link copied to clipboard
fun start(): Boolean

Starts this estimator.

Link copied to clipboard
fun stop()

Stops this estimator.