Hello, I'm trying to do an autonomous flight indoors and I decided to program my APM 2.8 with a custom code using the AP library, when I test the sensor to measure Pitch Roll and Yaw, Pitch and Roll work fine, but Yaw starts to climb gradually to 180 and then immediately becomes -180 and starts to rise to 0 and then repeats, but if I move the drone the sensor perceives it, I explain, if we say goes in 3.2 degrees and move the drone in Yaw about 45 degrees the sensor shows me 48.2, then goes to 49 and so on, is there any way to fix this? I thank you for an answer,  I put down the code and a capture of the serial monitor when Yaw is increasing while the drone is still.

      // Ask MPU6050 for orientation

      ins.update();

      float roll,pitch,yaw;  

       

       ins.quaternion.to_euler(&roll, &pitch, &yaw);

      roll = ToDeg(roll) ;

      pitch = ToDeg(pitch) ;

      yawn = ToDeg(yaw);

       hal.console->printf_P(

      PSTR("P:%4.8f \n"),yawn);

3691356483?profile=original

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Activity