mirror of
https://github.com/30hours/3lips.git
synced 2024-11-08 12:25:42 +00:00
Associator adsb working
This commit is contained in:
parent
b050e2e7a2
commit
2bc28f18cf
5 changed files with 31 additions and 17 deletions
|
@ -184,7 +184,8 @@ window.addEventListener('load', function () {
|
|||
|
||||
// add radar points
|
||||
const radar_names = new URLSearchParams(
|
||||
window.location.search).get('url').split('&');
|
||||
window.location.search).getAll('url');
|
||||
console.log(radar_names);
|
||||
var radar_config_url = radar_names.map(
|
||||
url => `http://${url}/api/config`);
|
||||
if (this.window.location.protocol === "https:") {
|
||||
|
@ -249,7 +250,6 @@ window.addEventListener('load', function () {
|
|||
url => url.replace(/^http:/, 'https:'));
|
||||
}
|
||||
adsb_url = adsb_url[0];
|
||||
console.log(adsb_url);
|
||||
|
||||
// call event loops
|
||||
event_adsb();
|
||||
|
@ -306,13 +306,10 @@ function removeEntitiesByType(entityType) {
|
|||
}
|
||||
|
||||
function doesEntityNameExist(name) {
|
||||
|
||||
// loop over all entities in the viewer
|
||||
viewer.entities.values.forEach((entity) => {
|
||||
for (const entity of viewer.entities.values) {
|
||||
if (entity.name === name) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
|
@ -45,7 +45,7 @@ document.getElementById('buttonMap').addEventListener('click', function() {
|
|||
var adsb = document.querySelector('[name="adsb"]').value;
|
||||
|
||||
// Construct the URL with the form values
|
||||
var apiUrl = '?url=' + Array.from(servers).map(server => server.value).join('&');
|
||||
var apiUrl = '?url=' + Array.from(servers).map(server => server.value).join('&url=');
|
||||
var mapUrl = '/map/index.html' + apiUrl + '&associator=' + associator + '&coordreg=' + coordreg + '&adsb=' + adsb;
|
||||
|
||||
// Redirect to the constructed URL
|
||||
|
|
|
@ -59,11 +59,17 @@ class AdsbAssociator:
|
|||
assoc_detections_radar.append(self.process_1_radar(
|
||||
radar, radar_data[radar]["detection"], adsb_detections))
|
||||
|
||||
# associate detections between radars
|
||||
|
||||
print(assoc_detections_radar, flush=True)
|
||||
|
||||
# associate detections between radars
|
||||
output = {}
|
||||
for entry in assoc_detections_radar:
|
||||
for key, value in entry.items():
|
||||
if key not in output:
|
||||
output[key] = [value]
|
||||
else:
|
||||
output[key].append(value)
|
||||
output = {key: values for key, values in output.items() if len(values) > 1}
|
||||
|
||||
return output
|
||||
|
||||
def process_1_radar(self, radar, radar_detections, adsb_detections):
|
||||
|
||||
|
@ -120,7 +126,11 @@ class AdsbAssociator:
|
|||
tx_lon = radar_data['config']['location']['tx']['longitude']
|
||||
tx_alt = radar_data['config']['location']['tx']['altitude']
|
||||
fc = radar_data['config']['capture']['fc']
|
||||
adsb = radar_data['config']['truth']['adsb']['ip']
|
||||
|
||||
if (radar == "radar5.30hours.dev"):
|
||||
adsb = radar_data['config']['truth']['adsb']['ip']
|
||||
else:
|
||||
adsb = radar_data['config']['truth']['adsb']['tar1090']
|
||||
|
||||
api_url = "http://adsb2dd.30hours.dev/api/dd"
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class EllipseParametric:
|
|||
@brief Constructor for the EllipseParametric class.
|
||||
"""
|
||||
|
||||
def process(self, assoc_detections):
|
||||
def process(self, assoc_detections, radar_data):
|
||||
|
||||
"""
|
||||
@brief Perform coord registration using the ellipse parametric method.
|
||||
|
@ -29,4 +29,8 @@ class EllipseParametric:
|
|||
@return str: JSON of associated detections.
|
||||
"""
|
||||
|
||||
output = {}
|
||||
|
||||
return output
|
||||
|
||||
|
|
@ -29,8 +29,6 @@ async def event():
|
|||
|
||||
global api
|
||||
timestamp = int(time.time()*1000)
|
||||
|
||||
# main event loop
|
||||
api_event = copy.copy(api)
|
||||
|
||||
# list all blah2 radars
|
||||
|
@ -80,7 +78,6 @@ async def event():
|
|||
for item in api_event:
|
||||
|
||||
# extract dict for item
|
||||
#radar_dict_item = {key: None for key in item["server"]}
|
||||
radar_dict_item = {
|
||||
key: radar_dict[key]
|
||||
for key in item["server"]
|
||||
|
@ -101,7 +98,13 @@ async def event():
|
|||
print("Error: Coord reg invalid.")
|
||||
return
|
||||
|
||||
# processing
|
||||
associated_dets = associator.process(item["server"], radar_dict_item)
|
||||
localised_dets = coordreg.process(associated_dets, radar_dict_item)
|
||||
|
||||
# output data to API
|
||||
item["detections_associated"] = associated_dets
|
||||
item["detections_localised"] = localised_dets
|
||||
|
||||
# delete old API requests
|
||||
api_event = [
|
||||
|
|
Loading…
Reference in a new issue