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
|
# 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,
|
"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.
|
# Add in some additional status fields if we have them.
|
||||||
if 'numSV' in data:
|
if 'numSV' in data:
|
||||||
_car_telem['numSV'] = data['numSV']
|
_car_telem['numSV'] = data['numSV']
|
||||||
|
|
|
@ -36,16 +36,18 @@ def send_bearing(json_data, udp_port=55672, hostname='<broadcast>'):
|
||||||
"type": "BEARING",
|
"type": "BEARING",
|
||||||
"log_type": "BEARING"}
|
"log_type": "BEARING"}
|
||||||
"""
|
"""
|
||||||
packet = {
|
# Also get bearings of form:
|
||||||
'type' : 'BEARING',
|
# {"type": "BEARING", "bearing_type": "absolute", "source": "EasyBearing", "latitude": -34.9016115,
|
||||||
'bearing' : int(json_data['bearing']),
|
#"longitude": 138.58986819999998, "bearing": 0, "log_type": "BEARING", "log_time": "2021-12-10T07:33:14.156227+00:00"}
|
||||||
'confidence': int(json_data['confidence']),
|
|
||||||
'power': int(json_data['power']),
|
packet = json_data
|
||||||
'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']],
|
packet['replay_time'] = json_data['log_time']
|
||||||
'bearing_type': 'relative',
|
|
||||||
'source': 'playback'
|
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
|
# Set up our UDP socket
|
||||||
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
|
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'],
|
'longitude' : json_data['lon'],
|
||||||
'altitude': json_data['alt'],
|
'altitude': json_data['alt'],
|
||||||
'speed': json_data['speed'],
|
'speed': json_data['speed'],
|
||||||
'valid': True
|
'valid': True,
|
||||||
|
'replay_time': json_data['log_time']
|
||||||
}
|
}
|
||||||
|
|
||||||
if 'heading' in json_data:
|
if 'heading' in json_data:
|
||||||
|
@ -133,7 +136,8 @@ def send_balloon_telemetry(json_data, udp_port=55672):
|
||||||
'altitude': json_data['alt'],
|
'altitude': json_data['alt'],
|
||||||
'callsign': json_data['callsign'],
|
'callsign': json_data['callsign'],
|
||||||
'time': parse(json_data['time']).strftime("%H:%H:%S"),
|
'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
|
# 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':
|
if _log_data['log_type'] == 'CAR POSITION':
|
||||||
send_car_position(_log_data, udp_port)
|
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':
|
elif _log_data['log_type'] == 'BEARING':
|
||||||
send_bearing(_log_data, udp_port, hostname=hostname)
|
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':
|
elif _log_data['log_type'] == 'BALLOON TELEMETRY':
|
||||||
send_balloon_telemetry(_log_data, udp_port)
|
send_balloon_telemetry(_log_data, udp_port)
|
||||||
|
|
|
@ -74,6 +74,12 @@ html, body, #map {
|
||||||
font-size:3em;
|
font-size:3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.logTimeData {
|
||||||
|
color:black;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size:3em;
|
||||||
|
}
|
||||||
|
|
||||||
.bearingData {
|
.bearingData {
|
||||||
color:red;
|
color:red;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
|
@ -269,6 +269,11 @@ function handleTelemetry(data){
|
||||||
$("#chase_car_speed_header").text("");
|
$("#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
|
// Update heading information
|
||||||
if (document.getElementById("showCarHeading").checked){
|
if (document.getElementById("showCarHeading").checked){
|
||||||
$("#chase_car_heading").text(chase_car_position.heading.toFixed(0) + "˚");
|
$("#chase_car_heading").text(chase_car_position.heading.toFixed(0) + "˚");
|
||||||
|
|
|
@ -441,6 +441,21 @@
|
||||||
})
|
})
|
||||||
.addTo(map);
|
.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.
|
// Follow buttons - these just set the radio buttons on the settings pane.
|
||||||
|
|
Ładowanie…
Reference in New Issue