Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Teensy 3.6 and Propshield : Yaw value unstable

  1. #1

    Teensy 3.6 and Propshield : Yaw value unstable

    Below code I am using for getting the roll, pitch and yaw value.

    #include <Wire.h>
    #include "NXPMotionSense.h"
    #include "MadgwickAHRS.h"
    NXPMotionSense motionOut;
    Madgwick filterOut1;
    void setup()
        filterOut1.begin(100);		//Madgwick Filter
    void loop(){
        float ax, ay, az;
        float gx, gy, gz;
        float mx, my, mz;
        float roll, pitch, yaw;
            /* Due to mounting for both the ICs - need to align their axis */
            motionOut.readMotionSensor(ax, ay, az, gx, gy, gz, mx, my, mz);
            filterOut1.update(-gy, gx, gz, ax, ay, az,  mx, my, mz);
            roll = 180 + filterOut1.getRoll();			//Roll : 0-360 [-180 to 180]
    	pitch = 90 + filterOut1.getPitch();			//Pitch : 0-180 [-90 to 90]
    	yaw = filterOut1.getYaw();					//Yaw : 0-360 [0 to 360]
            Serial.print("Roll: " + String(roll) + " Pitch: " + String(pitch) + " Yaw: " + String(yaw));

    I am getting the values for Roll, pitch and yaw. Here I am attaching the serial logs of roll, pitch and yaw data in text file.rollpitchyaw.txt
    The data I am getting from the propshield for roll, pitch is stable but the value of yaw is continuously decreasing.

    I am using Paul's NXPMotionSense Library with Teensy's propshield and Teensy 3.6 board.
    Here I am attaching the picture for in which position propshield I am using.
    Click image for larger version. 

Name:	IMG_20191216_174719.jpg 
Views:	8 
Size:	241.4 KB 
ID:	18450
    How can I get the stable value of yaw also? Kindly help me to how to get the stable value of yaw.

    Need help: @MichaelMeissner, @manitou, @defragster, @PaulStoffregen, @KurtE, @mjs531


  2. #2
    Senior Member
    Join Date
    Jul 2014
    Suggest to print out the sensor data gx to mz to see which component is changing over time.
    It may be that one sensor (magnetometer?) may change its value as function of temperature, resulting in the effect you are describing.
    AFAIK, all such sensors must be corrected for temperature (OT: and pressure) changes.

  3. #3
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    I changed Serial.print to Serial.println in your sketch, and instead of Serial monitor, i selected Serial Plotter from IDE. you will see a nice graph of yaw pitch and roll that will vary as you wiggle propshield. With my T3.2+propshield stationary, I have nice straight lines in the plot ... no drift. I had calibrated the shield+T3.2 earlier, so I had good calibration data for magnetometer. Have you run the calibration steps with MotionCal app and saved calibration data to EEPROM as described here

    nearby electrical fields could disrupt your magnetometer...

  4. #4
    I did the calibration for the shield+T3.6 and used for getting the yaw value supposed to be stable. But the problem is in some case I am getting the yaw values are stable and some case I am getting unstable yaw value after the calibration also. What will help me to get the yaw value to stable.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts