altosui: Plot reasonable data from Tm files
authorKeith Packard <keithp@keithp.com>
Wed, 10 Aug 2011 21:35:21 +0000 (14:35 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 10 Aug 2011 21:35:21 +0000 (14:35 -0700)
Don't plot acceleration based on baro data.
Display baro speed if accel speed isn't available.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosFlightStats.java
altosui/AltosFlightStatsTable.java
altosui/AltosState.java

index e644b0bab73db07b6fd45bad7fc406f6ee1f6750..19471e9fa650847b8af2d5406e3036f8db19f4be 100644 (file)
@@ -67,7 +67,10 @@ public class AltosFlightStats {
                                        if (state_end[state.state] < state.time)
                                                state_end[state.state] = state.time;
                                        max_height = state.max_height;
-                                       max_speed = state.max_speed;
+                                       if (state.max_speed != 0)
+                                               max_speed = state.max_speed;
+                                       else
+                                               max_speed = state.max_baro_speed;
                                        max_acceleration = state.max_acceleration;
                                }
                        } catch (ParseException pp) {
index 8676d3065c1fbee288fed7b856599b71f6c6a9c1..e2c0dd46597becf129cdccf214dec5cb5bbd7068 100644 (file)
@@ -77,14 +77,16 @@ public class AltosFlightStatsTable extends JComponent {
                               String.format("%5.0f m/s", stats.max_speed),
                               String.format("%5.0f ft/s", stats.max_speed * 100 / 2.54 / 12),
                               String.format("Mach %5.3f", stats.max_speed / 343.0));
-               new FlightStat(layout, y++, "Maximum acceleration",
-                              String.format("%5.0f m/s²", stats.max_acceleration),
-                              String.format("%5.0f ft/s²", stats.max_acceleration * 100 / 2.54 /12),
-                              String.format("%5.2f G", stats.max_acceleration / 9.80665));
-               new FlightStat(layout, y++, "Average boost acceleration",
-                              String.format("%5.0f m/s²", stats.state_accel[Altos.ao_flight_boost]),
-                              String.format("%5.0f ft/s²", stats.state_accel[Altos.ao_flight_boost] * 100 / 2.54 /12),
-                              String.format("%5.2f G", stats.state_accel[Altos.ao_flight_boost] / 9.80665));
+               if (stats.max_acceleration != AltosRecord.MISSING) {
+                       new FlightStat(layout, y++, "Maximum acceleration",
+                                      String.format("%5.0f m/s²", stats.max_acceleration),
+                                      String.format("%5.0f ft/s²", stats.max_acceleration * 100 / 2.54 /12),
+                                      String.format("%5.2f G", stats.max_acceleration / 9.80665));
+                       new FlightStat(layout, y++, "Average boost acceleration",
+                                      String.format("%5.0f m/s²", stats.state_accel[Altos.ao_flight_boost]),
+                                      String.format("%5.0f ft/s²", stats.state_accel[Altos.ao_flight_boost] * 100 / 2.54 /12),
+                                      String.format("%5.2f G", stats.state_accel[Altos.ao_flight_boost] / 9.80665));
+               }
                new FlightStat(layout, y++, "Drogue descent rate",
                               String.format("%5.0f m/s", stats.state_baro_speed[Altos.ao_flight_drogue]),
                               String.format("%5.0f ft/s", stats.state_baro_speed[Altos.ao_flight_drogue] * 100 / 2.54 / 12));
index 1ac816d52f842f594e9b378b003ba8a59754e907..378930bf4993856464edbf42ba02c7dd419c9d90 100644 (file)
@@ -49,6 +49,7 @@ public class AltosState {
        double  max_height;
        double  max_acceleration;
        double  max_speed;
+       double  max_baro_speed;
 
        AltosGPS        gps;
 
@@ -105,6 +106,7 @@ public class AltosState {
                        max_height = prev_state.max_height;
                        max_acceleration = prev_state.max_acceleration;
                        max_speed = prev_state.max_speed;
+                       max_baro_speed = prev_state.max_baro_speed;
 
                        /* make sure the clock is monotonic */
                        while (tick < prev_state.tick)
@@ -171,6 +173,8 @@ public class AltosState {
                        max_acceleration = acceleration;
                if (ascent && speed > max_speed)
                        max_speed = speed;
+               if (ascent && baro_speed > max_baro_speed)
+                       max_baro_speed = baro_speed;
 
                if (height > max_height)
                        max_height = height;