get-roll-pitch-yaw

gabbapeople/mpu6050/get-roll-pitch-yaw

No description
get-roll-pitch-yaw
@/get-roll-pitch-yaw
DEV@/mpu6050-device
UPDpulse
get-roll-pitch-yaw
DEV'
YAW
PITCH
ROLL
DONE
DEV
UPD
DONEpulse
ROLLnumber
The rotation angle around X-axis.
PITCHnumber
The rotation angle around Y-axis.
YAWnumber
The rotation angle around Z-axis.
DEV'@/mpu6050-device
To use the node in your project you should have the gabbapeople/mpu6050 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

node {
    void evaluate(Context ctx) {
        auto mpu = getValue<input_DEV>(ctx);

        if (isSettingUp())
            emitValue<output_DEVU0027>(ctx, mpu);

        if (!isInputDirty<input_UPD>(ctx))
            return;

        mpu->dmpGetQuaternion(&q, fifoBuffer);
        mpu->dmpGetGravity(&gravity, &q);
        mpu->dmpGetYawPitchRoll(ypr, &q, &gravity);

        emitValue<output_YAW>(ctx, ypr[0] * 180 / PI);
        emitValue<output_PITCH>(ctx, ypr[1] * 180 / PI);
        emitValue<output_ROLL>(ctx, ypr[2] * 180 / PI);

        emitValue<output_DONE>(ctx, 1);
    }
}