Skip to content

GCS Configuration

Initial setup

Download Hub and install its dependencies

git clone --recursive https://github.com/tritonuas/hub.git 
cd hub
make install-dependencies

There are three ways of running Hub:

  1. Locally
  2. With a Docker container
  3. Through Docker Compose alongside InfluxDB, Grafana and SITL (our SITL build)

Local

Run

make build
make run

Configuration

To run Hub with additional options add command line arguments separated by spaces.

Example:

make run MAV_DEVICE=tcp:127.0.0.1:5760 MAV_OUTPUT1=udp:127.0.0.1:14550

Options

  • INTEROP_IP
  • IP of interop computer
  • INTEROP_PORT
  • Port of interop computer
  • INTEROP_USER
  • Username on interop computer
  • INTEROP_PASS
  • Password on interop computer
  • MAV_DEVICE
  • Address and port of plane to receive mavlink messages from
  • If SITL is being run using docker-compose, set the address and port to match one of mavproxy's output addresses and ports.
    • Example: udp:mavproxy:14551
  • Can be a serial, UDP, or TCP connection
  • See Docker networking for more information on connecting to ports on localhost or 127.0.0.1
  • Format: connectionType:address:port
  • Example formats:
    • serial:/dev/serial
    • tcp:172.17.0.1:14550
    • udp:172.17.0.1:14550
  • INFLUXDB_BUCKET
  • Name of bucket where data is stored on InfluxDB
  • Should match the bucket flag from the influxdb_cli container
  • INFLUXDB_ORG
  • Name of InfluxDB organization
  • Should match the org flag from the influxdb_cli container
  • INFLUXDB_URI
  • URI of InfluxDB for mavlink messages to be written to
  • If InfluxDB is being run using docker-compose, set the address to influxdb to work with docker's internal networking
    • Example: http://influxdb:8086
  • Should match the host flag from the influxdb_cli container
  • The port should also match the port of the influxdb container
  • INFLUXDB_TOKEN
  • Token that allows Hub to have read/write access to the database
  • Should match the token flag from the influxdb_cli container
  • HUB_PATH
  • Path to Hub package
  • Should be: /go/src/github.com/tritonuas/hub

Docker

Dependencies

Run

make build-docker
docker run --network=host tritonuas/hub

or

make build-docker 
make run-docker

If changes are made to hub, the docker container must be rebuilt using make docker-build

Configuration

To run Hub with additional options add command line arguments separated by spaces with a -e flag before each.

Example:

docker run -e MAV_DEVICE=tcp:172.17.0.1:5760 -e MAV_OUTPUT1=udp:172.17.0.1:14550 --network=host tritonuas/hub

Check out here for a complete list of options.

Docker Compose

To run Hub, SITL (our SITL build), Mavproxy, Grafana and InfluxDB concurrently run the containers using the docker-compose.yml file included in Hub.

Dependencies

Run

There are two ways to run the docker-compose workflow:

1) With a simulated plane for testing/development purposes.

make run-compose

2) With the actual plane physically connected to the computer.

make run-broach-compose

If changes are made to hub, the docker container must be rebuilt using make build-docker

To access the graphical visualizations of plane telemetry through Grafana, open a web browser and navigate to localhost:3000. If prompted for a login, enter username "admin" and password "admin". Select a dashboard and view the data.

Grafana Dashboard

Edit Dashboards

Create and edit data on dashboards using the Flux Language

Check out here and here for a list of MAVLink message types, fields, and units typically used by our aircraft.

Any newly created dashboards or edits made to existing dashboards will not be saved if Grafana is closed and relaunched. To save dashboards after Grafana is closed create/edit dashboards in the deployments/grafana/dashboards folder in Hub.

Example Query

from(bucket: "mavlink")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) =>
    r._measurement == "VFR_HUD" and
    r._field == "throttle"
  )

With unit conversion:

from(bucket: "mavlink")
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) =>
    r._measurement == "GLOBAL_POSITION_INT" and
    r._field == "hdg"
  )
  |> map(fn: (r) => ({ r with _value: r._value / 100.0 }))
  |> aggregateWindow(every: 500ms, fn: mean)

Logging

Once docker-compose is running visit localhost:9999 in a web browser to view each container's logs.

Dozzle Logs

Configuration

Edit the following fields in the docker-compose.yml file found in the deployments folder in Hub

hub

  • environment
  • Check out here for a complete list of environment variables

influxdb

  • ports
  • Port of InfluxDB database and front-end GUI
  • Default: "8086:8086"
  • If this port is changed, also change the INFLUXDB_URI environment variable in Hub and the --host flag in influxdb_cli

influxdb_cli

  • entrypoint
  • --bucket
    • Name of bucket where data is stored
    • Should match the INFLUXDB_BUCKET environment variable from the Hub container
  • --org
    • Name of InfluxDB organization
    • Should match the INFLUXDB_ORG environment variable from the Hub container
  • --token
    • Token that allows Hub to have read/write access to the database
    • Should match the INFLUXDB_TOKEN environment variable from the Hub container
  • --username
    • Username used to sign in and view the InfluxDB front-end web application
  • --password
    • Password used to sign in and view the InfluxDB front-end web application
  • --host
    • URI of InfluxDB to configure
    • Typically is http://influxdb:8086 to work with Docker's internal networking
    • Should match the INFLUXDB_URI environment variable from the Hub container
    • The port should also match the port of the influxdb container

For more information check out the InfluxDB documentation.

grafana

  • environment
  • Grafana configuration options can be found here.
  • volumes
  • To make files such as dashboards and Grafana configuration files accessible to the docker container they must be specified here.
  • Example:
    - ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml
    - ./grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
    - ./grafana/dashboards/:/var/lib/grafana/dashboards

sitl

  • ports
  • Port where the virtual plane will be hosted on
  • Default: "5760:5760"
  • If this port is changed, also change the MAV_DEVICE environment variable in Hub. More info here

mavproxy

  • environment
  • MASTER
    • The address and port where mavproxy should take in messages from.
    • Typically is --master=tcp:sitl:5760 to connect with the virtual plane
    • If connected to a physical plane, use a serial connection such as --master=/dev/ttyUSB0
  • OUT[1-5]
    • Five different addresses and ports that mavproxy will forward messages to.
    • OUT1 should typically be --out=udp:172.17.0.1:14550 to forward messages to MissionPlanner/QGroundControl
    • OUT2 should typically be --out=tcpin:mavproxy:14551 to forward messages to Hub
  • devices
  • If connected to a physical plane change this to the serial port of the plane.
  • Example: /dev/ttyUSB0:/dev/ttyUSB0

dozzle

Configuration opptions can be found here.

Docker networking

When attempting to connect to a port on localhost or 127.0.0.1 from the host machine, use the address 172.17.0.1 instead.

Read up more on communicating between the Docker host and the bridge network here.

Troubleshooting

If you get this error:

ERROR: for influxdb  Cannot start service influxdb: driver failed programming external connectivity on endpoint ...

Stop the influxd container running in the background with the command killall influxd and attempt to run the docker containers again.