summaryrefslogtreecommitdiff
path: root/altoslib/AltosTelemetryMegaSensor.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-10-04 00:11:13 -0700
committerKeith Packard <keithp@keithp.com>2014-10-04 00:11:13 -0700
commit00ae706dab6e8fddef4c5730a17c433a022228b7 (patch)
treefae976ad891d1776f6e52c078d9eceb35d96a845 /altoslib/AltosTelemetryMegaSensor.java
parenta757fd5af53f5721a949181372548afa4757d6c9 (diff)
altoslib: Compute tilt angle from eeprom data
This copies the computation of tilt angle from the firmware so that post-flight analysis can also show the data. This change also renames all of the imu values to make them easier to understand: accel gyro axis along roll length of the board across pitch across the board through yaw through the board. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosTelemetryMegaSensor.java')
-rw-r--r--altoslib/AltosTelemetryMegaSensor.java27
1 files changed, 8 insertions, 19 deletions
diff --git a/altoslib/AltosTelemetryMegaSensor.java b/altoslib/AltosTelemetryMegaSensor.java
index 1b568c88..bae18d1c 100644
--- a/altoslib/AltosTelemetryMegaSensor.java
+++ b/altoslib/AltosTelemetryMegaSensor.java
@@ -66,24 +66,13 @@ public class AltosTelemetryMegaSensor extends AltosTelemetryStandard {
state.set_orient(orient);
- AltosIMU imu = new AltosIMU();
-
- imu.accel_x = AltosIMU.convert_accel(accel_x);
- imu.accel_y = AltosIMU.convert_accel(accel_y);
- imu.accel_z = AltosIMU.convert_accel(accel_z);
-
- imu.gyro_x = AltosIMU.convert_gyro(gyro_x);
- imu.gyro_y = AltosIMU.convert_gyro(gyro_y);
- imu.gyro_z = AltosIMU.convert_gyro(gyro_z);
-
- state.imu = imu;
-
- AltosMag mag = new AltosMag();
-
- mag.x = AltosMag.convert_gauss(mag_x);
- mag.y = AltosMag.convert_gauss(mag_y);
- mag.z = AltosMag.convert_gauss(mag_z);
-
- state.mag = mag;
+ state.set_imu(new AltosIMU(accel_y, /* along */
+ accel_x, /* across */
+ accel_z, /* through */
+ gyro_y, /* along */
+ gyro_x, /* across */
+ gyro_z)); /* through */
+
+ state.set_mag(new AltosMag(mag_x, mag_y, mag_z));
}
}