Store all associations in API

This commit is contained in:
30hours 2024-03-05 12:38:41 +00:00
parent b4f129c1e4
commit 90694e6758
2 changed files with 9 additions and 4 deletions

View file

@ -70,7 +70,7 @@ class AdsbAssociator:
output[key] = [value] output[key] = [value]
else: else:
output[key].append(value) output[key].append(value)
output = {key: values for key, values in output.items() if len(values) > 1} #output = {key: values for key, values in output.items() if len(values) > 1}
return output return output

View file

@ -116,6 +116,11 @@ async def event():
for key, value in associated_dets.items() for key, value in associated_dets.items()
if isinstance(value, list) and len(value) >= 3 if isinstance(value, list) and len(value) >= 3
} }
associated_dets_2_radars = {
key: value
for key, value in associated_dets.items()
if isinstance(value, list) and len(value) >= 2
}
localised_dets = localisation.process(associated_dets_3_radars, radar_dict_item) localised_dets = localisation.process(associated_dets_3_radars, radar_dict_item)
if associated_dets: if associated_dets:
@ -123,11 +128,11 @@ async def event():
# show ellipsoids of associated detections for 1 target # show ellipsoids of associated detections for 1 target
ellipsoids = {} ellipsoids = {}
if associated_dets: if associated_dets_2_radars:
# get first target key # get first target key
key = next(iter(associated_dets)) key = next(iter(associated_dets_2_radars))
ellipsoid_radars = [] ellipsoid_radars = []
for radar in associated_dets[key]: for radar in associated_dets_2_radars[key]:
ellipsoid_radars.append(radar["radar"]) ellipsoid_radars.append(radar["radar"])
x_tx, y_tx, z_tx = Geometry.lla2ecef( x_tx, y_tx, z_tx = Geometry.lla2ecef(
radar_dict_item[radar["radar"]]["config"]['location']['tx']['latitude'], radar_dict_item[radar["radar"]]["config"]['location']['tx']['latitude'],