Add GPS height to the usual plot plot-gps-height
authorKeith Packard <keithp@keithp.com>
Wed, 16 Jan 2013 23:19:51 +0000 (15:19 -0800)
committerKeith Packard <keithp@keithp.com>
Sat, 19 Jan 2013 07:00:20 +0000 (23:00 -0800)
This lets us compare the GPS height data to the barometric height data

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosEepromRecord.java
altosui/AltosDataPoint.java
altosui/AltosDataPointReader.java
altosui/AltosGraphTime.java
altosui/AltosGraphUI.java

index c7ced6a3d0cd18db6e75cc645b8adc7d15be4be2..86cb8d56a0f230ba1fd9f5edbc4d43b80844dbbe 100644 (file)
@@ -50,6 +50,29 @@ public class AltosEepromRecord {
                data = null;
        }
 
+       public String toString() {
+               switch (cmd) {
+               case AltosLib.AO_LOG_FLIGHT:
+                       return String.format("tick %5d flight %5d ground_accel %6d\n",
+                                            tick, b, a);
+               case AltosLib.AO_LOG_SENSOR:
+                       return String.format("tick %5d accel %5d pres %5d\n",
+                                            tick, a, b);
+               case AltosLib.AO_LOG_TEMP_VOLT:
+               case AltosLib.AO_LOG_DEPLOY:
+               case AltosLib.AO_LOG_STATE:
+               case AltosLib.AO_LOG_GPS_TIME:
+               case AltosLib.AO_LOG_GPS_LAT:
+               case AltosLib.AO_LOG_GPS_LON:
+               case AltosLib.AO_LOG_GPS_ALT:
+               case AltosLib.AO_LOG_GPS_SAT:
+               case AltosLib.AO_LOG_GPS_DATE:
+               case AltosLib.AO_LOG_PRESSURE:
+               default:
+                       return data;
+               }
+       }
+
        public AltosEepromRecord (String line) {
                tick_valid = false;
                tick = 0;
index 4956e9f3c61eec2662056f746289c52db4abeb8a..f3408cb21ea76e1134335a02dcc2c73dffb904af 100644 (file)
@@ -17,6 +17,7 @@ interface AltosDataPoint {
 
     double acceleration();
     double height();
+    double gps_height();
     double speed();
     double temperature();
     double battery_voltage();
index 88df081faeee4584d12113220eeaebbf443c1cd1..6e6e474ea9694ace4076b4a5c62c0787f509c5c5 100644 (file)
@@ -48,6 +48,7 @@ class AltosDataPointReader implements Iterable<AltosDataPoint> {
 
             public double acceleration() { return state.acceleration; }
            public double height() { return state.height; }
+           public double gps_height() { return state.gps_height; }
            public double speed() { return state.speed(); }
             public double temperature() { return state.temperature; }
             public double battery_voltage() { return state.battery; }
index 62d516b24f7782e1a1343409ed9b8c1d602e5012..935d59dec147f38c9f970b6793787b9ab78ca044 100644 (file)
@@ -99,9 +99,10 @@ class AltosGraphTime extends AltosGraph {
             int dataNum = g.getDataNum(this);
             int axisNum = g.getAxisNum(this);
 
-            plot.setDataset(dataNum, dataset);
+           plot.setDataset(dataNum, dataset);
             plot.mapDatasetToRangeAxis(dataNum, axisNum);
-            plot.setRenderer(dataNum, renderer);
+           plot.setRenderer(dataNum, renderer);
+//                 renderer.setSeriesVisible(0, false);
         }
     }
 
index d6891ffa04d33e7bb719b4cbd449700b582deddd..43cfb27b12833af469f9a03805c01f540807dd22 100644 (file)
@@ -38,6 +38,15 @@ public class AltosGraphUI extends AltosUIFrame
                 } 
             };
     
+        AltosGraphTime.Element gps_height = 
+               new AltosGraphTime.TimeSeries("Height", AltosConvert.height.show_units(), "GPS Height (AGL)", magenta) {
+                public void gotTimeData(double time, AltosDataPoint d) {
+                       double  height = d.gps_height();
+                       if (height != AltosRecord.MISSING)
+                               series.add(time, AltosConvert.height.value(height));
+                } 
+            };
+    
         AltosGraphTime.Element speed =
                new AltosGraphTime.TimeSeries("Speed", AltosConvert.speed.show_units(), "Vertical Speed", green) { 
                 public void gotTimeData(double time, AltosDataPoint d) {
@@ -113,6 +122,7 @@ public class AltosGraphUI extends AltosUIFrame
     
            graphs.add( myAltosGraphTime("Summary")
                        .addElement(height)
+                       .addElement(gps_height)
                        .addElement(speed)
                        .addElement(acceleration) );