summaryrefslogtreecommitdiff
path: root/altoslib/AltosCSV.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/AltosCSV.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/AltosCSV.java')
-rw-r--r--altoslib/AltosCSV.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/altoslib/AltosCSV.java b/altoslib/AltosCSV.java
index 4a9278d9..2357dbc7 100644
--- a/altoslib/AltosCSV.java
+++ b/altoslib/AltosCSV.java
@@ -162,17 +162,10 @@ public class AltosCSV implements AltosWriter {
}
void write_advanced(AltosState state) {
- AltosIMU imu = state.imu;
- AltosMag mag = state.mag;
-
- if (imu == null)
- imu = new AltosIMU();
- if (mag == null)
- mag = new AltosMag();
out.printf("%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f,%7.2f",
- imu.accel_x, imu.accel_y, imu.accel_z,
- imu.gyro_x, imu.gyro_y, imu.gyro_z,
- mag.x, mag.y, mag.z);
+ state.accel_along(), state.accel_across(), state.accel_through(),
+ state.gyro_roll(), state.gyro_pitch(), state.gyro_yaw(),
+ state.mag_along(), state.mag_across(), state.mag_through());
}
void write_gps_header() {
@@ -381,7 +374,7 @@ public class AltosCSV implements AltosWriter {
has_basic = true;
if (state.battery_voltage != AltosLib.MISSING)
has_battery = true;
- if (state.imu != null || state.mag != null)
+ if (state.accel_across() != AltosLib.MISSING)
has_advanced = true;
if (state.gps != null) {
has_gps = true;