From: Keith Packard Date: Sun, 13 Sep 2015 03:41:37 +0000 (-0700) Subject: altoslib: Rotation off by factor of two X-Git-Tag: 1.6.2^2~60 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=618f7ac8f31941fcbb3ed91829de69c0f0be8e0b altoslib: Rotation off by factor of two 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 --- diff --git a/altoslib/AltosRotation.java b/altoslib/AltosRotation.java index 9771c166..c4b07f62 100644 --- a/altoslib/AltosRotation.java +++ b/altoslib/AltosRotation.java @@ -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(); }