kopia lustrzana https://github.com/projecthorus/chasemapper
Tweaks to help with replaying log data
rodzic
21bc0b7a94
commit
a758375e82
|
@ -8,4 +8,4 @@
|
|||
|
||||
# Now using Semantic Versioning (https://semver.org/) MAJOR.MINOR.PATCH
|
||||
|
||||
__version__ = "1.3.4"
|
||||
__version__ = "1.3.5"
|
||||
|
|
|
@ -863,6 +863,12 @@ def udp_listener_car_callback(data):
|
|||
"speed": _speed,
|
||||
}
|
||||
|
||||
if 'replay_time' in data:
|
||||
# We are getting data from a log file replay, make sure to pass this on
|
||||
_replay_time = parse(data['replay_time'])
|
||||
_replay_time_str = _replay_time.strftime("%Y-%m-%d %H:%M:%SZ")
|
||||
_car_telem['replay_time'] = _replay_time_str
|
||||
|
||||
# Add in some additional status fields if we have them.
|
||||
if 'numSV' in data:
|
||||
_car_telem['numSV'] = data['numSV']
|
||||
|
|
|
@ -36,16 +36,18 @@ def send_bearing(json_data, udp_port=55672, hostname='<broadcast>'):
|
|||
"type": "BEARING",
|
||||
"log_type": "BEARING"}
|
||||
"""
|
||||
packet = {
|
||||
'type' : 'BEARING',
|
||||
'bearing' : int(json_data['bearing']),
|
||||
'confidence': int(json_data['confidence']),
|
||||
'power': int(json_data['power']),
|
||||
'raw_bearing_angles': [int(x) for x in json_data['raw_bearing_angles']],
|
||||
'raw_doa': [round(x,2) for x in json_data['raw_doa']],
|
||||
'bearing_type': 'relative',
|
||||
'source': 'playback'
|
||||
}
|
||||
# Also get bearings of form:
|
||||
# {"type": "BEARING", "bearing_type": "absolute", "source": "EasyBearing", "latitude": -34.9016115,
|
||||
#"longitude": 138.58986819999998, "bearing": 0, "log_type": "BEARING", "log_time": "2021-12-10T07:33:14.156227+00:00"}
|
||||
|
||||
packet = json_data
|
||||
|
||||
packet['replay_time'] = json_data['log_time']
|
||||
|
||||
if 'kerberos' in json_data['source']:
|
||||
# Log data from the kerberos has been flipped in bearing already. Need to make sure this isn't done twice.
|
||||
packet['source'] = 'replay'
|
||||
|
||||
|
||||
# Set up our UDP socket
|
||||
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
|
||||
|
@ -88,7 +90,8 @@ def send_car_position(json_data, udp_port=55672):
|
|||
'longitude' : json_data['lon'],
|
||||
'altitude': json_data['alt'],
|
||||
'speed': json_data['speed'],
|
||||
'valid': True
|
||||
'valid': True,
|
||||
'replay_time': json_data['log_time']
|
||||
}
|
||||
|
||||
if 'heading' in json_data:
|
||||
|
@ -133,7 +136,8 @@ def send_balloon_telemetry(json_data, udp_port=55672):
|
|||
'altitude': json_data['alt'],
|
||||
'callsign': json_data['callsign'],
|
||||
'time': parse(json_data['time']).strftime("%H:%H:%S"),
|
||||
'comment': "Log Playback"
|
||||
'comment': "Log Playback",
|
||||
'replay_time': json_data['log_time']
|
||||
}
|
||||
|
||||
# Set up our UDP socket
|
||||
|
@ -191,11 +195,11 @@ def playback_json(filename, udp_port=55672, speed=1.0, start_time = 0, hostname=
|
|||
|
||||
if _log_data['log_type'] == 'CAR POSITION':
|
||||
send_car_position(_log_data, udp_port)
|
||||
print("%02d:%.2f - Car Position" % (_time_min, _time_sec))
|
||||
print("%s - %02d:%.2f - Car Position" % (_log_data['log_time'], _time_min, _time_sec))
|
||||
|
||||
elif _log_data['log_type'] == 'BEARING':
|
||||
send_bearing(_log_data, udp_port, hostname=hostname)
|
||||
print("%02d:%.2f - Bearing Data" % (_time_min, _time_sec))
|
||||
print("%s - %02d:%.2f - Bearing Data" % (_log_data['log_time'], _time_min, _time_sec))
|
||||
|
||||
elif _log_data['log_type'] == 'BALLOON TELEMETRY':
|
||||
send_balloon_telemetry(_log_data, udp_port)
|
||||
|
|
|
@ -74,6 +74,12 @@ html, body, #map {
|
|||
font-size:3em;
|
||||
}
|
||||
|
||||
.logTimeData {
|
||||
color:black;
|
||||
font-weight: bold;
|
||||
font-size:3em;
|
||||
}
|
||||
|
||||
.bearingData {
|
||||
color:red;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -269,6 +269,11 @@ function handleTelemetry(data){
|
|||
$("#chase_car_speed_header").text("");
|
||||
}
|
||||
|
||||
if(data.hasOwnProperty('replay_time')){
|
||||
// Data is coming from a log file, display the time.
|
||||
$("#log_time").text(data.replay_time);
|
||||
}
|
||||
|
||||
// Update heading information
|
||||
if (document.getElementById("showCarHeading").checked){
|
||||
$("#chase_car_heading").text(chase_car_position.heading.toFixed(0) + "˚");
|
||||
|
|
|
@ -441,6 +441,21 @@
|
|||
})
|
||||
.addTo(map);
|
||||
|
||||
// Used to show log replay time information, if received.
|
||||
L.control.custom({
|
||||
position: 'bottomcenter',
|
||||
content : "<div id='log_time' class='chaseCarSpeed'></div>",
|
||||
classes : 'btn-group-vertical btn-group-sm',
|
||||
id: 'log_time_control',
|
||||
style :
|
||||
{
|
||||
margin: '5px',
|
||||
padding: '0px 0 0 0',
|
||||
cursor: 'pointer',
|
||||
}
|
||||
})
|
||||
.addTo(map);
|
||||
|
||||
|
||||
|
||||
// Follow buttons - these just set the radio buttons on the settings pane.
|
||||
|
|
Ładowanie…
Reference in New Issue