Estimates orientation by integrating the gyroscope while correcting drift with the accelerometer (gravity) and optional magnetometer through a proportional+integral complementary feedback on SO(3) (Mahony et al. 2008).
Value
a data frame time, roll, pitch, yaw (rad) and q_w, q_x, q_y, q_z,
matching estimateOrientation().
Examples
n <- 200; sr <- 100; t <- seq_len(n) / sr
roll <- 0.3 * sin(2 * pi * 0.5 * t); pitch <- 0.2 * cos(2 * pi * 0.3 * t)
accel <- cbind(-sin(pitch), sin(roll) * cos(pitch), cos(roll) * cos(pitch))
gyro <- cbind(c(0, diff(roll)) * sr, c(0, diff(pitch)) * sr, 0)
est <- mahonyAHRS(gyro, accel, sampling_rate = sr)
max(abs(est$roll - roll))
#> [1] 17.30515