mirror of
https://github.com/30hours/3lips.git
synced 2024-11-18 12:33:58 +00:00
Plot ellipsoids properly
This commit is contained in:
parent
5b22ccdebd
commit
56439cbaf0
3 changed files with 31 additions and 29 deletions
|
@ -11,11 +11,20 @@ function event_ellipsoid() {
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
if (Object.keys(data["ellipsoids"]).length !== 0) {
|
||||||
|
console.log('remove');
|
||||||
|
removeEntitiesByType("ellipsoids");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeEntitiesOlderThanAndFade("ellipsoids", 30, 0.2);
|
||||||
|
console.log('fade');
|
||||||
|
}
|
||||||
for (const key in data["ellipsoids"]) {
|
for (const key in data["ellipsoids"]) {
|
||||||
if (data["ellipsoids"].hasOwnProperty(key)) {
|
if (data["ellipsoids"].hasOwnProperty(key)) {
|
||||||
const points = data["ellipsoids"][key];
|
const points = data["ellipsoids"][key];
|
||||||
|
|
||||||
removeEntitiesOlderThanAndFade("ellipsoids", 30, 0.2);
|
console.log(key);
|
||||||
|
console.log(points);
|
||||||
|
|
||||||
for (const point in points) {
|
for (const point in points) {
|
||||||
addPoint(
|
addPoint(
|
||||||
|
@ -39,13 +48,13 @@ function event_ellipsoid() {
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
// Schedule the next fetch after a delay (e.g., 5 seconds)
|
// Schedule the next fetch after a delay (e.g., 5 seconds)
|
||||||
setTimeout(event_radar, 1000);
|
setTimeout(event_ellipsoid, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var style_ellipsoid = {};
|
var style_ellipsoid = {};
|
||||||
style_ellipsoid.color = 'rgba(0, 0, 255, 0.2)';
|
style_ellipsoid.color = 'rgba(0, 0, 255, 0.5)';
|
||||||
style_ellipsoid.pointSize = 16;
|
style_ellipsoid.pointSize = 16;
|
||||||
style_ellipsoid.type = "ellipsoids";
|
style_ellipsoid.type = "ellipsoids";
|
||||||
style_ellipsoid.timestamp = Date.now();
|
style_ellipsoid.timestamp = Date.now();
|
|
@ -75,13 +75,13 @@ class EllipsoidParametric:
|
||||||
radar["radar"]
|
radar["radar"]
|
||||||
)
|
)
|
||||||
|
|
||||||
samples = self.sample(ellipsoid, radar["delay"], 20)
|
samples = self.sample(ellipsoid, radar["delay"]*1000, 20)
|
||||||
target_samples[target][radar["radar"]] = samples
|
target_samples[target][radar["radar"]] = samples
|
||||||
|
|
||||||
# find close points
|
# find close points
|
||||||
radar_keys = list(target_samples[target].keys())
|
radar_keys = list(target_samples[target].keys())
|
||||||
samples_intersect = {key: [] for key in radar_keys}
|
samples_intersect = {key: [] for key in radar_keys}
|
||||||
threshold = 1500
|
threshold = 200
|
||||||
for i in range(0, len(target_samples[target])-1):
|
for i in range(0, len(target_samples[target])-1):
|
||||||
|
|
||||||
for j in range(i+1, len(target_samples[target])):
|
for j in range(i+1, len(target_samples[target])):
|
||||||
|
|
|
@ -108,45 +108,38 @@ async def event():
|
||||||
if associated_dets:
|
if associated_dets:
|
||||||
print(associated_dets, flush=True)
|
print(associated_dets, flush=True)
|
||||||
|
|
||||||
if localised_dets:
|
# show ellipsoids of associated detections for 1 target
|
||||||
print(localised_dets, flush=True)
|
|
||||||
|
|
||||||
ellipsoids = {}
|
ellipsoids = {}
|
||||||
for radar in radar_dict.keys():
|
if associated_dets:
|
||||||
|
# get first target key
|
||||||
|
key = next(iter(associated_dets))
|
||||||
|
ellipsoid_radars = []
|
||||||
|
for radar in associated_dets[key]:
|
||||||
|
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]["config"]['location']['tx']['latitude'],
|
radar_dict_item[radar["radar"]]["config"]['location']['tx']['latitude'],
|
||||||
radar_dict_item[radar]["config"]['location']['tx']['longitude'],
|
radar_dict_item[radar["radar"]]["config"]['location']['tx']['longitude'],
|
||||||
radar_dict_item[radar]["config"]['location']['tx']['altitude']
|
radar_dict_item[radar["radar"]]["config"]['location']['tx']['altitude']
|
||||||
)
|
)
|
||||||
x_rx, y_rx, z_rx = Geometry.lla2ecef(
|
x_rx, y_rx, z_rx = Geometry.lla2ecef(
|
||||||
radar_dict_item[radar]["config"]['location']['rx']['latitude'],
|
radar_dict_item[radar["radar"]]["config"]['location']['rx']['latitude'],
|
||||||
radar_dict_item[radar]["config"]['location']['rx']['longitude'],
|
radar_dict_item[radar["radar"]]["config"]['location']['rx']['longitude'],
|
||||||
radar_dict_item[radar]["config"]['location']['rx']['altitude']
|
radar_dict_item[radar["radar"]]["config"]['location']['rx']['altitude']
|
||||||
)
|
)
|
||||||
ellipsoid = Ellipsoid(
|
ellipsoid = Ellipsoid(
|
||||||
[x_tx, y_tx, z_tx],
|
[x_tx, y_tx, z_tx],
|
||||||
[x_rx, y_rx, z_rx],
|
[x_rx, y_rx, z_rx],
|
||||||
radar
|
radar["radar"]
|
||||||
)
|
)
|
||||||
bsr = 0
|
points = ellipsoidParametric.sample(ellipsoid, radar["delay"]*1000, 50)
|
||||||
if radar == 'radar4.30hours.dev':
|
|
||||||
bsr = 12470
|
|
||||||
if radar == 'radar5.30hours.dev':
|
|
||||||
bsr = 1870
|
|
||||||
if radar == 'radar6.30hours.dev':
|
|
||||||
bsr = 5210
|
|
||||||
points = ellipsoidParametric.sample(ellipsoid, bsr, 50)
|
|
||||||
for i in range(len(points)):
|
for i in range(len(points)):
|
||||||
lat, lon, alt = Geometry.ecef2lla(points[i][0], points[i][1], points[i][2])
|
lat, lon, alt = Geometry.ecef2lla(points[i][0], points[i][1], points[i][2])
|
||||||
points[i] = ([round(lat, 3), round(lon, 3), round(alt)])
|
points[i] = ([round(lat, 3), round(lon, 3), round(alt)])
|
||||||
ellipsoids[radar] = points
|
ellipsoids[radar["radar"]] = points
|
||||||
|
|
||||||
|
|
||||||
# output data to API
|
# output data to API
|
||||||
item["detections_associated"] = associated_dets
|
item["detections_associated"] = associated_dets
|
||||||
item["detections_localised"] = localised_dets
|
item["detections_localised"] = localised_dets
|
||||||
|
|
||||||
if ellipsoids:
|
|
||||||
item["ellipsoids"] = ellipsoids
|
item["ellipsoids"] = ellipsoids
|
||||||
|
|
||||||
# delete old API requests
|
# delete old API requests
|
||||||
|
|
Loading…
Reference in a new issue