asd2002061 发表于 2014-6-29 23:22:51

请教各位大神关于MPU6050读取DMP加速度的问题。

最近学习MPU6050看到群里各位大神分享的DMP例子,感觉十分受用,可能是大家都做四轴飞行器的缘故大多都只做到了航向识别如下面的程序。如果需要读取角速度和加速度该如何处理数据呢,请问各位如何处理读取到的加速度呢?




         short gyro, accel;
            long quat;
        dmp_read_fifo(gyro, accel, quat, &sensor_timestamp, &sensors,&more);
       q0=quat / q30;       
      q1=quat / q30;
       q2=quat / q30;
       q3=quat / q30;
       Pitch= asin(2 * q1 * q3 - 2 * q0* q2)* 57.3+180;       
       Roll = atan2(2 * q2 * q3 + 2 * q0 * q1, -2 * q1 * q1 - 2 * q2* q2 + 1)* 57.3+180;
       Yaw =         atan2(2*(q1*q2 + q0*q3),q0*q0+q1*q1-q2*q2-q3*q3) * 57.3+180;

asd2002061 发表于 2014-6-30 00:03:03

麻烦大家了~

asd2002061 发表于 2014-6-30 09:08:58

帖子不要沉呀`求各位大神帮忙。

qzrzq 发表于 2014-6-30 13:11:53

看dmp_read_fifo函数的注释

asd2002061 发表于 2014-6-30 13:44:06

qzrzq 发表于 2014-6-30 13:11
看dmp_read_fifo函数的注释

我这边没有啊~您那里有吗?

qzrzq 发表于 2014-6-30 14:01:46

/**
*@brief      Get one packet from the FIFO.
*If @e sensors does not contain a particular sensor, disregard the data
*returned to that pointer.
*\n @e sensors can contain a combination of the following flags:
*\n INV_X_GYRO, INV_Y_GYRO, INV_Z_GYRO
*\n INV_XYZ_GYRO
*\n INV_XYZ_ACCEL
*\n INV_WXYZ_QUAT
*\n If the FIFO has no new data, @e sensors will be zero.
*\n If the FIFO is disabled, @e sensors will be zero and this function will
*return a non-zero error code.
*@param gyro      Gyro data in hardware units.
*@param accel       Accel data in hardware units.
*@param quat      3-axis quaternion data in hardware units.
*@param timestamp   Timestamp in milliseconds.
*@param sensors   Mask of sensors read from FIFO.
*@param more      Number of remaining packets.
*@return   0 if successful.
*/
int dmp_read_fifo(short *gyro, short *accel, long *quat,
    unsigned long *timestamp, short *sensors, unsigned char *more)
页: [1]
查看完整版本: 请教各位大神关于MPU6050读取DMP加速度的问题。