Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
df-aggregator
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
df-aggregator
Commits
06bc08ee
Commit
06bc08ee
authored
Mar 26, 2021
by
Corey Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dynamic LOB Length
parent
981a4123
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
47 deletions
+71
-47
CHANGELOG.md
CHANGELOG.md
+3
-0
README.md
README.md
+3
-0
df-aggregator.py
df-aggregator.py
+65
-47
No files found.
CHANGELOG.md
View file @
06bc08ee
## Recent Changes:
-
LOB Length is now determined by the distance to the furthest intersection from
the receiver.
-
Fixed bug where map lags behind the receiver.
-
Changed the way ellipse and clustering parameters are handled. This allows for
multi-user map interaction.
-
Updated to Cesium 1.79
...
...
README.md
View file @
06bc08ee
# DF Aggregator
## Recent Changes:
-
LOB Length is now determined by the distance to the furthest intersection from
the receiver.
-
Fixed bug where map lags behind the receiver.
-
Changed the way ellipse and clustering parameters are handled. This allows for
multi-user map interaction.
-
For previous changes see the
[
Change Log
](
CHANGELOG.md
)
.
...
...
df-aggregator.py
View file @
06bc08ee
...
...
@@ -55,6 +55,7 @@ class math_settings:
self
.
min_samp
=
min_samp
self
.
min_conf
=
conf
self
.
min_power
=
power
rx_busy
=
False
receiving
=
True
plotintersects
=
False
...
...
@@ -66,8 +67,6 @@ class receiver:
def
__init__
(
self
,
station_url
):
self
.
station_url
=
station_url
self
.
isAuto
=
True
# hashed_url = hashlib.md5(station_url.encode('utf-8')).hexdigest()
# self.uid = hashed_url[:5] + hashed_url[-5:]
self
.
isActive
=
True
self
.
flipped
=
False
self
.
inverted
=
True
...
...
@@ -124,8 +123,7 @@ class receiver:
print
(
f
"Problem connecting to {self.station_url}, receiver deactivated. Reactivate in WebUI."
)
# raise IOError
# Returns receivers properties as a dict,
# useful for passing data to the WebUI
# Returns receivers properties as a dict, useful for passing data to the WebUI
def
receiver_dict
(
self
):
return
({
'station_id'
:
self
.
station_id
,
'station_url'
:
self
.
station_url
,
'latitude'
:
self
.
latitude
,
'longitude'
:
self
.
longitude
,
'heading'
:
self
.
heading
,
...
...
@@ -134,6 +132,12 @@ class receiver:
'active'
:
self
.
isActive
,
'auto'
:
self
.
isAuto
,
'inverted'
:
self
.
inverted
,
'single'
:
self
.
isSingle
})
def
lob_length
(
self
):
if
self
.
d_2_last_intersection
:
return
round
(
max
(
self
.
d_2_last_intersection
))
+
200
else
:
return
d
latitude
=
0.0
longitude
=
0.0
heading
=
0.0
...
...
@@ -147,6 +151,7 @@ class receiver:
isSingle
=
False
previous_doa_time
=
0
last_processed_at
=
0
d_2_last_intersection
=
[
d
]
###############################################
# Converts Lat/Lon to polar coordinates
...
...
@@ -548,46 +553,46 @@ def write_rx_czml():
"height"
:
48
,
"width"
:
48
,
}
for
index
,
x
in
enumerate
(
receivers
):
if
x
.
isActive
and
ms
.
receiving
:
if
(
x
.
confidence
>
min_conf
and
x
.
power
>
min_power
):
lob_color
=
green
elif
(
x
.
confidence
<=
min_conf
and
x
.
power
>
min_power
):
lob_color
=
orange
while
not
ms
.
rx_busy
:
for
index
,
x
in
enumerate
(
receivers
):
if
x
.
isActive
and
ms
.
receiving
:
if
(
x
.
confidence
>
min_conf
and
x
.
power
>
min_power
):
lob_color
=
green
elif
(
x
.
confidence
<=
min_conf
and
x
.
power
>
min_power
):
lob_color
=
orange
else
:
lob_color
=
red
lob_start_lat
=
x
.
latitude
lob_start_lon
=
x
.
longitude
lob_stop_lat
,
lob_stop_lon
=
v
.
direct
(
lob_start_lat
,
lob_start_lon
,
x
.
doa
,
x
.
lob_length
())
lob_packets
.
append
(
Packet
(
id
=
f
"LOB-{x.station_id}-{index}"
,
polyline
=
Polyline
(
material
=
Material
(
polylineOutline
=
PolylineOutlineMaterial
(
color
=
Color
(
rgba
=
lob_color
),
outlineColor
=
Color
(
rgba
=
[
0
,
0
,
0
,
255
]),
outlineWidth
=
2
)),
clampToGround
=
True
,
width
=
5
,
positions
=
Position
(
cartographicDegrees
=
[
lob_start_lon
,
lob_start_lat
,
height
,
lob_stop_lon
,
lob_stop_lat
,
height
])
)))
else
:
lob_color
=
red
lob_start_lat
=
x
.
latitude
lob_start_lon
=
x
.
longitude
lob_stop_lat
,
lob_stop_lon
=
v
.
direct
(
lob_start_lat
,
lob_start_lon
,
x
.
doa
,
d
)
lob_packets
.
append
(
Packet
(
id
=
f
"LOB-{x.station_id}-{index}"
,
polyline
=
Polyline
(
material
=
Material
(
polylineOutline
=
PolylineOutlineMaterial
(
color
=
Color
(
rgba
=
lob_color
),
outlineColor
=
Color
(
rgba
=
[
0
,
0
,
0
,
255
]),
outlineWidth
=
2
)),
clampToGround
=
True
,
width
=
5
,
positions
=
Position
(
cartographicDegrees
=
[
lob_start_lon
,
lob_start_lat
,
height
,
lob_stop_lon
,
lob_stop_lat
,
height
])
)))
else
:
lob_packets
=
[]
if
x
.
isMobile
==
True
:
rx_icon
=
{
"image"
:{
"uri"
:
"/static/flipped_car.svg"
}}
# if x.heading > 0 or x.heading < 180:
# rx_icon = {"image":{"uri":"/static/flipped_car.svg"}, "rotation":math.radians(360 - x.heading + 90)}
# elif x.heading < 0 or x.heading > 180:
# rx_icon = {"image":{"uri":"/static/car.svg"}, "rotation":math.radians(360 - x.heading - 90)}
else
:
rx_icon
=
{
"image"
:{
"uri"
:
"/static/tower.svg"
}}
receiver_point_packets
.
append
(
Packet
(
id
=
f
"{x.station_id}-{index}"
,
billboard
=
{
**
rx_properties
,
**
rx_icon
},
position
=
{
"cartographicDegrees"
:
[
x
.
longitude
,
x
.
latitude
,
15
]}))
lob_packets
=
[]
if
x
.
isMobile
==
True
:
rx_icon
=
{
"image"
:{
"uri"
:
"/static/flipped_car.svg"
}}
# if x.heading > 0 or x.heading < 180:
# rx_icon = {"image":{"uri":"/static/flipped_car.svg"}, "rotation":math.radians(360 - x.heading + 90)}
# elif x.heading < 0 or x.heading > 180:
# rx_icon = {"image":{"uri":"/static/car.svg"}, "rotation":math.radians(360 - x.heading - 90)}
else
:
rx_icon
=
{
"image"
:{
"uri"
:
"/static/tower.svg"
}}
receiver_point_packets
.
append
(
Packet
(
id
=
f
"{x.station_id}-{index}"
,
billboard
=
{
**
rx_properties
,
**
rx_icon
},
position
=
{
"cartographicDegrees"
:
[
x
.
longitude
,
x
.
latitude
,
15
]}))
return
Document
([
top
]
+
receiver_point_packets
+
lob_packets
)
.
dumps
(
separators
=
(
','
,
':'
))
return
Document
([
top
]
+
receiver_point_packets
+
lob_packets
)
.
dumps
(
separators
=
(
','
,
':'
))
###############################################
# Writes aoi.czml used by the WebUI
...
...
@@ -863,6 +868,15 @@ def run_receiver(receivers):
# Main loop to compute intersections between multiple receivers
intersect_list
=
np
.
array
([])
.
reshape
(
0
,
3
)
ms
.
rx_busy
=
True
for
rx
in
receivers
:
try
:
if
rx
.
isActive
:
rx
.
update
()
except
IOError
:
print
(
"Problem connecting to receiver."
)
rx
.
d_2_last_intersection
=
[]
for
x
in
range
(
len
(
receivers
)):
for
y
in
range
(
x
):
if
x
!=
y
:
...
...
@@ -876,6 +890,10 @@ def run_receiver(receivers):
receivers
[
x
]
.
doa
,
receivers
[
y
]
.
latitude
,
receivers
[
y
]
.
longitude
,
receivers
[
y
]
.
doa
)
if
intersection
:
print
(
intersection
)
receivers
[
x
]
.
d_2_last_intersection
.
append
(
v
.
haversine
(
receivers
[
x
]
.
latitude
,
receivers
[
x
]
.
longitude
,
*
intersection
))
receivers
[
y
]
.
d_2_last_intersection
.
append
(
v
.
haversine
(
receivers
[
y
]
.
latitude
,
receivers
[
y
]
.
longitude
,
*
intersection
))
intersection
=
list
(
intersection
)
avg_conf
=
np
.
mean
([
receivers
[
x
]
.
confidence
,
receivers
[
y
]
.
confidence
])
intersection
.
append
(
avg_conf
)
...
...
@@ -883,7 +901,6 @@ def run_receiver(receivers):
if
intersection
.
any
()
!=
None
:
intersect_list
=
np
.
concatenate
((
intersect_list
,
intersection
),
axis
=
0
)
if
intersect_list
.
size
!=
0
:
avg_coord
=
np
.
average
(
intersect_list
[:,
0
:
3
],
weights
=
intersect_list
[:,
2
],
axis
=
0
)
keep
,
in_aoi
=
check_aoi
(
*
avg_coord
[
0
:
2
])
...
...
@@ -947,11 +964,12 @@ def run_receiver(receivers):
DATABASE_RETURN
.
get
(
timeout
=
1
)
DATABASE_EDIT_Q
.
put
((
"done"
,
None
,
False
))
try
:
if
rx
.
isActive
:
rx
.
update
()
except
IOError
:
print
(
"Problem connecting to receiver."
)
#
try:
#
if rx.isActive: rx.update()
#
except IOError:
#
print("Problem connecting to receiver.")
ms
.
rx_busy
=
False
time
.
sleep
(
1
)
if
dots
>
5
:
dots
=
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment