Page 54 - MDP2022-2
P. 54

Serial.print("euler\t");
                                    Serial.print(euler[0]  *  180/M_PI);
                                    Serial.print("\t");
                                    Serial.print(euler[1]  *  180/M_PI);
                                    Serial.print("\t");
                                    Serial.println(euler[2]  *  180/M_PI);
                            #endif


                            #ifdef  OUTPUT_READABLE_YAWPITCHROLL
                                    //  display  Euler  angles  in  degrees
                                    mpu.dmpGetQuaternion(&q,  fifoBuffer);
                                    mpu.dmpGetGravity(&gravity,  &q);
                                    mpu.dmpGetYawPitchRoll(ypr,  &q,  &gravity);
                                    Serial.print("ypr\t");
                                    Serial.print(ypr[0]  *  180/M_PI);
                                    Serial.print("\t");
                                    Serial.print(ypr[1]  *  180/M_PI);
                                    Serial.print("\t");
                                    Serial.println(ypr[2]  *  180/M_PI);
                            #endif

                            #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


                            #ifdef  OUTPUT_READABLE_WORLDACCEL
                                    //  display  initial  world-frame  acceleration,  adjusted  to  remove  gravity
                                    //  and  rotated  based  on  known  orientation  from  quaternion
                                    mpu.dmpGetQuaternion(&q,  fifoBuffer);
                                    mpu.dmpGetAccel(&aa,  fifoBuffer);
                                    mpu.dmpGetGravity(&gravity,  &q);
                                    mpu.dmpGetLinearAccel(&aaReal,  &aa,  &gravity);
                                    mpu.dmpGetLinearAccelInWorld(&aaWorld,  &aaReal,  &q);
                                    Serial.print("aworld\t");
                                    Serial.print(aaWorld.x);
                                    Serial.print("\t");
                                    Serial.print(aaWorld.y);
                                    Serial.print("\t");
                                    Serial.println(aaWorld.z);
                            #endif

                            #ifdef  OUTPUT_TEAPOT
                                    //  display  quaternion  values  in  InvenSense  Teapot  demo  format:
                                    teapotPacket[2]  =  fifoBuffer[0];
                                    teapotPacket[3]  =  fifoBuffer[1];
                                    teapotPacket[4]  =  fifoBuffer[4];
   49   50   51   52   53   54   55   56   57   58   59