projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altosui: Store libaltos.so in $(libdir)/altos
[fw/altos]
/
ao-tools
/
altosui
/
AltosState.java
diff --git
a/ao-tools/altosui/AltosState.java
b/ao-tools/altosui/AltosState.java
index fc06f839c5f0b22ed946f5e529a9c2ca198217eb..3ef00f35d7d87375cf4967553f5e28c3bdd6edd6 100644
(file)
--- a/
ao-tools/altosui/AltosState.java
+++ b/
ao-tools/altosui/AltosState.java
@@
-64,6
+64,8
@@
public class AltosState {
boolean gps_ready;
AltosGreatCircle from_pad;
boolean gps_ready;
AltosGreatCircle from_pad;
+ double elevation; /* from pad */
+ double range; /* total distance */
double gps_height;
double gps_height;
@@
-89,7
+91,7
@@
public class AltosState {
main_sense = data.main_voltage();
battery = data.battery_voltage();
tick = data.tick;
main_sense = data.main_voltage();
battery = data.battery_voltage();
tick = data.tick;
- state = data.state
()
;
+ state = data.state;
if (prev_state != null) {
if (prev_state != null) {
@@
-124,7
+126,7
@@
public class AltosState {
}
if (state == Altos.ao_flight_pad) {
}
if (state == Altos.ao_flight_pad) {
- if (data.gps != null && data.gps.
gps_locked && data.gps.nsat >= 4
) {
+ if (data.gps != null && data.gps.
locked
) {
npad++;
if (npad > 1) {
/* filter pad position */
npad++;
if (npad > 1) {
/* filter pad position */
@@
-159,13
+161,20
@@
public class AltosState {
if (height > max_height)
max_height = height;
if (data.gps != null) {
if (height > max_height)
max_height = height;
if (data.gps != null) {
- if (gps == null || !gps.
gps_locked || data.gps.gps_
locked)
+ if (gps == null || !gps.
locked || data.gps.
locked)
gps = data.gps;
gps = data.gps;
- if (npad > 0 && gps.
gps_locked)
+ if (npad > 0 && gps.
locked) {
from_pad = new AltosGreatCircle(pad_lat, pad_lon, gps.lat, gps.lon);
from_pad = new AltosGreatCircle(pad_lat, pad_lon, gps.lat, gps.lon);
+ }
}
}
+ elevation = 0;
+ range = -1;
if (npad > 0) {
gps_height = gps.alt - pad_alt;
if (npad > 0) {
gps_height = gps.alt - pad_alt;
+ if (from_pad != null) {
+ elevation = Math.atan2(height, from_pad.distance) * 180 / Math.PI;
+ range = Math.sqrt(height * height + from_pad.distance * from_pad.distance);
+ }
} else {
gps_height = 0;
}
} else {
gps_height = 0;
}