GravityAndGyroscopeSensorMeasurementSyncer

class GravityAndGyroscopeSensorMeasurementSyncer(context: Context, val gyroscopeSensorType: GyroscopeSensorType = GyroscopeSensorType.GYROSCOPE_UNCALIBRATED, val gravitySensorDelay: SensorDelay = SensorDelay.FASTEST, val gyroscopeSensorDelay: SensorDelay = SensorDelay.FASTEST, val gravityCapacity: Int = DEFAULT_GRAVITY_CAPACITY, val gyroscopeCapacity: Int = DEFAULT_GYROSCOPE_CAPACITY, val gravityStartOffsetEnabled: Boolean = false, val gyroscopeStartOffsetEnabled: Boolean = false, stopWhenFilledBuffer: Boolean = true, staleOffsetNanos: Long = DEFAULT_STALE_OFFSET_NANOS, staleDetectionEnabled: Boolean = true, skipWhenProcessing: Boolean = true, accuracyChangedListener: SensorMeasurementSyncer.OnAccuracyChangedListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, bufferFilledListener: SensorMeasurementSyncer.OnBufferFilledListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, syncedMeasurementListener: SensorMeasurementSyncer.OnSyncedMeasurementsListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, staleDetectedMeasurementsListener: SensorMeasurementSyncer.OnStaleDetectedMeasurementsListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, val gravityInterpolator: GravitySensorMeasurementInterpolator = GravityQuadraticSensorMeasurementInterpolator(), val gyroscopeInterpolator: GyroscopeSensorMeasurementInterpolator = GyroscopeQuadraticSensorMeasurementInterpolator()) : SensorMeasurementSyncer<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>

Syncs gravity and gyroscope sensor measurements in case they arrive with certain delay.

Typically when synchronization is needed is for correct pose estimation, for attitude estimation, not synced sensor measurements can also be used to achieve a reasonable estimation.

Constructors

constructor(context: Context, gyroscopeSensorType: GyroscopeSensorType = GyroscopeSensorType.GYROSCOPE_UNCALIBRATED, gravitySensorDelay: SensorDelay = SensorDelay.FASTEST, gyroscopeSensorDelay: SensorDelay = SensorDelay.FASTEST, gravityCapacity: Int = DEFAULT_GRAVITY_CAPACITY, gyroscopeCapacity: Int = DEFAULT_GYROSCOPE_CAPACITY, gravityStartOffsetEnabled: Boolean = false, gyroscopeStartOffsetEnabled: Boolean = false, stopWhenFilledBuffer: Boolean = true, staleOffsetNanos: Long = DEFAULT_STALE_OFFSET_NANOS, staleDetectionEnabled: Boolean = true, skipWhenProcessing: Boolean = true, accuracyChangedListener: SensorMeasurementSyncer.OnAccuracyChangedListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, bufferFilledListener: SensorMeasurementSyncer.OnBufferFilledListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, syncedMeasurementListener: SensorMeasurementSyncer.OnSyncedMeasurementsListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, staleDetectedMeasurementsListener: SensorMeasurementSyncer.OnStaleDetectedMeasurementsListener<GravityAndGyroscopeSyncedSensorMeasurement, GravityAndGyroscopeSensorMeasurementSyncer>? = null, gravityInterpolator: GravitySensorMeasurementInterpolator = GravityQuadraticSensorMeasurementInterpolator(), gyroscopeInterpolator: GyroscopeSensorMeasurementInterpolator = GyroscopeQuadraticSensorMeasurementInterpolator())

Types

Link copied to clipboard
object Companion

Properties

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

capacity of gravity buffer.

Link copied to clipboard

Gets gravity collector current usage as a value between 0.0 and 1.0. 0.0 indicates that collector buffer is empty and no measurement has yet been received. 1.0 indicates that collector buffer is full.

Link copied to clipboard

interpolator for gravity measurements.

Link copied to clipboard

Gets gravity 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

Indicates whether requested gravity sensor is available or not.

Link copied to clipboard

Delay of gravity sensor between samples.

Link copied to clipboard

Gets initial gravity offset expressed in nano seconds between first received measurement timestamp and start time expressed in the monotonically increasing system clock obtained by SystemClock.elapsedRealtimeNanos.

Link copied to clipboard

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

Link copied to clipboard

Gets gravity buffer current usage as a value between 0.0 and 1.0. 0.0 indicates that buffer is empty and no measurement has yet been received. 1.0 indicates that buffer is full.

Link copied to clipboard

capacity of gyroscope buffer.

Link copied to clipboard

Gets gyroscope collector current usage as a value between 0.0 and 1.0. 0.0 indicates that collector buffer is empty and no measurement has yet been received. 1.0 indicates that collector buffer is full.

Link copied to clipboard

interpolator for gyroscope measurements.

Link copied to clipboard

Gets gyroscope 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

Indicates whether requested gyroscope sensor is available or not.

Link copied to clipboard

Delay of gyroscope sensor between samples.

Link copied to clipboard

One of the supported gyroscope sensor types.

Link copied to clipboard

Gets initial gyroscope offset expressed in nano seconds between first received measurement timestamp and start time expressed in the monotonically increasing system clock obtained by SystemClock.elapsedRealtimeNanos.

Link copied to clipboard

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

Link copied to clipboard

Gets gyroscope buffer current usage as a value between 0.0 and 1.0. 0.0 indicates that buffer is empty and no measurement has yet been received. 1.0 indicates that buffer is full.

Link copied to clipboard

Gets most recent timestamp of all measurements processed so far. Timestamp is expressed in nanoseconds by a monotonic clock based on SystemClock.elapsedRealtimeNanos.

Link copied to clipboard

Gets number of processed measurements since this syncer started.

Link copied to clipboard

Gets oldest timestamp in the buffer.

Link copied to clipboard

Indicates whether syncer is processing measurements.

Link copied to clipboard

Indicates whether syncer is running and processing measurements.

Link copied to clipboard

true to skip new measurements while processing a measurement.

Link copied to clipboard

listener to notify when stale measurements are found. This might indicate that buffers are too small and data is not being properly synced.

Link copied to clipboard

true to enable stale measurement detection, false otherwise.

Link copied to clipboard

offset respect most recent received timestamp of a measurement to consider the measurement as stale so that it is skipped from synced measurement processing and returned back from buffer to cache of measurements.

Link copied to clipboard

Timestamp when collector started expressed as a monotonically increasing timestamp in nanoseconds as indicated by SystemClock.elapsedRealtimeNanos.

Link copied to clipboard

true to stop syncer when any buffer completely fills, false to continue processing measurements at the expense of loosing old data. This will be notified using bufferFilledListener.

Functions

Link copied to clipboard
open override fun start(startTimestamp: Long): Boolean

Starts collecting and syncing sensor measurements.

Link copied to clipboard
open override fun stop()

Stops processing and syncing sensor measurements.