var prevX = 0
var prevY = 0
var prevY = 0
var alpha = 0.1
var prev_x = 0
var prev_y = 0
var prev_t = 0
var integral = 0
var is_first = true
var first_value = 0
// source: https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles
function quaternionToYaw(x, y, z, w)
{
// yaw (z-axis rotation)
t1 = 2.0 * (w * z + x * y);
t2 = 1.0 - 2.0 * (y * y + z * z);
yaw = Math.atan2(t1, t2);
return yaw
}