summaryrefslogtreecommitdiff
path: root/altosuilib
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-05-25 22:36:05 -0700
committerKeith Packard <keithp@keithp.com>2017-05-25 22:37:22 -0700
commit222158581887b5f9e8b9843d14321c313fa023fa (patch)
tree4baab1916948932f9c5eff5960d685b58d62f470 /altosuilib
parent4d497c1be534e2b206edec3c096198c8ea64cebe (diff)
altoslib/altosuilib/altosui: More work towards using AltosFlightSeries for analysis
Graphing and CSV seem complete now; stats still missing lots of stuff. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosuilib')
-rw-r--r--altosuilib/AltosGraphNew.java377
-rw-r--r--altosuilib/AltosUIFlightSeries.java15
-rw-r--r--altosuilib/AltosUITimeSeries.java15
3 files changed, 138 insertions, 269 deletions
diff --git a/altosuilib/AltosGraphNew.java b/altosuilib/AltosGraphNew.java
index dc5b7e47..a9393f94 100644
--- a/altosuilib/AltosGraphNew.java
+++ b/altosuilib/AltosGraphNew.java
@@ -52,6 +52,8 @@ public class AltosGraphNew extends AltosUIGraphNew {
static final private Color battery_voltage_color = new Color(194, 194, 31);
static final private Color drogue_voltage_color = new Color(150, 150, 31);
static final private Color main_voltage_color = new Color(100, 100, 31);
+ static final private Color igniter_voltage_color = new Color(80, 80, 31);
+ static final private Color igniter_marker_color = new Color(255, 0, 0);
static final private Color gps_nsat_color = new Color (194, 31, 194);
static final private Color gps_nsat_solution_color = new Color (194, 31, 194);
static final private Color gps_nsat_view_color = new Color (150, 31, 150);
@@ -65,25 +67,17 @@ public class AltosGraphNew extends AltosUIGraphNew {
static final private Color temperature_color = new Color (31, 194, 194);
static final private Color dbm_color = new Color(31, 100, 100);
static final private Color state_color = new Color(0,0,0);
- static final private Color accel_x_color = new Color(255, 0, 0);
- static final private Color accel_y_color = new Color(0, 255, 0);
- static final private Color accel_z_color = new Color(0, 0, 255);
- static final private Color gyro_x_color = new Color(192, 0, 0);
- static final private Color gyro_y_color = new Color(0, 192, 0);
- static final private Color gyro_z_color = new Color(0, 0, 192);
- static final private Color mag_x_color = new Color(128, 0, 0);
- static final private Color mag_y_color = new Color(0, 128, 0);
- static final private Color mag_z_color = new Color(0, 0, 128);
+ static final private Color accel_along_color = new Color(255, 0, 0);
+ static final private Color accel_across_color = new Color(0, 255, 0);
+ static final private Color accel_through_color = new Color(0, 0, 255);
+ static final private Color gyro_roll_color = new Color(192, 0, 0);
+ static final private Color gyro_pitch_color = new Color(0, 192, 0);
+ static final private Color gyro_yaw_color = new Color(0, 0, 192);
+ static final private Color mag_along_color = new Color(128, 0, 0);
+ static final private Color mag_across_color = new Color(0, 128, 0);
+ static final private Color mag_through_color = new Color(0, 0, 128);
static final private Color orient_color = new Color(31, 31, 31);
-// static AltosNsat nsat_units = new AltosNsat();
- static AltosUnits nsat_units = null;
-// static AltosDbm dbm_units = new AltosDbm();
- static AltosUnits dbm_units = null;
- static AltosOrient orient_units = new AltosOrient();
-// static AltosMagUnits mag_units = new AltosMagUnits();
- static AltosUnits mag_units = null;
-// static AltosDopUnits dop_units = new AltosDopUnits();
static AltosUnits dop_units = null;
AltosUIFlightSeries flight_series;
@@ -102,15 +96,15 @@ public class AltosGraphNew extends AltosUIGraphNew {
accel_axis = newAxis("Acceleration", AltosConvert.accel, accel_color);
voltage_axis = newAxis("Voltage", AltosConvert.voltage, voltage_color);
temperature_axis = newAxis("Temperature", AltosConvert.temperature, temperature_color, 0);
- nsat_axis = newAxis("Satellites", nsat_units, gps_nsat_color,
+ nsat_axis = newAxis("Satellites", null, gps_nsat_color,
AltosUIAxis.axis_include_zero | AltosUIAxis.axis_integer);
- dbm_axis = newAxis("Signal Strength", dbm_units, dbm_color, 0);
+ dbm_axis = newAxis("Signal Strength", null, dbm_color, 0);
distance_axis = newAxis("Distance", AltosConvert.distance, range_color);
- gyro_axis = newAxis("Rotation Rate", AltosConvert.rotation_rate, gyro_z_color, 0);
- orient_axis = newAxis("Tilt Angle", orient_units, orient_color, 0);
- mag_axis = newAxis("Magnetic Field", mag_units, mag_x_color, 0);
- course_axis = newAxis("Course", orient_units, gps_course_color, 0);
+ gyro_axis = newAxis("Rotation Rate", AltosConvert.rotation_rate, gyro_roll_color, 0);
+ orient_axis = newAxis("Tilt Angle", AltosConvert.orient, orient_color, 0);
+ mag_axis = newAxis("Magnetic Field", AltosConvert.magnetic_field, mag_along_color, 0);
+ course_axis = newAxis("Course", AltosConvert.orient, gps_course_color, 0);
dop_axis = newAxis("Dilution of Precision", dop_units, gps_pdop_color, 0);
flight_series.register_axis("default",
@@ -121,7 +115,14 @@ public class AltosGraphNew extends AltosUIGraphNew {
flight_series.register_marker(AltosUIFlightSeries.state_name,
state_color,
true,
- plot);
+ plot,
+ true);
+
+ flight_series.register_marker(AltosUIFlightSeries.pyro_fired_name,
+ igniter_marker_color,
+ true,
+ plot,
+ false);
flight_series.register_axis(AltosUIFlightSeries.accel_name,
accel_color,
@@ -164,17 +165,50 @@ public class AltosGraphNew extends AltosUIGraphNew {
height_axis);
+ flight_series.register_axis(AltosUIFlightSeries.temperature_name,
+ temperature_color,
+ false,
+ temperature_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.battery_voltage_name,
+ battery_voltage_color,
+ false,
+ voltage_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.apogee_voltage_name,
+ drogue_voltage_color,
+ false,
+ voltage_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.main_voltage_name,
+ main_voltage_color,
+ false,
+ voltage_axis);
+
flight_series.register_axis(AltosUIFlightSeries.sats_in_view_name,
gps_nsat_view_color,
false,
nsat_axis);
-
flight_series.register_axis(AltosUIFlightSeries.sats_in_soln_name,
gps_nsat_solution_color,
false,
nsat_axis);
+ flight_series.register_axis(AltosUIFlightSeries.gps_pdop_name,
+ gps_pdop_color,
+ false,
+ dop_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.gps_hdop_name,
+ gps_hdop_color,
+ false,
+ dop_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.gps_vdop_name,
+ gps_vdop_color,
+ false,
+ dop_axis);
flight_series.register_axis(AltosUIFlightSeries.gps_altitude_name,
gps_height_color,
@@ -191,13 +225,11 @@ public class AltosGraphNew extends AltosUIGraphNew {
false,
speed_axis);
-
flight_series.register_axis(AltosUIFlightSeries.gps_ascent_rate_name,
gps_climb_rate_color,
false,
speed_axis);
-
flight_series.register_axis(AltosUIFlightSeries.gps_course_name,
gps_course_color,
false,
@@ -208,246 +240,69 @@ public class AltosGraphNew extends AltosUIGraphNew {
false,
speed_axis);
+ flight_series.register_axis(AltosUIFlightSeries.accel_along_name,
+ accel_along_color,
+ false,
+ accel_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.accel_across_name,
+ accel_across_color,
+ false,
+ accel_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.accel_through_name,
+ accel_through_color,
+ false,
+ accel_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.gyro_roll_name,
+ gyro_roll_color,
+ false,
+ gyro_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.gyro_pitch_name,
+ gyro_pitch_color,
+ false,
+ gyro_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.gyro_yaw_name,
+ gyro_yaw_color,
+ false,
+ gyro_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.mag_along_name,
+ mag_along_color,
+ false,
+ mag_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.mag_across_name,
+ mag_across_color,
+ false,
+ mag_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.mag_through_name,
+ mag_through_color,
+ false,
+ mag_axis);
+
+ flight_series.register_axis(AltosUIFlightSeries.orient_name,
+ orient_color,
+ false,
+ orient_axis);
+
+ for (int channel = 0; channel < 26; channel++) {
+ flight_series.register_axis(flight_series.igniter_voltage_name(channel),
+ igniter_voltage_color,
+ false,
+ voltage_axis);
+ }
+
flight_series.register_axis(AltosUIFlightSeries.thrust_name,
thrust_color,
true,
thrust_axis);
-// addMarker("State", AltosGraphDataPoint.data_state, state_color);
-
return flight_series.series(cal_data);
-/*
- if (stats.has_flight_data) {
- addSeries("Height",
- AltosGraphDataPoint.data_height,
- AltosConvert.height,
- height_color,
- true,
- height_axis);
- addSeries("Pressure",
- AltosGraphDataPoint.data_pressure,
- pressure_units,
- pressure_color,
- false,
- pressure_axis);
- addSeries("Thrust",
- AltosGraphDataPoint.data_thrust,
- thrust_units,
- thrust_color,
- false,
- thrust_axis);
- addSeries("Speed",
- AltosGraphDataPoint.data_speed,
- AltosConvert.speed,
- speed_color,
- true,
- speed_axis);
- addSeries("Acceleration",
- AltosGraphDataPoint.data_accel,
- AltosConvert.accel,
- accel_color,
- true,
- accel_axis);
- }
- if (stats.has_gps) {
- boolean enable_gps = false;
-
- if (!stats.has_flight_data)
- enable_gps = true;
-
- addSeries("Range",
- AltosGraphDataPoint.data_range,
- AltosConvert.distance,
- range_color,
- false,
- distance_axis);
- addSeries("Distance",
- AltosGraphDataPoint.data_distance,
- AltosConvert.distance,
- distance_color,
- enable_gps,
- distance_axis);
- addSeries("GPS Height",
- AltosGraphDataPoint.data_gps_height,
- AltosConvert.height,
- gps_height_color,
- enable_gps,
- height_axis);
- addSeries("GPS Altitude",
- AltosGraphDataPoint.data_gps_altitude,
- AltosConvert.height,
- gps_height_color,
- false,
- height_axis);
- addSeries("GPS Satellites in Solution",
- AltosGraphDataPoint.data_gps_nsat_solution,
- nsat_units,
- gps_nsat_solution_color,
- false,
- nsat_axis);
- if (stats.has_gps_sats) {
- addSeries("GPS Satellites in View",
- AltosGraphDataPoint.data_gps_nsat_view,
- nsat_units,
- gps_nsat_view_color,
- false,
- nsat_axis);
- }
- if (stats.has_gps_detail) {
- addSeries("GPS Course",
- AltosGraphDataPoint.data_gps_course,
- orient_units,
- gps_course_color,
- false,
- course_axis);
- addSeries("GPS Ground Speed",
- AltosGraphDataPoint.data_gps_ground_speed,
- AltosConvert.speed,
- gps_ground_speed_color,
- enable_gps,
- speed_axis);
- addSeries("GPS Climb Rate",
- AltosGraphDataPoint.data_gps_climb_rate,
- AltosConvert.speed,
- gps_climb_rate_color,
- enable_gps,
- speed_axis);
- }
- addSeries("GPS Position DOP",
- AltosGraphDataPoint.data_gps_pdop,
- dop_units,
- gps_pdop_color,
- false,
- dop_axis);
- if (stats.has_gps_detail) {
- addSeries("GPS Horizontal DOP",
- AltosGraphDataPoint.data_gps_hdop,
- dop_units,
- gps_hdop_color,
- false,
- dop_axis);
- addSeries("GPS Vertical DOP",
- AltosGraphDataPoint.data_gps_vdop,
- dop_units,
- gps_vdop_color,
- false,
- dop_axis);
- }
- }
- if (stats.has_rssi)
- addSeries("Received Signal Strength",
- AltosGraphDataPoint.data_rssi,
- dbm_units,
- dbm_color,
- false,
- dbm_axis);
-
- if (stats.has_battery)
- addSeries("Battery Voltage",
- AltosGraphDataPoint.data_battery_voltage,
- voltage_units,
- battery_voltage_color,
- false,
- voltage_axis);
-
- if (stats.has_flight_adc) {
- addSeries("Temperature",
- AltosGraphDataPoint.data_temperature,
- AltosConvert.temperature,
- temperature_color,
- false,
- temperature_axis);
- addSeries("Drogue Voltage",
- AltosGraphDataPoint.data_drogue_voltage,
- voltage_units,
- drogue_voltage_color,
- false,
- voltage_axis);
- addSeries("Main Voltage",
- AltosGraphDataPoint.data_main_voltage,
- voltage_units,
- main_voltage_color,
- false,
- voltage_axis);
- }
-
- if (stats.has_imu) {
- addSeries("Acceleration Along",
- AltosGraphDataPoint.data_accel_along,
- AltosConvert.accel,
- accel_x_color,
- false,
- accel_axis);
- addSeries("Acceleration Across",
- AltosGraphDataPoint.data_accel_across,
- AltosConvert.accel,
- accel_y_color,
- false,
- accel_axis);
- addSeries("Acceleration Through",
- AltosGraphDataPoint.data_accel_through,
- AltosConvert.accel,
- accel_z_color,
- false,
- accel_axis);
- addSeries("Roll Rate",
- AltosGraphDataPoint.data_gyro_roll,
- gyro_units,
- gyro_x_color,
- false,
- gyro_axis);
- addSeries("Pitch Rate",
- AltosGraphDataPoint.data_gyro_pitch,
- gyro_units,
- gyro_y_color,
- false,
- gyro_axis);
- addSeries("Yaw Rate",
- AltosGraphDataPoint.data_gyro_yaw,
- gyro_units,
- gyro_z_color,
- false,
- gyro_axis);
- }
- if (stats.has_mag) {
- addSeries("Magnetometer Along",
- AltosGraphDataPoint.data_mag_along,
- mag_units,
- mag_x_color,
- false,
- mag_axis);
- addSeries("Magnetometer Across",
- AltosGraphDataPoint.data_mag_across,
- mag_units,
- mag_y_color,
- false,
- mag_axis);
- addSeries("Magnetometer Through",
- AltosGraphDataPoint.data_mag_through,
- mag_units,
- mag_z_color,
- false,
- mag_axis);
- }
- if (stats.has_orient)
- addSeries("Tilt Angle",
- AltosGraphDataPoint.data_orient,
- orient_units,
- orient_color,
- false,
- orient_axis);
- if (stats.num_ignitor > 0) {
- for (int i = 0; i < stats.num_ignitor; i++)
- addSeries(AltosLib.ignitor_name(i),
- AltosGraphDataPoint.data_ignitor_0 + i,
- voltage_units,
- main_voltage_color,
- false,
- voltage_axis);
- for (int i = 0; i < stats.num_ignitor; i++)
- addMarker(AltosLib.ignitor_name(i), AltosGraphDataPoint.data_ignitor_fired_0 + i, state_color);
- }
-*/
}
public AltosGraphNew(AltosUIEnable enable, AltosFlightStats stats, AltosUIFlightSeries flight_series, AltosCalData cal_data) {
diff --git a/altosuilib/AltosUIFlightSeries.java b/altosuilib/AltosUIFlightSeries.java
index 1840761e..0bcc8a6e 100644
--- a/altosuilib/AltosUIFlightSeries.java
+++ b/altosuilib/AltosUIFlightSeries.java
@@ -33,15 +33,17 @@ class AltosUITimeSeriesAxis {
Color color;
boolean enabled;
boolean marker;
+ boolean marker_top;
AltosUIAxis axis;
XYPlot plot;
- public AltosUITimeSeriesAxis(Color color, boolean enabled, AltosUIAxis axis, XYPlot plot, boolean marker) {
+ public AltosUITimeSeriesAxis(Color color, boolean enabled, AltosUIAxis axis, XYPlot plot, boolean marker, boolean marker_top) {
this.color = color;
this.enabled = enabled;
this.axis = axis;
this.plot = plot;
this.marker = marker;
+ this.marker_top = marker_top;
}
}
@@ -57,7 +59,7 @@ public class AltosUIFlightSeries extends AltosFlightSeries {
if (label.equals(ts.label) || (label.equals("default") && uts.color == null)) {
if (axis.marker)
- uts.set_marker(axis.color, axis.enabled, axis.plot);
+ uts.set_marker(axis.color, axis.enabled, axis.plot, axis.marker_top);
else
uts.set_axis(axis.color, axis.enabled, axis.axis);
}
@@ -72,6 +74,7 @@ public class AltosUIFlightSeries extends AltosFlightSeries {
enabled,
axis,
null,
+ false,
false);
axes.put(label, tsa);
fill_axes(label, tsa);
@@ -80,12 +83,14 @@ public class AltosUIFlightSeries extends AltosFlightSeries {
public void register_marker(String label,
Color color,
boolean enabled,
- XYPlot plot) {
+ XYPlot plot,
+ boolean marker_top) {
AltosUITimeSeriesAxis tsa = new AltosUITimeSeriesAxis(color,
enabled,
null,
plot,
- true);
+ true,
+ marker_top);
axes.put(label, tsa);
fill_axes(label, tsa);
}
@@ -100,7 +105,7 @@ public class AltosUIFlightSeries extends AltosFlightSeries {
tsa = axes.get("default");
if (tsa != null) {
if (tsa.marker)
- time_series.set_marker(tsa.color, tsa.enabled, tsa.plot);
+ time_series.set_marker(tsa.color, tsa.enabled, tsa.plot, tsa.marker_top);
else
time_series.set_axis(tsa.color, tsa.enabled, tsa.axis);
}
diff --git a/altosuilib/AltosUITimeSeries.java b/altosuilib/AltosUITimeSeries.java
index 0f5e35eb..7c48264e 100644
--- a/altosuilib/AltosUITimeSeries.java
+++ b/altosuilib/AltosUITimeSeries.java
@@ -47,6 +47,7 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher
boolean enable;
AltosUIAxis axis;
boolean marker;
+ boolean marker_top;
XYItemRenderer renderer;
XYPlot plot;
AltosXYSeries xy_series;
@@ -81,8 +82,13 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher
String s = units.string_value(v.value);
ValueMarker marker = new ValueMarker(v.time);
marker.setLabel(s);
- marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
- marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
+ if (marker_top) {
+ marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+ marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
+ } else {
+ marker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT);
+ marker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
+ }
marker.setPaint(color);
if (enable)
plot.addDomainMarker(marker);
@@ -91,12 +97,14 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher
} else {
xy_series.clear();
+ xy_series.setNotify(false);
for (AltosTimeValue v : this) {
double value = v.value;
if (units != null)
value = units.graph_value(value);
xy_series.add(v.time, value);
}
+ xy_series.setNotify(true);
}
}
@@ -153,11 +161,12 @@ public class AltosUITimeSeries extends AltosTimeSeries implements AltosUIGrapher
xy_series = new AltosXYSeries(label);
}
- public void set_marker(Color color, boolean enable, XYPlot plot) {
+ public void set_marker(Color color, boolean enable, XYPlot plot, boolean marker_top) {
this.color = color;
this.enable = enable;
this.marker = true;
this.plot = plot;
+ this.marker_top = marker_top;
}
public AltosUITimeSeries(String label, AltosUnits units) {