diff options
| author | Keith Packard <keithp@keithp.com> | 2017-06-22 10:10:06 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-06-22 10:10:06 -0700 | 
| commit | 6dbb362b2d1df4d8c2d301e90624aceef8051ef5 (patch) | |
| tree | 882cca04aafcb8185444e412eb192ccf86f439c2 /altoslib/AltosState.java | |
| parent | ea7e236e75452e27f3af6730a0542850851eb23d (diff) | |
altoslib: Clean up quaternion and rotation interfaces
Export euler to quaternion (instead of half_euler).
Provide angles to rotate rather than rates and time.
Add comments to quaternion and rotation code.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosState.java')
| -rw-r--r-- | altoslib/AltosState.java | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/altoslib/AltosState.java b/altoslib/AltosState.java index cfee819b..9ee3d57d 100644 --- a/altoslib/AltosState.java +++ b/altoslib/AltosState.java @@ -931,12 +931,12 @@ public class AltosState extends AltosDataListener {  		if (last_imu_time != AltosLib.MISSING) {  			double	t = time - last_imu_time; -			double	pitch = AltosConvert.degrees_to_radians(gyro_pitch); -			double	yaw = AltosConvert.degrees_to_radians(gyro_yaw); -			double	roll = AltosConvert.degrees_to_radians(gyro_roll); +			if (t > 0 && gyro_pitch != AltosLib.MISSING && rotation != null) { +				double	pitch = AltosConvert.degrees_to_radians(gyro_pitch) * t; +				double	yaw = AltosConvert.degrees_to_radians(gyro_yaw) * t; +				double	roll = AltosConvert.degrees_to_radians(gyro_roll) * t; -			if (t > 0 && pitch != AltosLib.MISSING && rotation != null) { -				rotation.rotate(t, pitch, yaw, roll); +				rotation.rotate(pitch, yaw, roll);  				orient.set_computed(rotation.tilt(), time);  			}  		} | 
