stratux icon indicating copy to clipboard operation
stratux copied to clipboard

Feature request - Traffic audio alerts

Open cbfraser opened this issue 6 years ago • 57 comments

Generate configurable audio alerts based on traffic -distance, altitude, etc

cbfraser avatar Oct 12 '17 15:10 cbfraser

This has been requested before. At this time, it has been seen as a feature of the EFB that you are using. We are only looking to provide as much quality data/info as possible to the connected devices allowing the EFB/APP to make those decisions!!!

peepsnet avatar Oct 12 '17 16:10 peepsnet

understandable but having stratux generate the audio allows an audio cable between stratux and intercom as a more permanent install rather than plugging in and removing both power and audio when using a tablet EFB. And allows for audio support when the EFB doesn’t support it (eg FlightPlan GO on Android) and perhaps best of all –

allows for a custom criteria to generate better audio – eg traffic two oclock low.

Anyway the traffic.go code sets an alert flag based on distance and has comment –

// TODO: Could be more intelligent, taking into account headings

Could you point me to how to contribute (in this case isTrafficAlertable)?

thanks

From: peepsnet [mailto:[email protected]] Sent: October-12-17 9:42 AM To: cyoung/stratux Cc: cbfraser; Author Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

This has been requested before. At this time, it has been seen as a feature of the EFB that you are using. We are only looking to provide as much quality data/info to the connected devices allowing them to make those decisions!!!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-336195051 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcOtBX3QcDuwT66GHI8W39gOwoKdnks5srkFsgaJpZM4P3NGU . https://github.com/notifications/beacon/AEQrcIa7MaXh4M0Fb28kpwvT11prhCYdks5srkFsgaJpZM4P3NGU.gif

cbfraser avatar Oct 12 '17 20:10 cbfraser

https://github.com/cyoung/stratux/issues/411

https://github.com/cyoung/stratux/issues/364

peepsnet avatar Oct 13 '17 00:10 peepsnet

@cbfraser - if you're interested in doing this, then we may add it. What are your abilities?

apt-get install espeak, the 'espeak' tool seems to work fairly easily:

root@raspberrypi:~# espeak --stdout "Traffic, ten o’clock, one two miles, southeast bound, one thousand feet below you" | aplay
Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
root@raspberrypi:~# 

(from JO 7110.65W)

We won't (and don't need to) add anything to traffic.go for this, it should be an external program. traffic.zip

cyoung avatar Oct 17 '17 19:10 cyoung

By the way, we could do the similar with radar, METARs, PIREPs, etc.

https://github.com/cyoung/stratux/blob/master/test/nexrad_annunciator.go

cyoung avatar Oct 18 '17 01:10 cyoung

good to hear –

I’ve got a computer science background – and while it has been awhile since I coded professionally,

the coding is straight forward – I’ve done some Arduino stuff but no rp3 so would likely need pointers

on integration with traffic.go.

I’ve done a couple of startups so pretty good a product definition, requirements, testing, usability.

You mention not changing traffic.go but the isTrafficAlertable code sets the alert flag and even the comment suggests

improvement (and some users rebuild image to clear that code so the efb app can do it according to its criteria).

Wouldn’t it makes sense to use same logic for setting alert flag and generating audio alert?

I’ve got espeak running – Let me put together a proof of concept system

and see what issues there are – such as having more traffic to report than audio bandwidth,

likely configuration options,

and I’ll get back with some ideas.

Do you care whether audioalert is go or python?

func isTrafficAlertable(ti TrafficInfo) bool { // Set alert bit if possible and traffic is within some threshold // TODO: Could be more intelligent, taking into account headings etc.

From: cyoung [mailto:[email protected]] Sent: October-17-17 12:11 PM To: cyoung/stratux Cc: cbfraser; Mention Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

@cbfraser https://github.com/cbfraser - if you're interested in doing this, then we may add it. What are your abilities?

apt-get install espeak, the 'espeak' tool seems to work fairly easily:

root@raspberrypi:~# espeak --stdout "Traffic, ten o’clock, one two miles, southeast bound, one thousand feet below you" | aplay Playing WAVE 'stdin' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono root@raspberrypi:~#

(from JO 7110.65W https://www.faa.gov/documentLibrary/media/Order/ATC.pdf )

We won't (and don't need to) add anything to traffic.go for this, it should be an external program. traffic.zip https://github.com/cyoung/stratux/files/1392289/traffic.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-337338226 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcGQ0eBK5acGpQsVDWG_iakyGRmunks5stPvZgaJpZM4P3NGU . https://github.com/notifications/beacon/AEQrcFO3xvy2jCt8NmxDsTVaGoJsCYgdks5stPvZgaJpZM4P3NGU.gif

cbfraser avatar Oct 18 '17 14:10 cbfraser

@cbfraser - it doesn't matter if it's in Go or Python. We have Python installed on the release images.

It would make sense to use the same criteria but I think you mentioned making it customizable. That makes sense for audio alerts perhaps, but not really customizing traffic alerts in stratux. If it's in the main stratux code I'd prefer that it be based on some sort of standard and not customizable at all.

cyoung avatar Oct 18 '17 15:10 cyoung

makes sense –traffic would have a base criteria for the alert flag - eg 2nm as it is now but also altitude (ie within 1,000ft) –

and put in audioalert configurable criteria and other criteria like closure, collision detection etc

I’ll come back with a suggested proposal as a starting point…..

thanks

From: cyoung [mailto:[email protected]] Sent: October-18-17 8:10 AM To: cyoung/stratux Cc: cbfraser; Mention Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

@cbfraser https://github.com/cbfraser - it doesn't matter if it's in Go or Python. We have Python installed on the release images.

It would make sense to use the same criteria but I think you mentioned making it customizable. That makes sense for audio alerts perhaps, but not really customizing traffic alerts in stratux. If it's in the main stratux code I'd prefer that it be based on some sort of standard and not customizable at all.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-337623933 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcNQWMrLb11YESt0A-lzD7XTVMGdVks5sthTKgaJpZM4P3NGU . https://github.com/notifications/beacon/AEQrcMHMDXgYDWvEHF-OIQkJhh87Hi5Qks5sthTKgaJpZM4P3NGU.gif

cbfraser avatar Oct 18 '17 15:10 cbfraser

I’ve done some preliminary work – the code

for “traffic 12 oclock high 2 miles” is straight forward based on info available in traffic.

I’ve also done a draft collision prediction section – (2d)

“traffic 12 oclock high 2 miles incoming 3 minutes” that brings up a few questions:

  •      is ownship and target   track and velocity available  - I see the fields – are they usually available and valid?
    
  •      I’m using mpmath and sympy – would it be a problem including those libraries if you wanted to use this?
    

thanks

From: cyoung [mailto:[email protected]] Sent: October-18-17 8:10 AM To: cyoung/stratux Cc: cbfraser; Mention Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

@cbfraser https://github.com/cbfraser - it doesn't matter if it's in Go or Python. We have Python installed on the release images.

It would make sense to use the same criteria but I think you mentioned making it customizable. That makes sense for audio alerts perhaps, but not really customizing traffic alerts in stratux. If it's in the main stratux code I'd prefer that it be based on some sort of standard and not customizable at all.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-337623933 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcNQWMrLb11YESt0A-lzD7XTVMGdVks5sthTKgaJpZM4P3NGU . https://github.com/notifications/beacon/AEQrcMHMDXgYDWvEHF-OIQkJhh87Hi5Qks5sthTKgaJpZM4P3NGU.gif

cbfraser avatar Oct 19 '17 14:10 cbfraser

Excellent. We can include those libraries, yes. See ws://localhost/traffic and http://localhost/getSituation documented here. Sometimes that information is available, sometimes not.

cyoung avatar Oct 20 '17 00:10 cyoung

I have initial code for traffic alerts and collision detection –

do I use this email to send you discussion material?

regards

From: cyoung [mailto:[email protected]] Sent: October-19-17 5:41 PM To: cyoung/stratux Cc: cbfraser; Mention Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

Excellent. We can include those libraries, yes. See ws://localhost/traffic and http://localhost/getSituation documented here https://github.com/cyoung/stratux/blob/master/notes/app-vendor-integration.md . Sometimes that information is available, sometimes not.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-338075312 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcJJYqjUDpJkqvfbfQPP3DX9PQrb8ks5st-wLgaJpZM4P3NGU . https://github.com/notifications/beacon/AEQrcGrBbiCsrQodSupGBpiZ9slGmXpBks5st-wLgaJpZM4P3NGU.gif

cbfraser avatar Oct 24 '17 16:10 cbfraser

I’ve done the straight forward traffic alert program.

I opted for a typical terse ATC traffic report –

“Traffic 12 oh clock high 5 miles”. It could be more verbose but I’m concerned that in

busy traffic audio bandwidth may be limited.

I’ve spent most of my time on collision detection which was far more complicated

and more interesting - will send that next.

I’ll need some direction on integration please– accessing the traffic.go data,

adding (better you add though) & reading configuration parameters & logging.

Out for a few weeks so can discuss but will do further work on return.

regards

From: cyoung [mailto:[email protected]] Sent: October-19-17 5:41 PM To: cyoung/stratux Cc: cbfraser; Mention Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

Excellent. We can include those libraries, yes. See ws://localhost/traffic and http://localhost/getSituation http://localhost/getSituation documented here https://github.com/cyoung/stratux/blob/master/notes/app-vendor-integration.md . Sometimes that information is available, sometimes not.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-338075312 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcJJYqjUDpJkqvfbfQPP3DX9PQrb8ks5st-wLgaJpZM4P3NGU .https://github.com/notifications/beacon/AEQrcGrBbiCsrQodSupGBpiZ9slGmXpBks5st-wLgaJpZM4P3NGU.gif

import subprocess

def audio_out(audio_str): """Generate audio out with eSpeak """ # need to pass eSpeak options # bluetooth option p = subprocess.Popen(["C:\eSpeak.exe",audio_str]) return

#!/usr/bin/env python

from traffic_alert import traffic_alert from audio_out import audio_out

while 1==1: b = int(input("bearing: (90)") or 90) v = int(input("vertical: (2000)") or 2000) m = int(input("miles: (5)") or 5)

print(traffic_alert(b,v,m))
audio_out(traffic_alert(b,v,m))

#!/usr/bin/env python

import math from math import atan, degrees

#convert ft to nm FT2NM = 0.0001645784

#possible configuration values high_angle = 15 # degrees low_angle = -15 # degrees

def traffic_alert(bearing, vertical, distance): """Generate audio alert string """ # bearing is relative to heading (-180 :: +180) # vertical: feet +- relative to ship # distance in nm

if bearing > 0:
    oclock = int((bearing + 15) / 30)
else:
    oclock = 12 + int((bearing - 15) / 30)
if oclock == 0:
    oclock = 12
    
#calcuate visual angle
angle = math.degrees(math.atan(vertical*FT2NM/distance))
visual_angle = ""
if angle < low_angle:
    visual_angle = "low "
elif angle > high_angle:
    visual_angle = "high "

return ("traffic " + str(oclock) + " oh clock " + visual_angle + str(int(distance))
        + " mile"+[" ","s, "][int(distance)>1])

cbfraser avatar Oct 25 '17 15:10 cbfraser

@cbfraser - I see some Python code, appears to be three scripts added to the body of the message. Yes, please use this thread to track progress. Could you maybe add the files to a ZIP and post on GitHub. I'll go from what you have to add the piece that pulls traffic information from Stratux and you can expand on it from there.

cyoung avatar Oct 25 '17 15:10 cyoung

Here are the files related to traffic alert. It uses atan & degrees from math, configured for windows environment. traffic alert.zip

cbfraser avatar Oct 25 '17 16:10 cbfraser

@cbfraser - committed these scripts to:

https://github.com/stratux/traffic_alert

See also the script that I added called "get_traffic.py". It will print traffic and situation updates to the screen. Perhaps you could fork from this and add changes on your GitHub account.

cyoung avatar Oct 25 '17 17:10 cyoung

Here is the more complex collision code - the test driver has option to output aircraft tracks to plotly (helpful when trying to visualize different scenarios) and optionally will read file with test data. Requires math and sympy and also plotly & plotly account if plotting output. collision_test.py - test driver collide.py - collision code Capture.jpg - sample plot test data template.tst - input values for test data headon.tst - 9 head on scenarios intersection.tst - 5 intersecting scenarios

Please post if a test scenario reveals an error (ideally with *.tst file). collision.zip

At a high level - traffic would be filtered on distance and vertical seperation, then traffic_alert would generate string for traffic and collision add collision warning if detected.

cbfraser avatar Oct 25 '17 22:10 cbfraser

ready to start integration testing - I've done python code in a windows environment, can I use the target rpi3 for development or do I need a 2nd one or a cross compile environment?

cbfraser avatar Nov 24 '17 17:11 cbfraser

The Raspberry Pi image includes Python (I believe 2.7). I'm developing on the Pi by SSH'ing in from a Windows 10 machine to run the code, and using WinSCP and Code to edit the scripts on the Windows 10 machine rather than use an editor on the Pi. I'm fairly new to Python and this setup works well for me.

Nokomis449 avatar Nov 24 '17 18:11 Nokomis449

integration on target rpi3 update: using 2nd board with ethernet for intial setup:

stratux-1.4r3 install via etcher

  • add shh, expand file system

espeak

  • sudo apt-get install espeak

sympy

  • udo pip install sympy

websocket

  • sudo pip install websocket-client

go land

  • sudo apt-get install golang-go
  • export GOROOT=/usr/lib/go

test programs traffic & collision alerts

now need to turn on traffic demo & rebuild stratux for bench testing

cbfraser avatar Nov 30 '17 20:11 cbfraser

build issues... suggestions appreciated

recovery steps so far:

  1. installed go sudo apt-get install golang-go

  2. export GOROOT=/usr/lib/go

  • now make hangs on: github.com/gorilla/websocket ../go_path/src/github.com/gorilla/websocket/client_clone_legacy.go:24: unknown tls.Config field 'GetCertificate' in struct literal ../go_path/src/github.com/gorilla/websocket/compression.go:36: undefined: flate.Resetter Makefile:17: recipe for target 'xgen_gdl90' failed make[1]: *** [xgen_gdl90] Error 2 make[1]: Leaving directory '/root/stratux' Makefile:14: recipe for target 'all' failed make: *** [all] Error 2

cbfraser avatar Nov 30 '17 22:11 cbfraser

Configuration Parameters: Need to define user/system parameters: Filter for audio alerts based on: traffic_distance traffic_separation (vertical) collision_window audio pacing for same target angle for target high/low

cbfraser avatar Dec 03 '17 00:12 cbfraser

first audio reports generated from live traffic - error in data feed - some mode S traffice reporting "BearingDist_valid": true, which I believe is not possible

but bearing and distance remain static and incorrect from actual tracked traffic "Bearing": 63.816254919902306, "Distance": 1.2317256536627878e+07

cbfraser avatar Dec 04 '17 06:12 cbfraser

Did you have record logs enabled? Could you share the logs?

cyoung avatar Dec 04 '17 14:12 cyoung

yes I can help you with that - what files do you want?

2017/12/04 17:27:28 C04414 => {"Icao_addr":12600340,"Reg":"C-FZUH","Tail":"e C-FZUH","Emitter_category":0,"OnGround":false,"Addr_type":0,"TargetType":0,"SignalLevel":-28.77129077135564,"Squawk":0,"Position_valid":false,"Lat":0,"Lng":0,"Alt":10475,"GnssDiffFromBaroAlt":0,"AltIsGNSS":false,"NIC":0,"NACp":0,"Track":0,"Speed":0,"Speed_valid":false,"Vvel":0,"Timestamp":"2017-12-04T17:27:26.76Z","PriorityStatus":0,"Age":1.74,"AgeLastAlt":1.42,"Last_seen":"0001-01-01T00:02:14.14Z","Last_alt":"0001-01-01T00:02:14.46Z","Last_GnssDiff":"0001-01-01T00:00:00Z","Last_GnssDiffAlt":0,"Last_speed":"0001-01-01T00:00:00Z","Last_source":1,"ExtrapolatedPosition":false,"BearingDist_valid":true,"Bearing":63.815863409600276,"Distance":1.2317282764558565e+07}

cbfraser avatar Dec 04 '17 17:12 cbfraser

/var/log/stratux.sqlite . Enable all logging in the webui first.

cyoung avatar Dec 04 '17 17:12 cyoung

stratux.zip here it is renamed from .sqlite to .txt to access from windows

cbfraser avatar Dec 04 '17 18:12 cbfraser

also seeing these same static values on type 1 targets (adsb) { "Icao_addr": 12615599, "Reg": "C-GWJE", "Tail": "eaC-GWJE", "Emitter_category": 0, "OnGround": false, "Addr_type": 0, "TargetType": 1, "SignalLevel": -27.09742730605482, "Squawk": 0, "Position_valid": false, "Lat": 0, "Lng": 0, "Alt": 20925, "GnssDiffFromBaroAlt": 325, "AltIsGNSS": false, "NIC": 8, "NACp": 8, "Track": 82, "Speed": 384, "Speed_valid": true, "Vvel": 3328, "Timestamp": "2017-12-04T23:23:09.808Z", "PriorityStatus": 0, "Age": 26.03, "AgeLastAlt": 20.63, "Last_seen": "0001-01-01T00:58:52.36Z", "Last_alt": "0001-01-01T00:58:57.76Z", "Last_GnssDiff": "0001-01-01T00:58:52.91Z", "Last_GnssDiffAlt": 20650, "Last_speed": "0001-01-01T00:58:52.91Z", "Last_source": 1, "ExtrapolatedPosition": false, "BearingDist_valid": true, "Bearing": 63.815778004276424, "Distance": 1.231728205534869e+07 earingDist_valid": true, "Bearing": 63.815778004276424, "Distance": 1.231728205534869e+07 }

cbfraser avatar Dec 04 '17 23:12 cbfraser

Reg and Tail values seem to always be the same

{"Icao_addr":12594428,"Reg":"C-FRAX","Tail":"e C-FRAX","E.....

I believe reg or tail is usually set to flight number on commercial flights, so could be an issue

while planefinder.net is showing flight number WS713 - C-FRAX

cbfraser avatar Dec 04 '17 23:12 cbfraser

Audio alerts would be really great because it would help to overcome integration probs with nav-software that does not (yet) compute the stratux output. Consider it an excellent feature. Since I am no good at programming I'd like to assist any testing on ground and in flight.

peterclubroad avatar Dec 16 '17 16:12 peterclubroad

good to hear

I think the other benefit is not having to be locked on watching the EFIS and also not having to estimate what traffic is a threat.

Do you know how to rsh to Stratux and copy files to the Stratux?

Do you pick up ADSB traffic at your house?

Does your aircraft have ADSB out?

Do you have a friend willing to help with flight testing with an aircraft with ADSB out?

From: peterclubroad [mailto:[email protected]] Sent: December-16-17 8:59 AM To: cyoung/stratux Cc: cbfraser; Mention Subject: Re: [cyoung/stratux] Feature request - Traffic audio alerts (#670)

Audio alerts would be really great because it would help to overcome integration probs with nav-software that does not (yet) compute the stratux output. Consider it an excellent feature. Since I am no good at programming I'd like to assist any testing on ground and in flight.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cyoung/stratux/issues/670#issuecomment-352195559 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEQrcEkh0QJrRYEzLanT1lwN4oPgIsRaks5tA_bGgaJpZM4P3NGU . https://github.com/notifications/beacon/AEQrcGYR7-0GEc10Ki3M49-H-nfkChgJks5tA_bGgaJpZM4P3NGU.gif

cbfraser avatar Dec 16 '17 17:12 cbfraser