mirror of
https://github.com/30hours/3lips.git
synced 2024-11-18 12:33:58 +00:00
Start ellipsoid class
This commit is contained in:
parent
2bc28f18cf
commit
7b7758e3ec
4 changed files with 66 additions and 13 deletions
|
@ -30,7 +30,7 @@ associators = [
|
|||
# {"name": "Ellipsoid Parametric (Arc Length)", "id": "ellipsoid-parametric-arc"}
|
||||
# ]
|
||||
coordregs = [
|
||||
{"name": "Ellipse Parametric", "id": "ellipse-parametric"}
|
||||
{"name": "Ellipsoid Parametric", "id": "ellipsoid-parametric"}
|
||||
]
|
||||
|
||||
adsbs = [
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
"""
|
||||
@file EllipseParametric.py
|
||||
@file EllipsoidParametric.py
|
||||
@author 30hours
|
||||
"""
|
||||
|
||||
class EllipseParametric:
|
||||
from data.Ellipsoid import Ellipsoid
|
||||
|
||||
class EllipsoidParametric:
|
||||
|
||||
"""
|
||||
@class EllipseParametric
|
||||
@brief A class for intersecting ellipses using a parametric approx.
|
||||
@class EllipsoidParametric
|
||||
@brief A class for intersecting ellipsoids using a parametric approx.
|
||||
@details Uses associated detections from multiple radars.
|
||||
@see blah2 at https://github.com/30hours/blah2.
|
||||
"""
|
||||
|
@ -15,14 +17,14 @@ class EllipseParametric:
|
|||
def __init__(self):
|
||||
|
||||
"""
|
||||
@brief Constructor for the EllipseParametric class.
|
||||
@brief Constructor for the EllipsoidParametric class.
|
||||
"""
|
||||
|
||||
def process(self, assoc_detections, radar_data):
|
||||
|
||||
"""
|
||||
@brief Perform coord registration using the ellipse parametric method.
|
||||
@details Generate a (non arc-length) parametric ellipse for each node.
|
||||
@brief Perform coord registration using the ellipsoid parametric method.
|
||||
@details Generate a (non arc-length) parametric ellipsoid for each node.
|
||||
Find
|
||||
@param radar_detections (str): JSON of blah2 radar detections.
|
||||
@param adsb_detections (str): JSON of adsb2dd truth detections.
|
||||
|
@ -33,4 +35,3 @@ class EllipseParametric:
|
|||
|
||||
return output
|
||||
|
||||
|
52
event/data/Ellipsoid.py
Normal file
52
event/data/Ellipsoid.py
Normal file
|
@ -0,0 +1,52 @@
|
|||
"""
|
||||
@file Ellipsoid.py
|
||||
@author 30hours
|
||||
"""
|
||||
|
||||
import math
|
||||
|
||||
class Ellipsoid:
|
||||
|
||||
"""
|
||||
@class Ellipsoid
|
||||
@brief A class to store ellipsoid parameters for bistatic radar.
|
||||
@details Stores foci, midpoint, pitch, yaw and distance.
|
||||
Able to generate samples through public functions.
|
||||
"""
|
||||
|
||||
def __init__(self, f1, f2, name):
|
||||
|
||||
"""
|
||||
@brief Constructor for the Ellipsoid class.
|
||||
"""
|
||||
|
||||
self.f1 = f1
|
||||
self.f2 = f2
|
||||
self.name = name
|
||||
|
||||
self.midpoint = [(f1[0]+f2[0])/2,
|
||||
(f1[1]+f2[1])/2, (f1[2]+f2[2])/2]
|
||||
vector = (f2[0]-f1[0], f2[1]-f1[1], f2[2]-f1[2])
|
||||
self.yaw = math.atan2(vector[1], vector[0])
|
||||
self.pitch = math.atan2(vector[2],
|
||||
math.sqrt(vector[0]**2 + vector[1]**2))
|
||||
self.distance = math.sqrt(
|
||||
(f2[0] - f1[0])**2 +
|
||||
(f2[1] - f1[1])**2 +
|
||||
(f2[2] - f1[2])**2)
|
||||
|
||||
def process(self, bistatic_range):
|
||||
|
||||
"""
|
||||
@brief Perform coord registration using the ellipsoid parametric method.
|
||||
@details Generate a (non arc-length) parametric ellipsoid for each node.
|
||||
Find
|
||||
@param radar_detections (str): JSON of blah2 radar detections.
|
||||
@param adsb_detections (str): JSON of adsb2dd truth detections.
|
||||
@return str: JSON of associated detections.
|
||||
"""
|
||||
|
||||
output = {}
|
||||
|
||||
return output
|
||||
|
|
@ -14,7 +14,7 @@ import json
|
|||
import hashlib
|
||||
|
||||
from algorithm.associator.AdsbAssociator import AdsbAssociator
|
||||
from algorithm.coordreg.EllipseParametric import EllipseParametric
|
||||
from algorithm.coordreg.EllipsoidParametric import EllipsoidParametric
|
||||
from common.Message import Message
|
||||
|
||||
# init event loop
|
||||
|
@ -23,7 +23,7 @@ api = []
|
|||
# init config
|
||||
tDelete = 60
|
||||
adsbAssociator = AdsbAssociator()
|
||||
ellipseParametric = EllipseParametric()
|
||||
ellipsoidParametric = EllipsoidParametric()
|
||||
|
||||
async def event():
|
||||
|
||||
|
@ -92,8 +92,8 @@ async def event():
|
|||
return
|
||||
|
||||
# coord reg selection
|
||||
if item["coordreg"] == "ellipse-parametric":
|
||||
coordreg = ellipseParametric
|
||||
if item["coordreg"] == "ellipsoid-parametric":
|
||||
coordreg = ellipsoidParametric
|
||||
else:
|
||||
print("Error: Coord reg invalid.")
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue