use of com.robo4j.math.geometry.Matrix3f in project robo4j by Robo4J.
the class CalibratedMagnetometerExample method main.
public static void main(String[] args) throws IOException, InterruptedException {
// NOTE(Marcus/Jul 23, 2017): Change the actual bias vector and
// transform matrix to match your calibration values.
// See the MagViz tool for more information.
Tuple3f bias = new Tuple3f(-44.689f, -2.0665f, -15.240f);
Matrix3f transform = new Matrix3f(1.887f, 5.987f, -5.709f, 5.987f, 1.528f, -2.960f, -5.709f, -2.960f, 9.761f);
MagnetometerLSM303Device magnetometer = new MagnetometerLSM303Device(I2CBus.BUS_1, 0x1e, Mode.CONTINUOUS_CONVERSION, Rate.RATE_7_5, false, bias, transform);
System.out.println("Starting to read and print the heading. Make sure the magnetometer is flat in the XY-plane (this example does not do tilt compensated heading).");
System.out.println("Press <Enter> to quit...");
EXECUTOR.scheduleAtFixedRate(new MagnetometerPoller(magnetometer), 100, 500, TimeUnit.MILLISECONDS);
System.in.read();
EXECUTOR.shutdown();
EXECUTOR.awaitTermination(1, TimeUnit.SECONDS);
System.out.println("Goodbye!");
}