I am using react-native-sensor to grab the raw data from these sensors.
import {magnetometer, acclerometer} from 'react-native-sensors';
const subscription = accelerometer.subscribe(({ x, y, z, timestamp }) =>
console.log({ x, y, z, timestamp })
this.setState({ accelerometer: { x, y, z, timestamp } })
);
const subscription = magnetometer.subscribe(({ x, y, z, timestamp }) =>
console.log({ x, y, z })
this.setState({ magnetometer: { x, y, z, timestamp } })
);
Given these 6 data points, how can I get the degree and direction? What is the appropriate algorithm?
I do not understand the algorithm in this answer. This answer utilizes alpha, beta, gamma...is that the same as "x, y, z"? Why does that only use 3 data points and not 6? Why do some other answers say that accelerometer data is required (for tilt adjustment?). Why isn't there an answer that utilizes all 6 data points?
(note: the documentation has a mis-spelling of "magenetometer")