mpu6050 报错fifo overflow解决办法

来源:互联网 发布:先锋编辑软件 编辑:程序博客网 时间:2024/06/05 00:16

    最近ros计划介入imu消息,使用arduino 接口mpu6050,再通过串口介入ros。使用的是https://github.com/fsteinhardt/mpu6050_serial_to_imu中的开源代码。调试的时候一切都很顺利,但后来发现过一段时间就不发消息利,arduino程序报fifo overflow,后续卡死;找到的解决方法是;将arduino库中的头文件MPU6050_6Axis_MotionApps20.h中305行最后一个数字变大

   0x02,   0x16,   0x02,   0x00, 0x07               //(0x07 -> 16Mhz) D_0_22 inv_set_fifo_rate (0x06 for first 8mhz board) (0x09 for 8Mhz board from Binoy)

    // This very last 0x01 WAS a 0x09, which drops the FIFO rate down to 20 Hz. 0x07 is 25 Hz,
    // 0x01 is 100Hz. Going faster than 100Hz (0x00=200Hz) tends to result in very noisy data.
    // DMP output frequency is calculated easily using this equation: (200Hz / (1 + value))

    // It is important to make sure the host processor can keep up with reading and processing
    // the FIFO output at the desired rate. Handling FIFO overflow cleanly is also a good idea.

这个数字关系到ros平台imu topic 的频率,根据硬件性能,设置相应的数值即可,测试不报错就可以啦。


0 0