内容表

上一话题

QMagnetometerFilter

下一话题

QOrientationFilter

QMagnetometerReading

QMagnetometerReading class represents one reading from the magnetometer. 更多

Inheritance diagram of PySide2.QtSensors.QMagnetometerReading

概要

函数

详细描述

QMagnetometerReading Units

The magnetometer returns magnetic flux density values along 3 axes. The scale of the values is teslas. The axes are arranged as follows.

../../_images/sensors-coordinates2.jpg

The magnetometer can report on either raw magnetic flux values or geomagnetic flux values. By default it returns raw magnetic flux values. The returnGeoValues property must be set to return geomagnetic flux values.

The primary difference between raw and geomagnetic values is that extra processing is done to eliminate local magnetic interference from the geomagnetic values so they represent only the effect of the Earth’s magnetic field. This process is not perfect and the accuracy of each reading may change.

The image below shows the difference between geomagnetic (on the left) and raw (on the right) readings for a phone that is being subjected to magnetic interference.

../../_images/sensors-geo-vs-raw-magnetism.jpg

The accuracy of each reading is measured as a number from 0 to 1. A value of 1 is the highest level that the device can support and 0 is the worst.

Calibration

If the device is reporting low accuracy, then calibration might be needed before acceptable measurements can be provided. Basic calibration can usually be done by either rotating your device in a figure of eight, or by rotating the device along each of its three axes. For more information, check your device’s documentation on how to calibrate the magnetic sensor.

class QMagnetometerReading ( parent )
参数

parent QObject

PySide2.QtSensors.QMagnetometerReading. calibrationLevel ( )
返回类型

qreal

PySide2.QtSensors.QMagnetometerReading. setCalibrationLevel ( calibrationLevel )
参数

calibrationLevel qreal

Sets the accuracy of the reading to calibrationLevel .

PySide2.QtSensors.QMagnetometerReading. setX ( x )
参数

x qreal

Sets the raw magnetic flux density on the X axis to x .

另请参阅

x()

PySide2.QtSensors.QMagnetometerReading. setY ( y )
参数

y qreal

Sets the raw magnetic flux density on the Y axis to y .

另请参阅

y()

PySide2.QtSensors.QMagnetometerReading. setZ ( z )
参数

z qreal

Sets the raw magnetic flux density on the Z axis to z .

另请参阅

z()

PySide2.QtSensors.QMagnetometerReading. x ( )
返回类型

qreal

另请参阅

setX()

PySide2.QtSensors.QMagnetometerReading. y ( )
返回类型

qreal

另请参阅

setY()

PySide2.QtSensors.QMagnetometerReading. z ( )
返回类型

qreal

另请参阅

setZ()