Search in sources :

Example 1 with Quaternion

use of org.firstinspires.ftc.robotcore.external.navigation.Quaternion in project robotcode by OutoftheBoxFTC.

the class BNO055IMUImpl method getQuaternionOrientation.

public synchronized Quaternion getQuaternionOrientation() {
    // Ensure we can see the registers we need
    deviceClient.ensureReadWindow(new I2cDeviceSynch.ReadWindow(Register.QUA_DATA_W_LSB.bVal, 8, readMode), upperWindow);
    // Section 3.6.5.5 of BNO055 specification
    TimestampedData ts = deviceClient.readTimeStamped(Register.QUA_DATA_W_LSB.bVal, 8);
    VectorData vector = new VectorData(ts, (1 << 14));
    return new Quaternion(vector.next(), vector.next(), vector.next(), vector.next(), vector.data.nanoTime);
}
Also used : TimestampedData(com.qualcomm.robotcore.hardware.TimestampedData) Quaternion(org.firstinspires.ftc.robotcore.external.navigation.Quaternion) I2cDeviceSynch(com.qualcomm.robotcore.hardware.I2cDeviceSynch)

Aggregations

I2cDeviceSynch (com.qualcomm.robotcore.hardware.I2cDeviceSynch)1 TimestampedData (com.qualcomm.robotcore.hardware.TimestampedData)1 Quaternion (org.firstinspires.ftc.robotcore.external.navigation.Quaternion)1