Add option to disable TDOA plot. Add playback of balloon telemetry to log_playback.py

pull/7/head
Mark Jessop 2019-08-21 20:43:07 +09:30
rodzic 87e10b47a8
commit 0939ab30a5
4 zmienionych plików z 54 dodań i 3 usunięć

Wyświetl plik

@ -129,7 +129,7 @@ class Bearings(object):
{'type': 'BEARING', 'bearing_type': 'relative', 'bearing': bearing}
The following optional fields can be provided:
'source': An identifier for the source of the bearings, i.e. 'kerberossdr', 'yagi-1'
'source': An identifier for the source of the bearings, i.e. 'kerberos-sdr', 'yagi-1'
'timestamp': A timestamp of the bearing provided by the source.
'confidence': A confidence value for the bearing, from 0 to [MAX VALUE ??]
'power': A reading of signal power

Wyświetl plik

@ -99,6 +99,48 @@ def send_car_position(json_data, udp_port=55672):
s.sendto(json.dumps(packet), ('127.0.0.1', udp_port))
def send_balloon_telemetry(json_data, udp_port=55672):
""" Grab balloon telemetry data from a JSON log entry and emit it
{"sats": -1,
"log_time": "2019-08-21T11:02:25.596045+00:00",
"temp": -1,
"lon": 138.000000,
"callsign": "HORUS",
"time": "2019-08-21T11:02:16+00:00",
"lat": -34.000000,
"alt": 100,
"log_type": "BALLOON TELEMETRY"}
"""
packet = {
'type' : 'PAYLOAD_SUMMARY',
'latitude' : json_data['lat'],
'longitude' : json_data['lon'],
'altitude': json_data['alt'],
'callsign': json_data['callsign'],
'time': parse(json_data['time']).strftime("%H:%H:%S"),
'comment': "Log Playback"
}
# Set up our UDP socket
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.settimeout(1)
# Set up socket for broadcast, and allow re-use of the address
s.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
try:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
except:
pass
s.bind(('',udp_port))
try:
s.sendto(json.dumps(packet), ('<broadcast>', udp_port))
except socket.error:
s.sendto(json.dumps(packet), ('127.0.0.1', udp_port))
def playback_json(filename, udp_port=55672, speed=1.0):
""" Read in a JSON log file and play it back in real-time, or with a speed factor """

Wyświetl plik

@ -125,8 +125,13 @@ function addBearing(timestamp, bearing, live){
if(_raw_bearing_angles.length > 0){
$("#bearing_table").tabulator("setData", [{id:1, bearing: bearing_store[timestamp].raw_bearing.toFixed(0), confidence: bearing_store[timestamp].confidence.toFixed(0), power: bearing_store[timestamp].power.toFixed(0)}]);
$("#bearing_table").show();
bearingPlotRender(_raw_bearing_angles, _raw_doa);
$('#bearing_plot').show();
if(document.getElementById("tdoaEnabled").checked == true){
bearingPlotRender(_raw_bearing_angles, _raw_doa);
$('#bearing_plot').show();
}else{
$('#bearing_plot').hide();
}
}
}

Wyświetl plik

@ -742,6 +742,10 @@
<b>Bearing-Only Mode</b> <input type="checkbox" class="paramSelector" id="bearingsOnlyMode" onclick='toggleBearingsOnlyMode();'>
</div>
<div class="paramRow">
<b>Enable TDOA Plot</b> <input type="checkbox" class="paramSelector" id="tdoaEnabled" checked>
</div>
<div class="paramRow">
<b>Confidence Threshold</b><input type="text" class="paramEntry" id="bearingConfidenceThreshold" value="50"><br/>
</div>