Setup companion computer

How to set up companion computer to communicate with GCS.uno

These guide describes how to setup any Linux-based computer as a companion one. It can either be your laptop or headless Raspberry Pi on the ground or micro-PC onboard.

How it works

Telemetry messages got from autopilot board over serial or USB port, by wires or radio link, then a small script transmits these messages to GCS.uno server. When you open GCS.uno dashboard in a web-browser, this telemetry is got from server and rendered to a screen almost in realtime. In opposite direction, you press an action button on a web-page, this magically transforms to a MAVLink message and reaches onboard autopilot to be executed.

Assuming you have your computer running with internet connected and command shell available.

Install MAVProxy

MAVProxy is a fully-functioning command-line GCS for UAVs. It is used to proxy one telemetry source to many different locations. For example, one for GCS.uno script, one for ROS, and another one for QGroundControl in local network.

Follow official MAVProxy manual to install it on your system.

Telemetry source

If companion computer is placed onboard, it likely communicates with autopilot over serial (UART) port. Here is a good example of configuring Pixhawk with Raspberry Pi. Radio modems can be connected either over serial or USB port. Follow modem's manuals to connect it to your computer.

Serial port

Check it with MAVProxy:

sudo -s
mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600

This command makes MAVProxy listen serial port 0 for telemetry messages and show autopilot's status messages in console. The same source will be also for a radio modem, connected over serial port.

USB port

Check it with MAVProxy:

sudo -s
mavproxy.py --master=/dev/ttyUSB0 --baudrate 57600

UDP port

MAVProxy can also listen to local UDP port:

mavproxy.py --master=udp:127.0.0.1:UDP_PORT

If MAVProxy successfully connects with your autopilot continue with installing GCS.uno board scripts.

Install additional dependencies

NodeJS

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -sudo apt-get install -y nodejs build-essential

PM2 process manager

sudo npm install pm2 -g

Download and install board scripts

cd
git clone https://github.com/GCS-uno/drone_board.git
cd drone_board
npm install

Inside drone_board directory you can find two shell scripts mavproxy.sh and video.sh which help running MAVProxy and video streaming. If you are sure not to use them, just skip to next step, otherwise make them executable:

chmod +x mavproxy.sh
chmod +x video.sh

Get your drone keys

Sign in to your GCS.uno dashboard, add new drone and get its MAVLink and Video keys.

Then put them in following commands to be readable by scripts. For MAVLink key (replace abcd1234 with one copied from dashboard):

DRONE_MAVLINK_KEY=abcd1234; echo "export DRONE_MAVLINK_KEY=$DRONE_MAVLINK_KEY" >>~/.bash_profile && source ~/.bash_profile

The same for Video key (replace abcd1234):

DRONE_VIDEO_KEY=abcd1234; echo "export DRONE_VIDEO_KEY=$DRONE_VIDEO_KEY" >>~/.bash_profile && source ~/.bash_profile

Start board scripts

Open mavproxy.sh file and put in MAVLink source in right way described above:

nano mavproxy.sh

Then check how it works

./mavproxy.sh

If it looks good Ctrl+C to exit and then run it in background with PM2 process manager:

pm2 start mavproxy.sh --name mavproxy

Now run drone.js to check connection with GCS.uno server:

node drone  

If it reports that connection is established, Ctrl+C to stop and run it again with PM2:

pm2 start drone.js --name drone

Enable scripts to start on system boot

Enable PM2 to start on boot:

pm2 startup

This will prompt a sudo command which must be copied and executed to enable autostart. Then save list of active processes:

pm2 save

And check it:

pm2 list

Now check your GCS.uno dashboard, you can see you drone's telemetry streaming.

Last updated