altoslib: Rotation off by factor of two
authorKeith Packard <keithp@keithp.com>
Sun, 13 Sep 2015 03:41:37 +0000 (20:41 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 13 Oct 2015 20:54:28 +0000 (13:54 -0700)
The rotation computation was off by a factor of two when converting
the rates to a quaternion (the quaternion needs to be half of the
actual rotation amount). This ended up presenting a tilt angle of
twice what it should be.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosRotation.java

index 9771c1660f7716718a5f4756ae16f39b50a92e86..c4b07f623b465ef8bd354af14e099c0f48848a33 100644 (file)
@@ -28,7 +28,7 @@ public class AltosRotation {
        }
 
        public void rotate(double dt, double x, double y, double z) {
-               AltosQuaternion rot = AltosQuaternion.half_euler(x * dt, y * dt, z * dt);
+               AltosQuaternion rot = AltosQuaternion.half_euler(x * dt / 2.0, y * dt / 2.0, z * dt / 2.0);
                rotation = rot.multiply(rotation).normalize();
        }