mirror of
https://github.com/30hours/3lips.git
synced 2024-11-18 12:33:58 +00:00
Changed ellipsoid algorithm to use a master ellipsoid
This commit is contained in:
parent
56439cbaf0
commit
82a019a6ad
4 changed files with 38 additions and 33 deletions
|
@ -11,21 +11,21 @@ function event_ellipsoid() {
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
||||||
|
if (!data["ellipsoids"]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Object.keys(data["ellipsoids"]).length !== 0) {
|
if (Object.keys(data["ellipsoids"]).length !== 0) {
|
||||||
console.log('remove');
|
|
||||||
removeEntitiesByType("ellipsoids");
|
removeEntitiesByType("ellipsoids");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
removeEntitiesOlderThanAndFade("ellipsoids", 30, 0.2);
|
removeEntitiesOlderThanAndFade("ellipsoids", 5, 0.5);
|
||||||
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];
|
||||||
|
|
||||||
console.log(key);
|
|
||||||
console.log(points);
|
|
||||||
|
|
||||||
for (const point in points) {
|
for (const point in points) {
|
||||||
addPoint(
|
addPoint(
|
||||||
points[point][0],
|
points[point][0],
|
||||||
|
|
|
@ -11,13 +11,18 @@ function event_radar() {
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
|
|
||||||
|
if (!data["detections_localised"]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEntitiesOlderThanAndFade("detection", 10, 0.5);
|
||||||
|
|
||||||
for (const key in data["detections_localised"]) {
|
for (const key in data["detections_localised"]) {
|
||||||
if (data["detections_localised"].hasOwnProperty(key)) {
|
if (data["detections_localised"].hasOwnProperty(key)) {
|
||||||
const target = data["detections_localised"][key];
|
const target = data["detections_localised"][key];
|
||||||
const points = target["points"];
|
const points = target["points"];
|
||||||
|
|
||||||
removeEntitiesOlderThanAndFade("detection", 60, 0.5);
|
|
||||||
|
|
||||||
for (const point in points) {
|
for (const point in points) {
|
||||||
addPoint(
|
addPoint(
|
||||||
points[point][0],
|
points[point][0],
|
||||||
|
|
|
@ -75,39 +75,39 @@ class EllipsoidParametric:
|
||||||
radar["radar"]
|
radar["radar"]
|
||||||
)
|
)
|
||||||
|
|
||||||
samples = self.sample(ellipsoid, radar["delay"]*1000, 20)
|
samples = self.sample(ellipsoid, radar["delay"]*1000, 120)
|
||||||
target_samples[target][radar["radar"]] = samples
|
target_samples[target][radar["radar"]] = samples
|
||||||
|
|
||||||
# find close points
|
# find close points - ellipsoid 1 = master
|
||||||
radar_keys = list(target_samples[target].keys())
|
radar_keys = list(target_samples[target].keys())
|
||||||
samples_intersect = {key: [] for key in radar_keys}
|
samples_intersect = []
|
||||||
threshold = 200
|
threshold = 200
|
||||||
for i in range(0, len(target_samples[target])-1):
|
|
||||||
|
|
||||||
for j in range(i+1, len(target_samples[target])):
|
# loop points in master ellipsoid
|
||||||
|
for point1 in target_samples[target][radar_keys[0]]:
|
||||||
for point1 in target_samples[target][radar_keys[i]]:
|
valid_point = True
|
||||||
|
# loop over each other list
|
||||||
for point2 in target_samples[target][radar_keys[j]]:
|
for i in range(1, len(radar_keys)):
|
||||||
|
# loop points in other list
|
||||||
if Geometry.distance_ecef(point1, point2) < threshold:
|
if not any(Geometry.distance_ecef(point1, point2) < threshold
|
||||||
samples_intersect[radar_keys[i]].append(point1)
|
for point2 in target_samples[target][radar_keys[i]]):
|
||||||
samples_intersect[radar_keys[j]].append(point2)
|
valid_point = False
|
||||||
|
break
|
||||||
|
if valid_point:
|
||||||
|
samples_intersect.append(point1)
|
||||||
|
|
||||||
# remove duplicates and convert to LLA
|
# remove duplicates and convert to LLA
|
||||||
output[target] = {}
|
output[target] = {}
|
||||||
output[target]["points"] = []
|
output[target]["points"] = []
|
||||||
for key in radar_keys:
|
for i in range(len(samples_intersect)):
|
||||||
samples_intersect[key] = [list(t) for t in {tuple(point) for point in samples_intersect[key]}]
|
samples_intersect[i] = Geometry.ecef2lla(
|
||||||
for i in range(len(samples_intersect[key])):
|
samples_intersect[i][0],
|
||||||
samples_intersect[key][i] = Geometry.ecef2lla(
|
samples_intersect[i][1],
|
||||||
samples_intersect[key][i][0],
|
samples_intersect[i][2])
|
||||||
samples_intersect[key][i][1],
|
output[target]["points"].append([
|
||||||
samples_intersect[key][i][2])
|
round(samples_intersect[i][0], 3),
|
||||||
output[target]["points"].append([
|
round(samples_intersect[i][1], 3),
|
||||||
round(samples_intersect[key][i][0], 3),
|
round(samples_intersect[i][2])])
|
||||||
round(samples_intersect[key][i][1], 3),
|
|
||||||
round(samples_intersect[key][i][2])])
|
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ async def event():
|
||||||
[x_rx, y_rx, z_rx],
|
[x_rx, y_rx, z_rx],
|
||||||
radar["radar"]
|
radar["radar"]
|
||||||
)
|
)
|
||||||
points = ellipsoidParametric.sample(ellipsoid, radar["delay"]*1000, 50)
|
points = ellipsoidParametric.sample(ellipsoid, radar["delay"]*1000, 30)
|
||||||
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)])
|
||||||
|
|
Loading…
Reference in a new issue