mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-11-24 23:00:11 +00:00
mlat changes
This commit is contained in:
parent
a6f077fae2
commit
aba8cab58e
3 changed files with 105 additions and 26 deletions
37
README.md
37
README.md
|
@ -103,8 +103,8 @@ The sections below describe how to configure each part of the container function
|
|||
|
||||
Note:
|
||||
|
||||
- to enable a parameter, you can set it to any of `1`, `true`, `on`, `enabled`, `enable`, `yes`, or `y`. In the table below, we'll simply use `true` for convenience.
|
||||
- to disable a parameter, you can set it to anything else or simply leave it undefined.
|
||||
* to enable a parameter, you can set it to any of `1`, `true`, `on`, `enabled`, `enable`, `yes`, or `y`. In the table below, we'll simply use `true` for convenience.
|
||||
* to disable a parameter, you can set it to anything else or simply leave it undefined.
|
||||
|
||||
### General Configuration
|
||||
|
||||
|
@ -218,7 +218,7 @@ docker exec -it ultrafeeder /usr/local/bin/autogain1090 reset
|
|||
|
||||
In addition to (or instead of) connecting to a SDR or hardware device to get ADSB data, the container also supports ingesting data from a TCP port. Here are some parameters that you need to configure if you want to make this happen:
|
||||
|
||||
##### Mandatory parameters
|
||||
##### Networking parameters
|
||||
|
||||
| Environment Variable | Purpose | Default |
|
||||
|----------------------|---------|---------|
|
||||
|
@ -227,7 +227,7 @@ In addition to (or instead of) connecting to a SDR or hardware device to get ADS
|
|||
| `MLATHOST` | Legacy parameter. IP/Hostname of an MLAT provider (`mlat-client`). Note - using this parameter will not make the MLAT data part of the consolidated mlathub. The preferred way of ingesting MLAT results is using the `mlathub` functionality of the container, see below for details | |
|
||||
| `MLATPORT` | Legacy parameter used with `MLATHOST`. TCP port number of an MLAT provider (`mlat-client`) | 30105 |
|
||||
|
||||
###### Alternate Configuration Method with `READSB_NET_CONNECTOR`
|
||||
##### Alternate Configuration Method with `READSB_NET_CONNECTOR`
|
||||
|
||||
Instead of (or in addition to) using `BEASTHOST`, you can also define ADSB data ingests using the `READSB_NET_CONNECTOR` parameter. This is the preferred way if you have multiple sources or destinations for your ADSB data. This variable allows you to configure incoming and outgoing connections. The variable takes a semicolon (`;`) separated list of `host,port,protocol[,uuid=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX]`, where:
|
||||
|
||||
|
@ -282,6 +282,33 @@ There are many optional parameters relating to the ingestion of data and the gen
|
|||
| `READSB_JSON_INTERVAL` | Update interval for the webinterface in seconds / interval between aircraft.json writes | `--write-json-every=<sec>` | `1.0` |
|
||||
| `READSB_JSON_TRACE_INTERVAL` | Per plane interval for json position output and trace interval for globe history | `--json-trace-interval=<sec>` | `15` |
|
||||
| `READSB_FORWARD_MLAT_SBS` | If set to anthing, it will include MLAT results in the SBS/BaseStation output. This may be desirable if you feed SBS data to applications like [VRS](https://github.com/sdr-enthusiasts/docker-virtualradarserver) or [PlaneFence](https://github.com/kx1t/docker-planefence) | Unset |
|
||||
| `UUID` | Sets the UUID that is sent on the `beast_reduce_plus` port if no individual UUIDs have been defined with the `READSB_NET_CONNECTOR` parameter. Similarly, it's also used with `mlat-client` (see below) if no individual UUIDs have been set with the `MLAT_CONFIG` parameter. | | unset |
|
||||
|
||||
##### MLAT configuration
|
||||
|
||||
The Ultrafeeder contains a capability to send MLAT data to MLAT servers to be processed, and to receive the MLAT results and integrate those with an MLAT Hub and the `tar1090` map.
|
||||
It will create a separate instance of `mlat-client` for each defined MLAT server. The parameters for these `mlat-client` instances is as follows:
|
||||
|
||||
```yaml
|
||||
environment:
|
||||
...
|
||||
- MLAT_CONFIG=
|
||||
mlat-server1.com,port1,return_port1,uuid=1234-5678-90123,--extra-argument hello;
|
||||
mlat-server2.com,port2,return_port2,uuid=5678-9012-34567,--extra-argument hello
|
||||
...
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
* `mlat-server.com` is the domain name or ip address of the target MLAT server (mandatory)
|
||||
* `port` is the port (TCP or UDP) of the target MLAT server (mandatory)
|
||||
* `return_port` is the port at which the MLAT results are made available in BEAST format. We recommend to sequentially number them starting at 39000 (optional)
|
||||
* `uuid=xxxx` defines a unique user ID for this MLAT server instance. If included, the string must start with `uuid=` (optional)
|
||||
* `extra-arguments` are any additional command line arguments that you would like to use for this MLAT Client instance (optional)
|
||||
|
||||
Note - the three optional parameters (`return_port`, `uuid=`, and `extra-arguments`) can be given in any order.
|
||||
|
||||
If no UUID is specified with the `MLAT_CONFIG` parameter, it will use the value of the `UUID` parameter if it exists. If that fails, no UUID parameter is included with `mlat-client`.
|
||||
|
||||
### Web Gui (`tar1090`) Configuration
|
||||
|
||||
|
@ -291,7 +318,7 @@ The web interface is rendered to port `80` in the container. This can me mapped
|
|||
|
||||
All of the variables below are optional.
|
||||
|
||||
Note - due to design limitations of `readsb`, the `tar1090` graphical interface will by default ONLY show MLAT results from the aggregators/MLAT sources that were defined with the `MLAT_NET_CONNECTOR` parameter. If you want to show any additional MLAT results (for example, those from `piaware`), you should add a separate `READSB_NET_CONNECTOR` for them.
|
||||
Note - due to design limitations of `readsb`, the `tar1090` graphical interface will by default ONLY show MLAT results from the aggregators/MLAT sources that were defined with the `MLAT_NET_CONNECTOR` parameter. If you want to show any additional MLAT results (for example, those from `piaware`), you should add a separate `READSB_NET_CONNECTOR` entry for them.
|
||||
|
||||
#### `tar1090` Core Configuration
|
||||
|
||||
|
|
|
@ -54,7 +54,11 @@ if [[ -z "$ALT$READSB_ALT" ]]; then
|
|||
fi
|
||||
|
||||
# MLAT_CONFIG has the following format:
|
||||
# MLAT_CONFIG=mlatserver_1,mlatserver_port_1[,results_port_1[,extra_params_1]];mlatserver_2,mlatserver_port_2[,results_port_2[,extra_params_2]] etc
|
||||
# MLAT_CONFIG=mlatserver_1,mlatserver_port_1,x1,y1,z1;mlatserver_2,mlatserver_port_2,x2,y2,z2 etc
|
||||
# where x1,y1,z1; x22,y2,z2; etc are optional and are interpreted as follows:
|
||||
# if it's a number, we'll assume it's a port number for return messages
|
||||
# if it starts with 'uuid=', it's a UUID number for that instance
|
||||
# anything else will be appended as extra parameter(s) to the mlat-client command line
|
||||
|
||||
# parse MLAT_CONFIG string into mlat_configs array
|
||||
readarray -td ";" mlat_configs < <(printf '%s' "${MLAT_CONFIG// /}")
|
||||
|
@ -66,6 +70,9 @@ do
|
|||
# put individual params into the $params array:
|
||||
readarray -td "," params < <(printf '%s' "${instance}")
|
||||
|
||||
uuid_arg=false
|
||||
extra_args=""
|
||||
|
||||
# Check if the params array has values for the mandatory elements:
|
||||
if [[ -z "${params[0]}" ]] || [[ -z "${params[1]}" ]]
|
||||
then
|
||||
|
@ -75,6 +82,7 @@ do
|
|||
sleep infinity
|
||||
fi
|
||||
|
||||
# ------------------------------------------------
|
||||
# Build the MLAT parameter string:
|
||||
MLAT_PARAM=(--input-type "${MLAT_INPUT_TYPE}")
|
||||
MLAT_PARAM+=(--input-connect localhost:30005)
|
||||
|
@ -98,23 +106,59 @@ do
|
|||
MLAT_PARAM+=(--alt "${READSB_ALT}")
|
||||
fi
|
||||
|
||||
[[ -n "${MLAT_USER}" ]] && MLAT_PARAM+=(--user "${MLAT_USER}") || MLAT_PARAM+=(--user "${UUID}")
|
||||
[[ -n "${params[2]}" ]] && MLAT_PARAM+=("--results beast,listen,${params[2]}") || true
|
||||
[[ -n "${params[3]}" ]] && MLAT_PARAM+=("${params[3]}") || true
|
||||
if [[ -n "${MLAT_USER}" ]]; then
|
||||
MLAT_PARAM+=(--user "${MLAT_USER}")
|
||||
else
|
||||
rnd="${RANDOM}"
|
||||
echo "[$(date)][${APPNAME}] WARNING: MLAT_USER is not set - using random number \"${rnd}\" as MLAT_USER"
|
||||
MLAT_PARAM+=(--user "${rnd}")
|
||||
fi
|
||||
|
||||
# Now process the rest of the arguments
|
||||
# The order doesn't matter, we'll do pattern matching:
|
||||
# If the argument is a number, then it must be the beast_results port
|
||||
# If the argument starts with "uuid=", then it must be a UUID
|
||||
# If the argument isn't any of the above, then it's an "extra argument"
|
||||
|
||||
for ((i=2; i<${#params[*]}; i++))
|
||||
do
|
||||
if [[ -n "${params[i]}" ]] && [[ "${params[i]}" =~ ^[0-9]+$ ]]; then
|
||||
# It's a number so it must be the return port
|
||||
MLAT_PARAM+=("--results beast,listen,${params[i]}")
|
||||
|
||||
elif header="${params[i]:0:5}" && [[ "${header,,}" == "uuid=" ]]; then
|
||||
# It's a UUID
|
||||
MLAT_PARAM+=("--uuid ${params[i]:5}")
|
||||
uuid_arg=true
|
||||
|
||||
else
|
||||
# It's an Extra Args string
|
||||
extra_args="$extra_args ${params[i]}"
|
||||
|
||||
fi
|
||||
done
|
||||
# If no UUID was set in the argument strings, check if we can use the generic UUID parameter
|
||||
if [[ $uuid_arg == false ]] && [[ -n "${UUID}" ]]; then
|
||||
MLAT_PARAM+=("--uuid ${UUID}")
|
||||
fi
|
||||
# Now add the extra_args, if any:
|
||||
[[ -n "${extra_args}" ]] && MLAT_PARAM+=("${extra_args}") || true
|
||||
|
||||
# ------------------------------------------------
|
||||
# Create the command exec string:
|
||||
# shellcheck disable=SC2048,SC2086
|
||||
execstring="$(echo ${MLAT_CMD} ${MLAT_PARAM[*]} | xargs)"
|
||||
|
||||
# Wait a bit until readsb is established...
|
||||
if ! pgrep readsb >/dev/null
|
||||
then
|
||||
echo "[$(date)][mlathub] Delaying start of MLAT client(s) until container is established..."
|
||||
while ! pgrep readsb >/dev/null
|
||||
do
|
||||
sleep 2
|
||||
done
|
||||
fi
|
||||
sleep 10 # sleep a bit so everything is well established - starting readsb may take a bit
|
||||
# ------------------------------------------------
|
||||
# Ready to launch, but wait until readsb is established...
|
||||
if ! pgrep readsb >/dev/null; then
|
||||
echo "[$(date)][$APPNAME] Delaying start of MLAT client(s) until container is established..."
|
||||
while ! pgrep readsb >/dev/null
|
||||
do
|
||||
sleep 2
|
||||
done
|
||||
fi
|
||||
sleep 10 # sleep a bit so everything is well established - starting readsb may take a bit
|
||||
|
||||
# run this Mlat_client instance in the background:
|
||||
echo "[$(date)][${APPNAME}] starting: ${MLAT_CMD} ${MLAT_PARAM[*]}"
|
||||
|
@ -127,11 +171,14 @@ sleep 10 # sleep a bit so everything is well established - starting readsb m
|
|||
{ exec ${execstring} >/dev/null 2>/dev/null; } &
|
||||
fi
|
||||
|
||||
# pid_array is indexed by the PID of each mlat_client and contains the MLAT_PARAMs for that instance
|
||||
# This is done so we can monitor them and restart them if needed
|
||||
pid_array[$!]="${MLAT_PARAM[*]}"
|
||||
sleep 5
|
||||
done
|
||||
|
||||
# All MLAT Clients are up, so set the flag:
|
||||
# All MLAT Clients are up, so set the flag. This flag is read by MLATHUB as a sign that it's
|
||||
# safe to start up
|
||||
touch /run/mlathub_up
|
||||
|
||||
# Now iterate over all MLAT-client instances and check if they are still running:
|
||||
|
@ -143,7 +190,7 @@ do
|
|||
then
|
||||
# it exited - let's restart:
|
||||
sleep "${RESTARTTIMER}"
|
||||
[[ "${LOGLEVEL,,}" != "none" ]] && echo "[$(date)][${APPNAME}] MLAT_Client $(awk '{print $6}' <<< "${pid_array[$mlat_pid]}") exited. Attempting to restart." || true
|
||||
[[ "${LOGLEVEL,,}" != "none" ]] && echo "[$(date)][${APPNAME}] MLAT_Client $(awk '{print $6}' <<< "${pid_array[$mlat_pid]}") exited. Attempting to restart." || true
|
||||
# shellcheck disable=SC2086
|
||||
execstring="$(echo ${MLAT_CMD} ${pid_array[$mlat_pid]} | xargs)"
|
||||
|
||||
|
|
|
@ -43,12 +43,17 @@ do
|
|||
# put individual params into the $params array:
|
||||
readarray -td "," params < <(printf '%s' "${instance}")
|
||||
|
||||
if [[ -n "${params[2]}" ]]
|
||||
then
|
||||
MLATHUB_CMD+=("--net-connector=localhost,${params[2]},beast_in")
|
||||
(( mlat_result_sources++ )) || true
|
||||
fi
|
||||
for ((i=2; i<${#params[*]}; i++))
|
||||
do
|
||||
if [[ -n "${params[i]}" ]] && [[ "${params[i]}" =~ ^[0-9]+$ ]]; then
|
||||
# the parameter is a number and it is assumed that this is the beast_results port
|
||||
MLATHUB_CMD+=("--net-connector=localhost,${params[i]},beast_in")
|
||||
(( mlat_result_sources++ )) || true
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if (( mlat_result_sources == 0 ))
|
||||
then
|
||||
echo "[$(date)][mlathub] No MLAT servers have been defined in MLAT_CONFIG - no need to start MLATHUB"
|
||||
|
|
Loading…
Reference in a new issue