Associator adsb working

This commit is contained in:
30hours 2024-02-19 05:19:23 +00:00
parent b050e2e7a2
commit 2bc28f18cf
5 changed files with 31 additions and 17 deletions

View file

@ -184,7 +184,8 @@ window.addEventListener('load', function () {
// add radar points // add radar points
const radar_names = new URLSearchParams( 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( var radar_config_url = radar_names.map(
url => `http://${url}/api/config`); url => `http://${url}/api/config`);
if (this.window.location.protocol === "https:") { if (this.window.location.protocol === "https:") {
@ -249,7 +250,6 @@ window.addEventListener('load', function () {
url => url.replace(/^http:/, 'https:')); url => url.replace(/^http:/, 'https:'));
} }
adsb_url = adsb_url[0]; adsb_url = adsb_url[0];
console.log(adsb_url);
// call event loops // call event loops
event_adsb(); event_adsb();
@ -306,13 +306,10 @@ function removeEntitiesByType(entityType) {
} }
function doesEntityNameExist(name) { function doesEntityNameExist(name) {
for (const entity of viewer.entities.values) {
// loop over all entities in the viewer
viewer.entities.values.forEach((entity) => {
if (entity.name === name) { if (entity.name === name) {
return true; return true;
} }
}); }
return false; return false;
} }

View file

@ -45,7 +45,7 @@ document.getElementById('buttonMap').addEventListener('click', function() {
var adsb = document.querySelector('[name="adsb"]').value; var adsb = document.querySelector('[name="adsb"]').value;
// Construct the URL with the form values // 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; var mapUrl = '/map/index.html' + apiUrl + '&associator=' + associator + '&coordreg=' + coordreg + '&adsb=' + adsb;
// Redirect to the constructed URL // Redirect to the constructed URL

View file

@ -59,11 +59,17 @@ class AdsbAssociator:
assoc_detections_radar.append(self.process_1_radar( assoc_detections_radar.append(self.process_1_radar(
radar, radar_data[radar]["detection"], adsb_detections)) radar, radar_data[radar]["detection"], adsb_detections))
# associate detections between radars # associate detections between radars
output = {}
print(assoc_detections_radar, flush=True) 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): 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_lon = radar_data['config']['location']['tx']['longitude']
tx_alt = radar_data['config']['location']['tx']['altitude'] tx_alt = radar_data['config']['location']['tx']['altitude']
fc = radar_data['config']['capture']['fc'] 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" api_url = "http://adsb2dd.30hours.dev/api/dd"

View file

@ -18,7 +18,7 @@ class EllipseParametric:
@brief Constructor for the EllipseParametric class. @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. @brief Perform coord registration using the ellipse parametric method.
@ -29,4 +29,8 @@ class EllipseParametric:
@return str: JSON of associated detections. @return str: JSON of associated detections.
""" """
output = {}
return output

View file

@ -29,8 +29,6 @@ async def event():
global api global api
timestamp = int(time.time()*1000) timestamp = int(time.time()*1000)
# main event loop
api_event = copy.copy(api) api_event = copy.copy(api)
# list all blah2 radars # list all blah2 radars
@ -80,7 +78,6 @@ async def event():
for item in api_event: for item in api_event:
# extract dict for item # extract dict for item
#radar_dict_item = {key: None for key in item["server"]}
radar_dict_item = { radar_dict_item = {
key: radar_dict[key] key: radar_dict[key]
for key in item["server"] for key in item["server"]
@ -101,7 +98,13 @@ async def event():
print("Error: Coord reg invalid.") print("Error: Coord reg invalid.")
return return
# processing
associated_dets = associator.process(item["server"], radar_dict_item) 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 # delete old API requests
api_event = [ api_event = [