简体   繁体   English

如何使用MPU 9150传感器从实际加速日期获取重力值

[英]How to get gravity values from real acceleration date using MPU 9150 sensor

Please kindly help me to learn 请帮助我学习

I can get acceleration values using below code 我可以使用以下代码获取加速度值

    #ifdef OUTPUT_READABLE_REALACCEL
    //display real acceleration, adjusted to remove gravity
    mpu.dmpGetQuaternion(&q, fifoBuffer);
    mpu.dmpGetAccel(&aa, fifoBuffer);
    mpu.dmpGetGravity(&gravity, &q);
    mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
    Serial.print("areal\t");
    Serial.print(aaReal.x);
    Serial.print("\t");
    Serial.print(aaReal.y);
    Serial.print("\t");
    Serial.println(aaReal.z);
    #endif

How to get gravity values from real acceleration date using MPU 9150 sensor. 如何使用MPU 9150传感器从实际加速日期获取重力值

Thanks in advance. 提前致谢。

If you could tell what MPU libraries are you using that would be great, but I am assuming you are using Jeff Rowberg's ones with helper_3dmath. 如果您能确定您使用的是哪个MPU库,那将是很好的,但是我假设您正在将Jeff Rowberg的库与helper_3dmath一起使用。

From code you have attached you can notice dmpGetGravity method that populates your VectorFloat. 从附加的代码中,您可以注意到dmpGetGravity方法填充了VectorFloat。 This data class contains x, y, z parameters that corresponds to the gravity that is applied on the given axis (for example sensor facing towards sky with no movement in fixed position, should show 16384.0f for z parameter and assumable 0 for the rest). 该数据类包含x,y,z参数,这些参数与在给定轴上施加的重力相对应(例如,面向天空且固定位置不移动的传感器,z参数应显示16384.0f,其余参数应显示0) 。 You can also retrieve normalized data which is basically every parameter divided by the magnitude calculated by the class itself, based on the data. 您还可以基于数据检索归一化数据,该数据基本上是每个参数除以类本身计算的大小。

Results does not have to be accurate depending on how your sensor is calibrated and how close offsets you set. 结果不一定准确,具体取决于传感器的校准方式和设置的接近偏移量。

I am not sure if it is what you are looking for, but hope it is. 我不确定这是否是您要找的东西,但希望如此。 I did not test it though, but I have some experience with these libraries. 虽然我没有对其进行测试,但是我对这些库有一些经验。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM