|
本帖最后由 Daniel_Lau 于 2014-2-16 11:22 编辑
代码移植自 论坛里 _spetrel 的STM32版本。平台是野火的MK60FX/DN CORE
全部测试完毕。之间遇到的问题在众多MPU6050 DMP里也都有提过,都进行了修正。
大家可以测试一下,其他的硬件平台不敢保证,不过理论上是可以用到所有MK60平台上的。
希望大家一起完善一下。上位机坛子里有很多,大家可以试试效果如何。有问题在下面反馈就行。
附件怎么发啊.....先贴出BaiDu网盘的链接吧
http://pan.baidu.com/s/1hqwYy4s
UPDATE 1# : 在main.c里面 定义的 run_self_test() 函数,其中 if (result == 0x3) 这里应该是0x3,上传的代码是0x7,但0x7的话自检不会自我纠正偏移,大家自己更改一下吧
- static void run_self_test(void)
- {
- int result;
- // char test_packet[4] = {0};
- long gyro[3], accel[3];
- result = mpu_run_self_test(gyro, accel);
- if (result == 0x3) {
- /* Test passed. We can trust the gyro data here, so let's push it down
- * to the DMP.
- */
- float sens;
- unsigned short accel_sens;
- mpu_get_gyro_sens(&sens);
- gyro[0] = (long)(gyro[0] * sens);
- gyro[1] = (long)(gyro[1] * sens);
- gyro[2] = (long)(gyro[2] * sens);
- dmp_set_gyro_bias(gyro);
- mpu_get_accel_sens(&accel_sens);
- accel[0] *= accel_sens;
- accel[1] *= accel_sens;
- accel[2] *= accel_sens;
- dmp_set_accel_bias(accel);
- printf("setting bias succesfully ......\n");
- }
- else
- {
- printf("bias has not been modified ......\n");
- }
- /* Report results. */
- // test_packet[0] = 't';
- // test_packet[1] = result;
- // send_packet(PACKET_TYPE_MISC, test_packet);
- }
复制代码
补张效果图
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|