项目作者: wiedehopf

项目描述 :
Detached fork of Mictronics readsb and by extension dump1090-fa by mutability
高级语言: C
项目地址: git://github.com/wiedehopf/readsb.git
创建时间: 2021-01-02T10:44:43Z
项目社区:https://github.com/wiedehopf/readsb

开源协议:Other

下载


Readsb

This is a detached fork of https://github.com/Mictronics/readsb

It’s continually under development, expect bugs, segfaults and all the good stuff :)

NO WARRANTY

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS”
see the LICENSE file for details

how to install / build

I’d recommend this script to automatically install it:

Or build the package yourself:

  1. sudo apt update
  2. sudo apt install --no-install-recommends --no-install-suggests -y \
  3. git build-essential debhelper libusb-1.0-0-dev \
  4. librtlsdr-dev librtlsdr0 pkg-config fakeroot \
  5. libncurses-dev zlib1g-dev zlib1g libzstd-dev libzstd1
  6. git clone --depth 20 https://github.com/wiedehopf/readsb.git
  7. cd readsb
  8. export DEB_BUILD_OPTIONS=noddebs
  9. dpkg-buildpackage -b -Prtlsdr -ui -uc -us
  10. sudo dpkg -i ../readsb_*.deb

Or check here for more build instructions and other useful stuff:

For macOS / OS X check build and general info, check further down

aircraft.json format:

json file Readme

Push server support

readsb connects to a listening server.

Sending beast data (beast_out):

  1. --net-connector 192.168.2.22,30004,beast_out

Receiving beast data (beast_in);

  1. --net-connector 192.168.2.28,30005,beast_in

BeastReduce output

Selectively forwards beast messages if the received data hasn’t been forwarded in the last 125 ms (or --net-beast-reduce-interval).
Data not related to the physical aircraft state are only forwarded every 500 ms (4 * --net-beast-reduce-interval).The messages of
this output are normal beast messages and compatible with every program able to receive beast messages.

This is used by some aggregators to aggregate ADS-B data, an example net connector would be:

  1. --net-connector=feed.airplanes.live,30004,beast_reduce_plus_out,uuid=0033062d-e17e-4389-91a9-79ebb967fb4c

The uuid is optional, if none is given, the uuid from —uuid-file is used, if that isn’t present no uuid is sent.
The beast_reduce_out net-connector will never send an uuid.
The aggregator enables —net-receiver-id and —net-ingest on their readsb server, it’s made to work with beast_reduce_plus_out.

Debian package

  • Build package with no additional receiver library dependencies: dpkg-buildpackage -b.
  • Build with RTLSDR support: dpkg-buildpackage -b --build-profiles=rtlsdr

Building manually

You can probably just run “make”. By default “make” builds with no specific library support. See below.
Binaries are built in the source directory; you will need to arrange to
install them (and a method for starting them) yourself.

“make RTLSDR=yes” will enable rtl-sdr support and add the dependency on
librtlsdr.

On Raspbian 32 bit, mostly rpi2 and older you might want to use this to compile if you’re running into CPU issues:

  1. make AIRCRAFT_HASH_BITS=11 RTLSDR=yes OPTIMIZE="-Ofast -mcpu=arm1176jzf-s -mfpu=vfp"

In general if you want to save on CPU cycles, you can try building with these options:

  1. make AIRCRAFT_HASH_BITS=11 RTLSDR=yes OPTIMIZE="-O3 -march=native"

Or even more aggressive but could cause unexpected behaviour:

  1. make AIRCRAFT_HASH_BITS=11 RTLSDR=yes OPTIMIZE="-Ofast -march=native"

The difference of using -Ofast or -O3 over the default of -O2 is likely very minimal.
-march=native also usually makes little difference but it might, so it’s worth a try.

Configuration

If required, edit /etc/default/readsb to set the service options, device type, network ports etc.

Autogain

For rtl-sdr devices a software gain algorithm is the default, it’s optimized for ADS-B.
On the command line it’s activated using --gain=auto an is silent by default.
--gain=auto-verbose can be used to enable log messages for gain changes.
To tweak the internals, more parameters can be passed:

  1. --gain=auto-verbose,<lowestGain>,<noiseLowThreshold>,<noiseHighThreshold>,<loudThreshold>

The defaults are:

  1. --gain=auto-verbose,0,25,31,243

The thresholds are numbers 0 to 256, tweaking them requires some understanding of how it works.
One option would be to change the noise thresholds up or down and then observe the log.
There should be no need to tweak these parameters.

rtl-sdr bias tee

Use this utility independent of readsb:
https://github.com/wiedehopf/adsb-wiki/wiki/RTL-Bias-Tee

Global map of aircraft

One of this forks main uses is to be the backend of a global map.
For that purpose it’s used in conjunction with tar1090 with some extra options to cope with the number of aircraft and also record a history of flight paths: https://github.com/wiedehopf/tar1090#0800-destroy-sd-card

Websites using this software:

Projects that use or have used data generated by this software:

Saving traces

History function as used by several online aggregators using tar1090.

Warning: the following will generate several thousand files a day and can use significant amounts of
disk space depending on your data source.

The following command line options need to be added to for example the decoder options in /etc/default/readsb

  1. --write-globe-history /var/globe_history --heatmap 30

To increase time resolution to maximum, you can add --json-trace-interval=0.1 which will add every
position received to traces. The heatmap interval can also be reduced from the default of 30
seconds, i wouldn’t recommend less than 5 seconds for that though.

Aggregators will generally use --write-json-globe-index as well but that’s not necessary if you don’t have more than 500 concurrent planes.

/var/globe_history needs to be a directory writeable by the user readsb.
sudo mkdir /var/globe_history and sudo chown readsb /var/globe_history are useful for that.

You should also download

  1. wget -O /usr/local/share/tar1090/aircraft.csv.gz https://github.com/wiedehopf/tar1090-db/raw/csv/aircraft.csv.gz

and add this command line option (for exaple via /etc/default/readsb):

  1. --db-file /usr/local/share/tar1090/aircraft.csv.gz

This will obviously write data to the hard drive, be aware of that.
The data format is subject to change, don’t expect this to be stable.
Be aware of that when upgrading either tar1090 or readsb to a new commit.

If you’re using —write-json-globe-index, it’s also recommended to use —tar1090-use-api
It will use the readsb API to get data, it’s less requests and usually more efficient,
for details see the file nginx-readsb-api.conf
(this needs adding to your existing nginx tar1090 configuration, this is only for people who really know their stuff anyway)

If configuring this stuff seems complicated, consider just using the sdr-enthusiasts ultrafeeder
container. Just don’t configure feeds for aggregated data or if you don’t want to feed data from
there.

non-SDR data source

If you don’t want readsb to read data from the SDR, you’ll also need to change the receiver options line to something like this:

  1. RECEIVER_OPTIONS="--net-only --net-connector 192.168.2.7,30005,beast_in"

If you have another dump1090/readsb running on the same machine, you’ll also need to change all the ports to avoid conflicts.

—debug=S: speed check debugging output

For current reference please see the speed_check function.

hex

SQ means same quality (ADS-B vs MLAT and stuff)
LQ means lower quality

fail / ok
ok means speed check passed (displayed only with cpr-focus)

A means airborne and S means surface.

reliable is my reliability counter
every good position increases each aircrafts position reliability,
if it gets to zero, speed check is no longer applied and it’s allowed to “JUMP”,
“JUMP” is also allowed if we haven’t had a position for 2 minutes.

tD is the trackDifference
170 or 180 means the new position goes in the opposite direction of the ground track broadcast by the aircraft.

then we have actual distance / allowed distance.
the allowed distance i tweak depending on the trackDifference
high trackDifference makes the allowed distance go slightly negative
as i don’t want aircraft to jump backwards.

elapsed time

actual / allowed speed (allowed speed based on allowed distance)

old —> new
lat, lon -> lat, lon

oh if you want that display:
—debug=S
you’ll have to update, just disabled the MLAT speed check from displayign stuff … because usually it’s not interesting

Apple / macOS / OS X

Thank you to https://github.com/ind006/readsb_macos/ for all the shims needed to make this work.

readsb should be (largely) compatible with macOS, on both Intel and ARM architectures.
You may need to modify the Makefile to point at where on your mac you have the standard libs and includes installed.
This in turn depends on whether you’re using macports or homebrew for those libs and includes. The Makefile has paths
pre-set for homebrew.

These packages are needed, possibly more:

  1. brew install git librtlsdr libusb ncurses

Build using:

  1. make -j4 RTLSDR=yes

You can run it from the command line (try screen -S readsb and run it in there, press ctrl-A to detach the terminal)
Example command line:

  1. ./readsb --quiet --net --device-type rtlsdr --gain auto
  2. # add console table of planes for a quick test:
  3. --interactive
  4. # optionally add coordinates:
  5. --lat -33.874 --lon 151.206
  6. # add --interactive for testing, it will show a list of planes in the terminal
  7. # optional output of json and other regularly updated files:
  8. --write-json-every 0.5 --write-json=/tmp/readsb_run
  9. # optional database info
  10. --db-file ~/tar1090/aircraft.csv.gz
  11. # optional listen ports:
  12. --net-ri-port 30001 --net-ro-port 30002 --net-sbs-port 30003 --net-bi-port 30004,30104 --net-bo-port 30005
  13. # optional sending of data to an aggregator:
  14. --net-connector feed.flyrealtraffic.com,30004,beast_reduce_plus_out,7817bd08-f226-11ef-ba9e-072eee452592

For a graphical interface, the tar1090 webinterface is recommended: https://github.com/wiedehopf/tar1090
The install script won’t work so i’d recommend the following basic webserver configuration:

  • serve the html directory as /tar1090
  • serve the write-json directory as /tar1090/data
  1. git clone https://github.com/wiedehopf/tar1090 ~/tar1090
  2. wget -O ~/tar1090/aircraft.csv.gz https://github.com/wiedehopf/tar1090-db/raw/csv/aircraft.csv.gz

For nginx this would look something like this (replace USER appropriately):

  1. location /tar1090/data/ {
  2. alias /tmp/readsb_run/;
  3. add_header Cache-Control "no-cache";
  4. location /tar1090/data/traces/ {
  5. gzip off;
  6. add_header Content-Encoding "gzip";
  7. add_header Cache-Control "no-cache";
  8. }
  9. }
  10. location /tar1090/globe_history/ {
  11. alias /home/USER/readsb_history/;
  12. gzip off;
  13. add_header Content-Encoding "gzip";
  14. add_header Cache-Control "no-cache";
  15. }
  16. location /tar1090 {
  17. alias /home/USER/tar1090/html/;
  18. add_header Cache-Control "no-cache";
  19. }

An easy way to add some traces when selecting a plane:
Add --write-globe-history=/home/USER/readsb_history to the readsb command line.
You can also serve this folder as /tar1090/globe_history but that’s only required for the history going back further
than 24h.

The classical tar1090 uses traces created via a shell script and served at /tar1090/chunks but running that shell
script is probably a hassle, so just use the above.

readsb —help

might be out of date, check the command on a freshly compiled version

  1. Usage: readsb [OPTION...]
  2. readsb Mode-S/ADSB/TIS Receiver
  3. Build options:
  4. General options:
  5. --cpr-focus=<hex> show CPR details for this hex
  6. --db-file=<file.csv.gz> Default: "none" (as of writing a compatible
  7. file is available here:
  8. https://github.com/wiedehopf/tar1090-db/tree/csv)
  9. --db-file-lt Write long type to aircraft.json as field desc
  10. --debug=<flags> Debug mode (verbose), n: network, P: CPR, S: speed
  11. check
  12. --device-type=<type> Select SDR type
  13. --filter-DF=<type> When displaying decoded ModeS messages on stdout
  14. only show this DF type
  15. --fix Enable CRC single-bit error correction (default)
  16. --forward-mlat Allow forwarding of received mlat results to
  17. output ports
  18. --freq=<hz> Set frequency (default: 1090 MHz)
  19. --gain=<db> Set gain (default: max gain. Use -10 for
  20. auto-gain)
  21. --gnss Show altitudes as GNSS when available
  22. --heatmap=<interval in seconds>
  23. Make Heatmap, each aircraft at most every interval
  24. seconds (creates historydir/heatmap.bin and exit
  25. after that)
  26. --heatmap-dir=<dir> Change the directory where heatmaps are saved
  27. (default is in globe history dir)
  28. --interactive Interactive mode refreshing data on screen.
  29. Implies --throttle
  30. --interactive-ttl=<sec> Remove from list if idle for <sec> (default:
  31. 60)
  32. --jaero-timeout=<n> How long in minutes JAERO positions remain valid
  33. and on the map in tar1090 (default:33)
  34. --json-location-accuracy=<n>
  35. Accuracy of receiver location in json metadata:
  36. 0=no location, 1=approximate, 2=exact
  37. --json-reliable=<n> Minimum position reliability to put it into json
  38. (default: 1, globe options will default set this
  39. to 2, disable speed filter: -1, max: 4)
  40. --json-trace-hist-only=1,2,3,8
  41. Don't write recent(1), full(2), either(3) traces
  42. to /run, only archive via write-globe-history (8:
  43. irregularly write limited traces to run, subject
  44. to change)
  45. --json-trace-interval=<seconds>
  46. Interval after which a new position will
  47. guaranteed to be written to the trace and the json
  48. position output (default: 30)
  49. --lat=<lat> Reference/receiver surface latitude
  50. --leg-focus=<hex> show leg marking details for this hex
  51. --lon=<lon> Reference/receiver surface longitude
  52. --max-range=<dist> Absolute maximum range for position decoding (in
  53. nm, default: 300)
  54. --metric Use metric units
  55. --mlat Display raw messages in Beast ASCII mode
  56. --modeac Enable decoding of SSR Modes 3/A & 3/C
  57. --modeac-auto Enable Mode A/C if requested by a Beast
  58. connection
  59. --no-fix Disable CRC single-bit error correction
  60. --no-fix-df Disable CRC single-bit error correction on the DF
  61. type to produce more DF17 messages (disabling
  62. reduces CPU usage)
  63. --no-interactive Disable interactive mode, print to stdout
  64. --onlyaddr Show only ICAO addresses
  65. --position-persistence=<n> Position persistence against outliers
  66. (default: 4), incremented by json-reliable minus
  67. 1
  68. --preamble-threshold=<40-400>
  69. lower threshold --> more CPU usage (default: 58,
  70. pi zero / pi 1: 75, hot CPU 42)
  71. --quiet Disable output (default)
  72. --range-outline-hours=<hours>
  73. Make the range outline retain data for the last X
  74. hours (float, default: 24.0)
  75. --raw Show only messages hex values
  76. --receiver-focus=<receiverId>
  77. only process messages from receiverId
  78. --show-only=<addr> Show only messages by given ICAO on stdout
  79. --snip=<level> Strip IQ file removing samples < level
  80. --stats With --ifile print stats at exit. No other output
  81. --stats-every=<sec> Show and reset stats every <sec> seconds
  82. --stats-range Collect/show range histogram
  83. --trace-focus=<hex> show traceAdd details for this hex
  84. --write-globe-history=<dir>
  85. Extended Globe History
  86. --write-json=<dir> Periodically write json output to <dir>
  87. --write-json-binCraft-only=<n>
  88. Use only binary binCraft format for globe files
  89. (1), for aircraft.json as well (2)
  90. --write-json-every=<sec> Write json output and update API json every
  91. sec seconds (default 1)
  92. --write-json-globe-index Write specially indexed globe_xxxx.json files
  93. (for tar1090)
  94. --write-json-gzip Write aircraft.json also as aircraft.json.gz
  95. --write-prom=<filepath> Periodically write prometheus output to
  96. <filepath>
  97. --write-receiver-id-json Write receivers.json
  98. --write-state=<dir> Write state to disk to have traces and outline
  99. after a restart
  100. --write-state-only-on-exit Don't continously update state.
  101. Network options:
  102. --net Enable networking
  103. --net-api-port=<port> TCP API listen port (in contrast to other
  104. listeners, only a single port is allowed) (update
  105. frequency controlled by write-json-every
  106. parameter) (default: 0)
  107. --net-beast-reduce-filter-alt=<pressure altitude in ft>
  108. beast-reduce: remove aircraft which are above
  109. altitude
  110. --net-beast-reduce-filter-dist=<distance in nmi>
  111. beast-reduce: remove aircraft which are further
  112. than distance from the receiver
  113. --net-beast-reduce-interval=<seconds>
  114. BeastReduce position update interval, longer means
  115. less data (default: 0.125, valid range: 0.000 -
  116. 14.999)
  117. --net-beast-reduce-out-port=<ports>
  118. TCP BeastReduce output listen ports (default: 0)
  119. --net-bi-port=<ports> TCP Beast input listen ports (default: 0)
  120. --net-bind-address=<ip> IP address to bind to (default: Any; Use
  121. 127.0.0.1 for private)
  122. --net-bo-port=<ports> TCP Beast output listen ports (default: 0)
  123. --net-buffer=<n> TCP buffer size 64Kb * (2^n) (default: n=2, 256Kb)
  124. --net-connector=<ip,port,protocol>
  125. Establish connection, can be specified multiple
  126. times (e.g. 127.0.0.1,23004,beast_out) Protocols:
  127. beast_out, beast_in, raw_out, raw_in, sbs_in,
  128. sbs_in_jaero, sbs_out, sbs_out_jaero, sbs_out_prio
  129. vrs_out, json_out, asterix_out, asterix_in,
  130. gpsd_in (one failover ip/address,port can be specified:
  131. primary-address,primary-port,protocol,failover-address,failover-port)
  132. --net-connector-delay=<seconds>
  133. Outbound re-connection delay (default: 30)
  134. --net-garbage=<ports> timeout receivers, output messages from timed out
  135. receivers as beast on <ports>
  136. --net-heartbeat=<rate> TCP heartbeat rate in seconds (default: 60 sec; 0
  137. to disable)
  138. --net-ingest primary ingest node
  139. --net-json-port=<ports> TCP json position output listen ports, sends
  140. one line with a json object containing aircraft
  141. details for every position received (default: 0)
  142. --net-json-port-include-noposition
  143. TCP json position output: include aircraft without
  144. position (state is sent for aircraft for every
  145. DF11 with CRC if the aircraft hasn't sent a
  146. position in the last 10 seconds and interval
  147. allowing)
  148. --net-json-port-interval=<seconds>
  149. Set minimum interval between outputs per aircraft
  150. for TCP json output, default: 0.0 (every
  151. position)
  152. --net-only Enable just networking, no RTL device or file
  153. used
  154. --net-receiver-id forward receiver ID
  155. --net-ri-port=<ports> TCP raw input listen ports (default: 0)
  156. --net-ro-interval=<rate> TCP output flush interval in seconds (maximum
  157. interval between two network writes of accumulated
  158. data)(default: 0.05, valid values 0.005 - 1.0)
  159. --net-ro-port=<ports> TCP raw output listen ports (default: 0)
  160. --net-ro-size=<size> TCP output flush size (maximum amount of
  161. internally buffered data before writing to
  162. network) (default: 1200)
  163. --net-sbs-in-port=<ports> TCP BaseStation input listen ports (default:
  164. 0)
  165. --net-sbs-jaero-in-port=<ports>
  166. TCP SBS Jaero input listen ports (default: 0)
  167. --net-sbs-jaero-port=<ports>
  168. TCP SBS Jaero output listen ports (default: 0)
  169. --net-sbs-port=<ports> TCP BaseStation output listen ports (default: 0)
  170. --net-sbs-reduce Apply beast reduce logic and interval to SBS
  171. outputs
  172. --net-ao-port=<ports> TCP ASTERIX output listen ports (default: 0)
  173. --net-ai-port=<ports> TCP ASTERIX input listen ports (default: 0)
  174. --net-asterix-reduce Apply beast reduce logic and interval to ASTERIX
  175. outputs
  176. --net-verbatim Forward messages unchanged
  177. --net-vrs-interval=<seconds>
  178. TCP VRS json output interval (default: 5.0)
  179. --net-vrs-port=<ports> TCP VRS json output listen ports (default: 0)
  180. --uuid-file=<path> path to UUID file
  181. Modes-S Beast options, use with --device-type modesbeast:
  182. --beast-baudrate=<baud> Override Baudrate (default rate 3000000 baud)
  183. --beast-crc-off Turn OFF CRC checking
  184. --beast-df045-on Turn ON DF0/4/5 filter
  185. --beast-df1117-on Turn ON DF11/17-only filter
  186. --beast-fec-off Turn OFF forward error correction
  187. --beast-mlat-off Turn OFF MLAT time stamps
  188. --beast-modeac Turn ON mode A/C
  189. --beast-serial=<path> Path to Beast serial device (default
  190. /dev/ttyUSB0)
  191. GNS HULC options, use with --device-type gnshulc:
  192. --beast-serial=<path> Path to GNS HULC serial device (default
  193. /dev/ttyUSB0)
  194. ifile-specific options, use with --ifile:
  195. --ifile=<path> Read samples from given file ('-' for stdin)
  196. --iformat=<type> Set sample format (UC8, SC16, SC16Q11)
  197. --throttle Process samples at the original capture speed
  198. Help options:
  199. -?, --help Give this help list
  200. --usage Give a short usage message
  201. -V, --version Print program version