Skip to content

Instantly share code, notes, and snippets.

@okalachev
Last active July 25, 2018 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save okalachev/5b6836999bcae2d4893b9773401a6759 to your computer and use it in GitHub Desktop.
Save okalachev/5b6836999bcae2d4893b9773401a6759 to your computer and use it in GitHub Desktop.

MAVLink Switch

Configuration

MAVLink Switch is configured using a configuration YAML file, containing endpoints and rules sets.

Endpoints

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.

Rules

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.

Example

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment