MAVLink Switch is configured using a configuration YAML file, containing endpoints and rules sets.
Endpoint protocols:
[serial:]<file>[:<baudrate>]
– a serial device file;udp://[<local_host>[:<local_port>]]@<remote_host>[:<remote_port>]
– UDP.
The default local host is 0.0.0.0
, the default ports are 14550
.
Endpoints options:
url
String – link URL (required);name
String – endpoint name;broadcast
Boolean – enable UDP broadcasting;interface
String – network interface;discovery
Boolean – discovering mode: memorize remote endpoint on respond;discovery_timeout
Number – discovered endpoint invalidation timeout.
A message is getting passed if at least one rule matches. If multiple rules match the same endpoints pair, the first rule is applied.
Rules options:
from
String – input endpoint name;to
String – output endpoint name;min_interval
Number – minimal message interval (for rate limiting);remote_exists
Boolean – pass message only if the remote has not timed out;header
Object – match MAVLink header fields;message
Object – match specific MAVLink message fields;log
Boolean – log passed messages.
Note: message
option enables MAVLink message parser. This filtering will be skipped on an incompatible MAVLink message.
mavlink:
dialect: "common"
version: 2
endpoints:
- name: "pixhawk"
url: "serial:/dev/ttyS0"
- name: "vpn"
url: "udp://@72.11.6.255:14550" # network interface is determined by the subnet
broadcast: true
- name: "wifi"
url: "udp://@192.168.0.255:14550"
broadcast: true
discovery: true
# a message should match at least one rule to get passed
rules:
- from: pixhawk # pass the global position to the internet
to: vpn
header:
msgid: GLOBAL_POSITION_INT # string ID representation is replaced to a number automatically
min_interval: 1 # miminal interval in seconds for the rule
- from: pixhawk
to: wifi
- from: wifi
to: pixhawk