kopia lustrzana https://github.com/projecthorus/chasemapper
Pass through a few extra fields to the web GUI, and display them.
rodzic
e1c3a2ff39
commit
0f65d8ee7f
|
@ -92,8 +92,10 @@ class GenericTrack(object):
|
|||
# Basic ascent rate case - only 2 samples.
|
||||
_time_delta = (self.track_history[-1][0] - self.track_history[-2][0]).total_seconds()
|
||||
_altitude_delta = self.track_history[-1][3] - self.track_history[-2][3]
|
||||
|
||||
return _altitude_delta/_time_delta
|
||||
|
||||
|
||||
else:
|
||||
_num_samples = min(len(self.track_history), self.ASCENT_AVERAGING)
|
||||
_asc_rates = []
|
||||
|
|
|
@ -66,6 +66,11 @@ car_track = GenericTrack()
|
|||
habitat_uploader = None
|
||||
|
||||
|
||||
# Copy out any extra fields from incoming telemetry that we want to pass on to the GUI.
|
||||
# At the moment we're really only using the burst timer field.
|
||||
EXTRA_FIELDS = ['bt', 'temp', 'humidity', 'sats']
|
||||
|
||||
|
||||
#
|
||||
# Flask Routes
|
||||
#
|
||||
|
@ -173,13 +178,14 @@ def handle_new_payload_position(data):
|
|||
current_payload_tracks[_callsign] = GenericTrack()
|
||||
|
||||
current_payloads[_callsign] = {
|
||||
'telem': {'callsign': _callsign, 'position':[_lat, _lon, _alt], 'vel_v':0.0, 'speed':0.0, 'short_time':_short_time, 'time_to_landing':"", 'server_time':time.time()},
|
||||
'telem': {'callsign': _callsign, 'position':[_lat, _lon, _alt], 'max_alt':0.0, 'vel_v':0.0, 'speed':0.0, 'short_time':_short_time, 'time_to_landing':"", 'server_time':time.time()},
|
||||
'path': [],
|
||||
'pred_path': [],
|
||||
'pred_landing': [],
|
||||
'burst': [],
|
||||
'abort_path': [],
|
||||
'abort_landing': []
|
||||
'abort_landing': [],
|
||||
'max_alt': 0.0
|
||||
}
|
||||
|
||||
# Add new data into the payload's track, and get the latest ascent rate.
|
||||
|
@ -223,10 +229,23 @@ def handle_new_payload_position(data):
|
|||
'speed':_speed,
|
||||
'short_time':_short_time,
|
||||
'time_to_landing': _ttl,
|
||||
'server_time':time.time()}
|
||||
'server_time':time.time()
|
||||
}
|
||||
|
||||
current_payloads[_callsign]['path'].append([_lat, _lon, _alt])
|
||||
|
||||
# Copy out any extra fields we may want to pass onto the GUI.
|
||||
for _field in EXTRA_FIELDS:
|
||||
if _field in data:
|
||||
current_payloads[_callsign]['telem'][_field] = data[_field]
|
||||
|
||||
# Check if the current payload altitude is higher than our previous maximum altitude.
|
||||
if _alt > current_payloads[_callsign]['max_alt']:
|
||||
current_payloads[_callsign]['max_alt'] = _alt
|
||||
|
||||
# Add the payload maximum altitude into the telemetry snapshot dictionary.
|
||||
current_payloads[_callsign]['telem']['max_alt'] = current_payloads[_callsign]['max_alt']
|
||||
|
||||
# Update the web client.
|
||||
flask_emit_event('telemetry_event', current_payloads[_callsign]['telem'])
|
||||
|
||||
|
@ -528,6 +547,11 @@ def udp_listener_summary_callback(data):
|
|||
# Otherwise use the current UTC time.
|
||||
output['time_dt'] = datetime.utcnow()
|
||||
|
||||
# Copy out any extra fields that we want to pass on to the GUI.
|
||||
for _field in EXTRA_FIELDS:
|
||||
if _field in data:
|
||||
output[_field] = data[_field]
|
||||
|
||||
try:
|
||||
handle_new_payload_position(output)
|
||||
except Exception as e:
|
||||
|
|
|
@ -34,7 +34,8 @@ function initTables(){
|
|||
{title:"Latitude", field:"lat", headerSort:false},
|
||||
{title:"Longitude", field:"lon", headerSort:false},
|
||||
{title:"Alt (m)", field:"alt", headerSort:false},
|
||||
{title:"V_rate (m/s)", field:"vel_v", headerSort:false}
|
||||
{title:"V_rate (m/s)", field:"vel_v", headerSort:false},
|
||||
{title:"Aux", field:'aux', headerSort:false}
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -73,9 +74,18 @@ function updateTelemetryTable(){
|
|||
// Modify some of the fields to fixed point values.
|
||||
balloon_call_data.lat = balloon_call_data.position[0].toFixed(5);
|
||||
balloon_call_data.lon = balloon_call_data.position[1].toFixed(5);
|
||||
balloon_call_data.alt = balloon_call_data.position[2].toFixed(1);
|
||||
balloon_call_data.alt = balloon_call_data.position[2].toFixed(1) + " (" + balloon_call_data.max_alt.toFixed(0) + ")" ;
|
||||
balloon_call_data.vel_v = balloon_call_data.vel_v.toFixed(1);
|
||||
|
||||
// Add in any extra data to the aux field.
|
||||
balloon_call_data.aux = "";
|
||||
|
||||
if (balloon_call_data.hasOwnProperty('bt')){
|
||||
if ((balloon_call_data.bt >= 0) && (balloon_call_data.bt < 65535)) {
|
||||
balloon_call_data.aux += "BT " + new Date(balloon_call_data.bt*1000).toISOString().substr(11, 8) + " ";
|
||||
}
|
||||
}
|
||||
|
||||
// Update table
|
||||
telem_data.push(balloon_call_data);
|
||||
}
|
||||
|
|
|
@ -479,7 +479,7 @@
|
|||
// There is balloon data!
|
||||
var _latest_telem = balloon_positions[balloon_currently_following].latest_data;
|
||||
|
||||
_summary_update.alt = _latest_telem.position[2].toFixed(0) + "m";
|
||||
_summary_update.alt = _latest_telem.position[2].toFixed(0) + "m (" + _latest_telem.max_alt.toFixed(0) + ")";
|
||||
var _speed = _latest_telem.speed*3.6;
|
||||
_summary_update.speed = _speed.toFixed(0) + " kph";
|
||||
_summary_update.vel_v = _latest_telem.vel_v.toFixed(1) + " m/s";
|
||||
|
@ -530,7 +530,7 @@
|
|||
|
||||
if(initial_load_complete == false){
|
||||
// If we have not completed our initial load of telemetry data, discard this data.
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle chase car position updates.
|
||||
|
@ -603,7 +603,7 @@
|
|||
}
|
||||
|
||||
if (data.position[2] < parachute_min_alt){
|
||||
balloon_positions[data.callsign].marker.setIcon(balloonPayloadIcons[balloon_positions[callsign].colour]);
|
||||
balloon_positions[data.callsign].marker.setIcon(balloonPayloadIcons[balloon_positions[data.callsign].colour]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue