QMagnetometerReading Class
QMagnetometerReading 类表示磁强计的一个读数。更多
头文件: | #include <QMagnetometerReading> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Sensors) target_link_libraries(mytarget PRIVATE Qt6::Sensors) |
qmake: | QT += sensors |
继承: | QSensorReading |
属性
- calibrationLevel : const qreal
- x : const qreal
- y : const qreal
- z : const qreal
公共功能
qreal | calibrationLevel() const |
void | setCalibrationLevel(qreal calibrationLevel) |
void | setX(qreal x) |
void | setY(qreal y) |
void | setZ(qreal z) |
qreal | x() const |
qreal | y() const |
qreal | z() const |
详细说明
QMagnetometerReading 单位
磁力计沿 3 个轴返回磁通密度值。数值的刻度为特斯拉。轴线排列如下。
磁力计可报告原始磁通量值或地磁通量值。默认情况下,它会返回原始磁通量值。要返回地磁通值,必须设置QMagnetometer::returnGeoValues 属性。
原始磁通值和地磁值的主要区别在于,地磁值需要经过额外处理以消除局部磁场干扰,因此它们只代表地球磁场的影响。这一过程并不完美,每个读数的准确性都可能发生变化。
下图显示了受到磁场干扰的手机的地磁读数(左侧)和原始读数(右侧)之间的差异。
每个读数的准确度用 0 到 1 的数字来衡量。1 表示设备可支持的最高水平,0 表示最差水平。
校准
如果设备报告的准确度较低,则可能需要进行校准,然后才能提供可接受的测量结果。基本校准通常可以通过旋转设备的八字形或沿设备的三个轴分别旋转来完成。如需更多信息,请查阅设备有关如何校准磁传感器的文档。
属性文档
[read-only]
calibrationLevel : const qreal
该属性表示读数的精确度。
测量值从 0 到 1,数值越大越好。
请注意,只有在测量地磁通密度时才会发生变化。原始磁通量读数的值始终为 1。
访问功能:
qreal | calibrationLevel() const |
另请参阅 QMagnetometerReading Units 和Calibration 。
[read-only]
x : const qreal
该属性保存 X 轴上的原始磁通密度。
测量单位为特斯拉。
访问函数:
qreal | x() const |
另请参见 QMagnetometerReading Units 。
[read-only]
y : const qreal
该属性保存 Y 轴上的原始磁通密度。
测量单位为特斯拉。
访问函数:
qreal | y() const |
另请参见 QMagnetometerReading Units 。
[read-only]
z : const qreal
该属性保存 Z 轴上的原始磁通密度。
测量单位为特斯拉。
访问函数:
qreal | z() const |
另请参见 QMagnetometerReading Units 。
成员函数文档
void QMagnetometerReading::setCalibrationLevel(qreal calibrationLevel)
将读数精度设置为calibrationLevel 。
另请参阅 calibrationLevel() 。
void QMagnetometerReading::setX(qreal x)
将 X 轴上的原始磁通密度设置为x 。
另请参阅 x() 。
void QMagnetometerReading::setY(qreal y)
将 Y 轴上的原始磁通密度设置为y 。
另请参阅 y() 。
void QMagnetometerReading::setZ(qreal z)
将 Z 轴上的原始磁通密度设置为z 。
另请参阅 z() 。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.