From f26cfe417c6977cf1e7e75a4f050e25f64d41859 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 25 May 2017 17:24:14 -0700 Subject: altoslib: Do data analysis on raw values rather than AltosState Use AltosFlightSeries instead of a sequence of AltosState records when processing saved data. This provides a better way of doing filtering and plotting. Signed-off-by: Keith Packard --- altoslib/AltosIMU.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'altoslib/AltosIMU.java') diff --git a/altoslib/AltosIMU.java b/altoslib/AltosIMU.java index f6cadf1d..20a2a413 100644 --- a/altoslib/AltosIMU.java +++ b/altoslib/AltosIMU.java @@ -33,7 +33,7 @@ public class AltosIMU implements Cloneable { public static final double counts_per_g = 2048.0; public static double convert_accel(double counts) { - return counts / counts_per_g * (-AltosConvert.GRAVITATIONAL_ACCELERATION); + return counts / counts_per_g * AltosConvert.gravity; } public static final double counts_per_degsec = 16.4; @@ -72,12 +72,18 @@ public class AltosIMU implements Cloneable { return n; } - static public void update_state(AltosState state, AltosLink link, AltosConfigData config_data) throws InterruptedException { + static public void provide_data(AltosDataListener listener, AltosLink link, AltosCalData cal_data) throws InterruptedException { try { AltosIMU imu = new AltosIMU(link); - if (imu != null) - state.set_imu(imu); + if (imu != null) { + listener.set_accel(cal_data.accel_along(imu.accel_along), + cal_data.accel_across(imu.accel_across), + cal_data.accel_through(imu.accel_through)); + listener.set_gyro(cal_data.gyro_roll(imu.gyro_roll), + cal_data.gyro_pitch(imu.gyro_pitch), + cal_data.gyro_yaw(imu.gyro_yaw)); + } } catch (TimeoutException te) { } } -- cgit v1.2.3