projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altosui: Don't display missing sensor data
[fw/altos]
/
altoslib
/
AltosState.java
diff --git
a/altoslib/AltosState.java
b/altoslib/AltosState.java
index 32d02f21d1923ba934cb756e7d013196aac3ec6d..f18bf368c22e3314962cfa3c329cef2c190c12d1 100644
(file)
--- a/
altoslib/AltosState.java
+++ b/
altoslib/AltosState.java
@@
-99,19
+99,27
@@
public class AltosState {
altitude = data.altitude();
altitude = data.altitude();
+ height = AltosRecord.MISSING;
if (data.kalman_height != AltosRecord.MISSING)
height = data.kalman_height;
else {
if (data.kalman_height != AltosRecord.MISSING)
height = data.kalman_height;
else {
- if (prev_state != null)
- height = (prev_state.height * 15 + altitude - ground_altitude) / 16.0;
+ if (prev_state != null && altitude != AltosRecord.MISSING && ground_altitude != AltosRecord.MISSING) {
+ double cur_height = altitude - ground_altitude;
+ if (prev_state.height == AltosRecord.MISSING)
+ height = cur_height;
+ else
+ height = (prev_state.height * 15 + cur_height) / 16.0;
+ }
}
report_time = System.currentTimeMillis();
if (data.kalman_acceleration != AltosRecord.MISSING)
acceleration = data.kalman_acceleration;
}
report_time = System.currentTimeMillis();
if (data.kalman_acceleration != AltosRecord.MISSING)
acceleration = data.kalman_acceleration;
- else
+ else
{
acceleration = data.acceleration();
acceleration = data.acceleration();
+ System.out.printf ("data acceleration %g\n", acceleration);
+ }
temperature = data.temperature();
drogue_sense = data.drogue_voltage();
main_sense = data.main_voltage();
temperature = data.temperature();
drogue_sense = data.drogue_voltage();
main_sense = data.main_voltage();
@@
-169,16
+177,18
@@
public class AltosState {
npad = 0;
ngps = 0;
gps = null;
npad = 0;
ngps = 0;
gps = null;
- baro_speed = 0;
- accel_speed = 0;
+ baro_speed = AltosRecord.MISSING;
+ accel_speed = AltosRecord.MISSING;
+ max_baro_speed = AltosRecord.MISSING;
+ max_accel_speed = AltosRecord.MISSING;
+ max_height = AltosRecord.MISSING;
+ max_acceleration = AltosRecord.MISSING;
time_change = 0;
time_change = 0;
- if (acceleration == AltosRecord.MISSING)
- acceleration = 0;
}
time = tick / 100.0;
}
time = tick / 100.0;
- if (cur.new_gps && (state
== AltosLib.ao_flight_pad || state == AltosLib.ao_flight_idle
)) {
+ if (cur.new_gps && (state
< AltosLib.ao_flight_boost
)) {
/* Track consecutive 'good' gps reports, waiting for 10 of them */
if (data.gps != null && data.gps.locked && data.gps.nsat >= 4)
/* Track consecutive 'good' gps reports, waiting for 10 of them */
if (data.gps != null && data.gps.locked && data.gps.nsat >= 4)
@@
-188,7
+198,7
@@
public class AltosState {
/* Average GPS data while on the pad */
if (data.gps != null && data.gps.locked && data.gps.nsat >= 4) {
/* Average GPS data while on the pad */
if (data.gps != null && data.gps.locked && data.gps.nsat >= 4) {
- if (ngps > 1) {
+ if (ngps > 1
&& state == AltosLib.ao_flight_pad
) {
/* filter pad position */
pad_lat = (pad_lat * 31.0 + data.gps.lat) / 32.0;
pad_lon = (pad_lon * 31.0 + data.gps.lon) / 32.0;
/* filter pad position */
pad_lat = (pad_lat * 31.0 + data.gps.lat) / 32.0;
pad_lon = (pad_lon * 31.0 + data.gps.lon) / 32.0;
@@
-201,10
+211,12
@@
public class AltosState {
ngps++;
}
} else {
ngps++;
}
} else {
- if (ngps == 0)
+ if (ngps == 0
&& ground_altitude != AltosRecord.MISSING
)
pad_alt = ground_altitude;
}
pad_alt = ground_altitude;
}
+ data.new_gps = false;
+
gps_waiting = MIN_PAD_SAMPLES - npad;
if (gps_waiting < 0)
gps_waiting = 0;
gps_waiting = MIN_PAD_SAMPLES - npad;
if (gps_waiting < 0)
gps_waiting = 0;
@@
-216,14
+228,14
@@
public class AltosState {
boost = (AltosLib.ao_flight_boost == state);
/* Only look at accelerometer data under boost */
boost = (AltosLib.ao_flight_boost == state);
/* Only look at accelerometer data under boost */
- if (boost && acceleration
> max_acceleration && acceleration != AltosRecord.MISSING
)
+ if (boost && acceleration
!= AltosRecord.MISSING && (max_acceleration == AltosRecord.MISSING || acceleration > max_acceleration)
)
max_acceleration = acceleration;
max_acceleration = acceleration;
- if (boost && accel_speed
> max_accel_speed && accel_speed != AltosRecord.MISSING
)
+ if (boost && accel_speed
!= AltosRecord.MISSING && (max_accel_speed == AltosRecord.MISSING || accel_speed > max_accel_speed)
)
max_accel_speed = accel_speed;
max_accel_speed = accel_speed;
- if (boost && baro_speed
> max_baro_speed && baro_speed != AltosRecord.MISSING
)
+ if (boost && baro_speed
!= AltosRecord.MISSING && (max_baro_speed == AltosRecord.MISSING || baro_speed > max_baro_speed)
)
max_baro_speed = baro_speed;
max_baro_speed = baro_speed;
- if (height
> max_height && height != AltosRecord.MISSING
)
+ if (height
!= AltosRecord.MISSING || (max_height == AltosRecord.MISSING || height > max_height)
)
max_height = height;
if (data.gps != null) {
if (gps == null || !gps.locked || data.gps.locked)
max_height = height;
if (data.gps != null) {
if (gps == null || !gps.locked || data.gps.locked)