get-linear-accel

gabbapeople/mpu6050/get-linear-accel

No description
get-linear-accel
@/get-linear-accel
DEV@/mpu6050-device
UPDpulse
get-linear-accel
DEV
UPD
DEV'
laX
laY
laZ
DONE
DONEpulse
laZnumber
 Linear acceleration along Z-axis.
laYnumber
 Linear acceleration along Y-axis.
laXnumber
 Linear acceleration along X-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->dmpGetAccel(&aa, fifoBuffer);
        mpu->dmpGetGravity(&gravity, &q);
        mpu->dmpGetLinearAccel(&aaReal, &aa, &gravity);

        emitValue<output_laX>(ctx, aaReal.x);
        emitValue<output_laY>(ctx, aaReal.y);
        emitValue<output_laZ>(ctx, aaReal.z);

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