KalmanAbsoluteAttitudeProcessor5

class KalmanAbsoluteAttitudeProcessor5(location: Location? = null, var currentDate: Date? = null, var computeExternalAcceleration: Boolean = true, var computeEulerAngles: Boolean = true, var computeCovariances: Boolean = true, var computeEulerAnglesCovariance: Boolean = true, phiMatrixMethod: PhiMatrixMethod = PhiMatrixMethod.APPROXIMATED, processNoiseCovarianceMethod: ProcessNoiseCovarianceMethod = ProcessNoiseCovarianceMethod.BETTER, quaternionStepIntegrator: QuaternionStepIntegratorType = QuaternionStepIntegratorType.SUH, val gyroscopeNoisePsd: Double = DEFAULT_GYROSCOPE_NOISE_PSD, val accelerometerNoiseStandardDeviation: Double = DEFAULT_ACCELEROMETER_NOISE_STANDARD_DEVIATION, val magnetometerNoiseStandardDeviation: Double = DEFAULT_MAGNETOMETER_NOISE_STANDARD_DEVIATION, externalAccelerationCovarianceMatrixEstimationMethod: ExternalAccelerationCovarianceMatrixEstimationMethod = DEFAULT_EXTERNAL_ACCELERATION_COVARIANCE_MATRIX_ESTIMATION_METHOD, val processorListener: KalmanAbsoluteAttitudeProcessor5.OnProcessedListener? = null)

Estimates absolute attitude using a Kalman filter. This is based on: https://github.com/liviobisogni/quaternion-kalman-filter And: Young Soo Suh. Orientation estimation using a quaternion-based indirect Kalman filter with adaptive estimation of external acceleration.

Parameters

location

current device location or null if location is not known. When location and currentDate are provided, magnetic field dip and declination angles are estimated along with current gravity norm.

phiMatrixMethod

method to compute the matrix exponential to integrate orientation.

processNoiseCovarianceMethod

method to compute process noise covariance matrix.

quaternionStepIntegrator

type of integrator to use to compute quaternions.

Constructors

Link copied to clipboard
constructor(location: Location? = null, currentDate: Date? = null, computeExternalAcceleration: Boolean = true, computeEulerAngles: Boolean = true, computeCovariances: Boolean = true, computeEulerAnglesCovariance: Boolean = true, phiMatrixMethod: PhiMatrixMethod = PhiMatrixMethod.APPROXIMATED, processNoiseCovarianceMethod: ProcessNoiseCovarianceMethod = ProcessNoiseCovarianceMethod.BETTER, quaternionStepIntegrator: QuaternionStepIntegratorType = QuaternionStepIntegratorType.SUH, gyroscopeNoisePsd: Double = DEFAULT_GYROSCOPE_NOISE_PSD, accelerometerNoiseStandardDeviation: Double = DEFAULT_ACCELEROMETER_NOISE_STANDARD_DEVIATION, magnetometerNoiseStandardDeviation: Double = DEFAULT_MAGNETOMETER_NOISE_STANDARD_DEVIATION, externalAccelerationCovarianceMatrixEstimationMethod: ExternalAccelerationCovarianceMatrixEstimationMethod = DEFAULT_EXTERNAL_ACCELERATION_COVARIANCE_MATRIX_ESTIMATION_METHOD, processorListener: KalmanAbsoluteAttitudeProcessor5.OnProcessedListener? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
fun interface OnProcessedListener

Interface to notify when a new attitude has been processed.

Properties

Link copied to clipboard

accelerometer noise standard deviation expressed in meters per squared second (m/s^2).

Link copied to clipboard
val ba: Matrix

Estimated accelerometer bias.

Link copied to clipboard
val bg: Matrix

Estimated gyroscope bias.

Link copied to clipboard
val bodyAttitude: Quaternion

Estimated device attitude expressed in body coordinates.

Link copied to clipboard
val bodyExternalAcceleration: AccelerationTriad?

Estimated external acceleration applied on the device expressed in NED coordinates respect to device body.

Link copied to clipboard

true to compute covariances, false otherwise.

Link copied to clipboard

true to compute Euler angles of estimated attitude, false otherwise.

Link copied to clipboard

true to compute Euler angles covariance, false otherwise.

Link copied to clipboard

true to compute external acceleration, false otherwise.

Link copied to clipboard

current date. This is used to estimate magnetic field dip and declination angles and provided location. If null, current date is assumed.

Link copied to clipboard
val ecefAttitude: Quaternion

Estimated device attitude expressed in ECEF coordinates respect to Earth.

Link copied to clipboard
val ecefExternalAcceleration: AccelerationTriad?

Estimated external acceleration applied on the device expressed in ECEF coordinates respect to Earth.

Link copied to clipboard

Euler angles associated to estimated NED attitude. Array contains roll, pitch and yaw angles expressed in radians (rad) and following order indicated here. This is only available if computeCovariances and computeEulerAngles are true.

Link copied to clipboard

Error covariance of estimated Euler angles for NED attitude. This is only available if computeCovariances and computeEulerAnglesCovariance are true.

Link copied to clipboard

Gets expected gravity norm at current location. If no location is available, average gravity at sea level is returned instead.

Link copied to clipboard

gyroscope noise PSD (Power Spectral Density) expressed in (rad^2/s)/Hz.

Link copied to clipboard

Gets or sets current device location. When location and currentDate are provided, magnetic field dip and declination angles are estimated along with current gravity norm.

Link copied to clipboard

Obtains magnetic field declination of local NED reference system expressed in radians if World Magnetic Model is used, otherwise zero is returned. Magnetic field declination indicates how much deviation the heading angle has between the magnetic north pole and the true geographic north pole.

Link copied to clipboard

Returns magnetic field dip angle of local NED reference system expressed in radians if World Magnetic Model is used, otherwise zero is returned. Magnetic field dip angle indicates how much the magnetic field points towards Earth's center. At magnetic equator dip angle is zero, at Norm magnetic pole is +90º, and at South magnetic pole is -90º. At the north hemisphere dip angle is positive (magnetic field points downwards), indicating the vertical deviation of magnetic field respect local Earth surface at a given position (latitude, longitude and height). At the south hemisphere dip angle is negative (magnetic field points upwards), indicating the vertical deviation of magnetic field respect local Earth surface at a given position (latitude, longitude and height).

Link copied to clipboard
var magneticFluxDensity: MagneticFluxDensityTriad

Returns magnetic flux density at current location expressed in local NED reference system. This is only available if World Magnetic Model is used, otherwise a zero triad is returned.

Link copied to clipboard

magnetometer noise standard deviation expressed in Teslas (T).

Link copied to clipboard
val nedAttitude: Quaternion

Estimated device attitude expressed in leveled local NED coordinates respect to Earth.

Link copied to clipboard

Error covariance of estimated quaternion attitude expressed in NED coordinates. This is only available if computeCovariances is true.

Link copied to clipboard
val nedExternalAcceleration: AccelerationTriad?

Estimated external acceleration applied on the device expressed in leveled local NED coordinates respect to Earth.

Link copied to clipboard

listener to handle events raised by this processor.

Link copied to clipboard
val qba: Matrix

Covariance noise matrix of the accelerometer bias

Link copied to clipboard
val qbg: Matrix

Covariance noise matrix of the gyroscope bias

Link copied to clipboard

Time interval between measurements expressed in seconds (s).

Link copied to clipboard

Indicates whether world magnetic model is taken into account magnetic field dip and declination angles, so that orientation pointing to the true north is estimated.

Link copied to clipboard
var worldMagneticModel: WorldMagneticModel?

Earth's magnetic model. If null, the default model is used if useWorldMagneticModel is true. If useWorldMagneticModel is false, this is ignored.

Functions

Link copied to clipboard
fun getAttitudeCovariance(result: Matrix): Boolean

Gets error covariance of estimated quaternion attitude expressed in NED coordinates. This is only available if computeCovariances is true.

Link copied to clipboard
fun getBodyExternalAcceleration(result: AccelerationTriad): Boolean

Gets estimated external acceleration applied on the device expressed in NED coordinates respect to device body.

Link copied to clipboard
fun getEcefExternalAcceleration(result: AccelerationTriad): Boolean

Gets estimated external acceleration applied on the device end expressed in ECEF coordinates respect to Earth.

Link copied to clipboard

Gets Euler angles associated to estimated NED attitude. Array contains roll, pitch and yaw angles expressed in radians (rad) and following order indicated here. This is only available if computeCovariances and computeEulerAngles are true.

Link copied to clipboard
fun getEulerAnglesCovariance(result: Matrix): Boolean

Gets error covariance of estimated Euler angles for NED attitude. This is only available if computeCovariances and computeEulerAnglesCovariance are true.

Link copied to clipboard
fun getNedExternalAcceleration(result: AccelerationTriad): Boolean

Gets estimated external acceleration applied on the device and expressed in leveled local NED coordinates respect to Earth.

Link copied to clipboard
Link copied to clipboard

Processes provided synced accelerometer, gyroscope and magnetometer measurement to obtain a relative leveled attitude.

fun process(accelerometerMeasurement: AccelerometerSensorMeasurement, gyroscopeMeasurement: GyroscopeSensorMeasurement, magnetometerMeasurement: MagnetometerSensorMeasurement, timestamp: Long = gyroscopeMeasurement.timestamp): Boolean

Processes provided accelerometer, gyroscope and magnetometer measurements at provided timestamp to obtain a relative leveled attitude.

Link copied to clipboard
fun reset()

Resets internal parameter.