read-linear-acceleration

wayland/bno055-aos/read-linear-acceleration

Reads linear acceleration (acceleration minus gravity) in each of the three axes.
read-linear-acceleration
@/read-linear-acceleration
Reads linear acceleration (acceleration minus gravity) in each of the three axes.
DEV@/bno055-device
A bno055 device.
UPDpulse
Update. Triggers a new read.
read-linear-acceleration
DEV
UPD
X
Y
Z
DONE
DONEpulse
Pulses on completion of read.
Znumber
Linear acceleration (acceleration minus gravity) in the Z-axis (m/s²).
Ynumber
Linear acceleration (acceleration minus gravity) in the Y-axis (m/s²).
Xnumber
Linear acceleration (acceleration minus gravity) in the X-axis (m/s²).
To use the node in your project you should have the wayland/bno055-aos 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

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    // The node responds only if there is an input pulse
    if (!isInputDirty<input_UPD>(ctx))
        return;

    // Get a pointer to the `Adafruit_BNO055` class instance
    auto aos = getValue<input_DEV>(ctx);

    imu::Vector<3> linearaccel = aos->getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);
    emitValue<output_X>(ctx,linearaccel.x());
    emitValue<output_Y>(ctx,linearaccel.y());
    emitValue<output_Z>(ctx,linearaccel.z());
    emitValue<output_DONE>(ctx, 1);
}