搜索
bottom↓
回复: 5

MPU6050的DMP库中的inv_mpu.c中的函数需不需要看懂?

[复制链接]

出0入0汤圆

发表于 2015-7-23 19:19:44 | 显示全部楼层 |阅读模式
本帖最后由 书9500 于 2015-7-24 16:46 编辑

大神们救命啊,看了一天了,都被那里面的各种配置绕晕了。
好复杂,好复杂。。。

出0入0汤圆

 楼主| 发表于 2015-7-24 16:47:30 | 显示全部楼层
数据到是读出来了,但是函数看不懂。一点也不会改啊。

出0入0汤圆

 楼主| 发表于 2015-7-24 16:50:37 | 显示全部楼层
谁能帮我解释一下,DMP的配置过程啊?
void MPU6050_DMP_Init(void)
{        
    if(!mpu_init())
  {
    /* Get/set hardware configuration. Start gyro. */
    /* Wake up all sensors. */
                if(!mpu_set_sensors(INV_XYZ_GYRO | INV_XYZ_ACCEL))
                   printf("mpu_set_sensor complete ......\r\n");
                /* Push both gyro and accel data into the FIFO. */
          if(!mpu_configure_fifo(INV_XYZ_GYRO | INV_XYZ_ACCEL))
                   printf("mpu_configure_fifo complete ......\r\n");
          if(!mpu_set_sample_rate(DEFAULT_MPU_HZ))
                   printf("mpu_set_sample_rate complete ......\r\n");
                /* To initialize the DMP:
     * 1. Call dmp_load_motion_driver_firmware(). This pushes the DMP image in
     *    inv_mpu_dmp_motion_driver.h into the MPU memory.
     * 2. Push the gyro and accel orientation matrix to the DMP.
     * 3. Register gesture callbacks. Don't worry, these callbacks won't be
     *    executed unless the corresponding feature is enabled.
     * 4. Call dmp_enable_feature(mask) to enable different features.
     * 5. Call dmp_set_fifo_rate(freq) to select a DMP output rate.
     * 6. Call any feature-specific control functions.
     *
     * To enable the DMP, just call mpu_set_dmp_state(1). This function can
     * be called repeatedly to enable and disable the DMP at runtime.
     *
     * The following is a short summary of the features supported in the DMP
     * image provided in inv_mpu_dmp_motion_driver.c:
     * DMP_FEATURE_LP_QUAT: Generate a gyro-only quaternion on the DMP at
     * 200Hz. Integrating the gyro data at higher rates reduces numerical
     * errors (compared to integration on the MCU at a lower sampling rate).
     * DMP_FEATURE_6X_LP_QUAT: Generate a gyro/accel quaternion on the DMP at
     * 200Hz. Cannot be used in combination with DMP_FEATURE_LP_QUAT.
     * DMP_FEATURE_TAP: Detect taps along the X, Y, and Z axes.
     * DMP_FEATURE_ANDROID_ORIENT: Google's screen rotation algorithm. Triggers
     * an event at the four orientations where the screen should rotate.
     * DMP_FEATURE_GYRO_CAL: Calibrates the gyro data after eight seconds of
     * no motion.
     * DMP_FEATURE_SEND_RAW_ACCEL: Add raw accelerometer data to the FIFO.
     * DMP_FEATURE_SEND_RAW_GYRO: Add raw gyro data to the FIFO.
     * DMP_FEATURE_SEND_CAL_GYRO: Add calibrated gyro data to the FIFO. Cannot
     * be used in combination with DMP_FEATURE_SEND_RAW_GYRO.
     */
          if(!dmp_load_motion_driver_firmware())
                  printf("dmp_load_motion_driver_firmware complete ......\r\n");
          if(!dmp_set_orientation(inv_orientation_matrix_to_scalar(gyro_orientation)))
                   printf("dmp_set_orientation complete ......\r\n");
          if(!dmp_enable_feature(DMP_FEATURE_6X_LP_QUAT | DMP_FEATURE_TAP |
                DMP_FEATURE_ANDROID_ORIENT | DMP_FEATURE_SEND_RAW_ACCEL | DMP_FEATURE_SEND_CAL_GYRO |
                DMP_FEATURE_GYRO_CAL))
                   printf("dmp_enable_feature complete ......\r\n");
          if(!dmp_set_fifo_rate(DEFAULT_MPU_HZ))
                   printf("dmp_set_fifo_rate complete ......\r\n");
          run_self_test();
          if(!mpu_set_dmp_state(1))
                   printf("mpu_set_dmp_state complete ......\r\n");
  }
}

出0入0汤圆

发表于 2015-7-24 17:01:26 | 显示全部楼层
握个手,,,哈哈,你比我快。我的数据也没读出来。我的是MPU9250.

出0入0汤圆

 楼主| 发表于 2015-7-24 17:08:50 | 显示全部楼层
沉默胜过白金 发表于 2015-7-24 17:01
握个手,,,哈哈,你比我快。我的数据也没读出来。我的是MPU9250.

内部集成了磁力计?

出0入0汤圆

发表于 2015-7-24 17:30:29 | 显示全部楼层
书9500 发表于 2015-7-24 17:08
内部集成了磁力计?

是的。一起折腾哈。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-4-29 12:09

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表