LeveledRelativeAttitudeEstimator2

class LeveledRelativeAttitudeEstimator2(val context: Context, location: Location? = null, val sensorDelay: SensorDelay = SensorDelay.GAME, val useAccelerometer: Boolean = true, val startOffsetEnabled: Boolean = true, val accelerometerSensorType: AccelerometerSensorType = AccelerometerSensorType.ACCELEROMETER_UNCALIBRATED, val accelerometerAveragingFilter: AveragingFilter = LowPassAveragingFilter(), val gyroscopeSensorType: GyroscopeSensorType = GyroscopeSensorType.GYROSCOPE_UNCALIBRATED, useAccurateLevelingEstimator: Boolean = false, useAccurateRelativeGyroscopeAttitudeEstimator: Boolean = true, val estimateCoordinateTransformation: Boolean = false, val estimateEulerAngles: Boolean = true, var attitudeAvailableListener: LeveledRelativeAttitudeEstimator2.OnAttitudeAvailableListener? = null, var accuracyChangedListener: LeveledRelativeAttitudeEstimator2.OnAccuracyChangedListener? = null, var bufferFilledListener: LeveledRelativeAttitudeEstimator2.OnBufferFilledListener? = null, adjustGravityNorm: Boolean = true)

Estimates a leveled relative attitude, where only yaw Euler angle is relative to the start instant of this estimator. Roll and pitch Euler angles are leveled using accelerometer or gravity sensors.

Parameters

location

Device location.

useAccurateLevelingEstimator

true to use accurate leveling, false to use a normal one.

useAccurateRelativeGyroscopeAttitudeEstimator

true to use accurate relative attitude, false to use a normal one.

Constructors

Link copied to clipboard
constructor(context: Context, location: Location? = null, sensorDelay: SensorDelay = SensorDelay.GAME, useAccelerometer: Boolean = true, startOffsetEnabled: Boolean = true, accelerometerSensorType: AccelerometerSensorType = AccelerometerSensorType.ACCELEROMETER_UNCALIBRATED, accelerometerAveragingFilter: AveragingFilter = LowPassAveragingFilter(), gyroscopeSensorType: GyroscopeSensorType = GyroscopeSensorType.GYROSCOPE_UNCALIBRATED, useAccurateLevelingEstimator: Boolean = false, useAccurateRelativeGyroscopeAttitudeEstimator: Boolean = true, estimateCoordinateTransformation: Boolean = false, estimateEulerAngles: Boolean = true, attitudeAvailableListener: LeveledRelativeAttitudeEstimator2.OnAttitudeAvailableListener? = null, accuracyChangedListener: LeveledRelativeAttitudeEstimator2.OnAccuracyChangedListener? = null, bufferFilledListener: LeveledRelativeAttitudeEstimator2.OnBufferFilledListener? = null, adjustGravityNorm: Boolean = true)

Types

Link copied to clipboard

Interface to notify when sensor (either accelerometer, gravity or gyroscope) accuracy changes.

Link copied to clipboard

Interface to notify when a new attitude measurement is available.

Link copied to clipboard

Interface to notify when a buffer gets completely filled. When buffers get filled, internal collectors will continue collection at the expense of loosing old data. Consumers of this listener should decide what to do at this point (which might require stopping this estimator).

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

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

Link copied to clipboard
Link copied to clipboard

Indicates whether gravity norm must be adjusted to either Earth standard norm, or norm at provided location. If no location is provided, this should only be enabled when device is close to sea level.

Link copied to clipboard

listener to notify when a new attitude measurement is available.

Link copied to clipboard

listener to notify that some buffer has been filled. This usually happens when consumer of measurements cannot keep up with the rate at which measurements are generated.

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

One of the supported gyroscope sensor types.

Link copied to clipboard

Gets time interval between gyroscope samples expressed in seconds.

Link copied to clipboard

Factor to take into account when interpolation value is computed and useIndirectInterpolation is enabled to determine actual interpolation value based on current relative attitude rotation velocity.

Link copied to clipboard

Interpolation value to be used to combine both leveling and relative attitudes. Must be between 0.0 and 1.0 (both included). The closer to 0.0 this value is, the more resemblance the result will have to a pure leveling (which feels more jerky when using accelerometer). On the contrary, the closer to 1.0 this value is, the more resemblance the result will have to a pure non-leveled relative attitude (which feels softer but might have arbitrary roll and pitch Euler angles).

Link copied to clipboard

Gets or sets device location

Link copied to clipboard

Threshold to determine that leveling has largely diverged and if situation is not reverted soon, attitude will be reset to leveling

Link copied to clipboard

Threshold to determine that current leveling appears to be an outlier respect to estimated fused attitude. When leveling and fused attitudes diverge, fusion is not performed, and instead only gyroscope relative attitude is used for fusion estimation.

Link copied to clipboard

Threshold to determine when fused attitude has largely diverged for a given number of samples and must be reset.

Link copied to clipboard

Indicates whether this estimator is running or not.

Link copied to clipboard

Delay of sensors between samples.

Link copied to clipboard

indicates whether start offsets will be computed when first measurement is received or not. True indicates that offset is computed, false assumes that offset is null.

Link copied to clipboard

true to use accelerometer sensor, false to use system gravity sensor for leveling purposes.

Link copied to clipboard

Indicates whether accurate leveling must be used or not.

Indicates whether accurate non-leveled relative attitude estimator must be used or not.

Link copied to clipboard

Indicates whether fusion between leveling and relative attitudes occurs based on changing interpolation value that depends on actual relative attitude rotation velocity.

Functions

Link copied to clipboard
fun start(startTimestamp: Long = SystemClock.elapsedRealtimeNanos()): Boolean

Starts this estimator.

Link copied to clipboard
fun stop()

Stops this estimator.