Skip to content

Running Flightgoggles in AWS

Winter Guerra edited this page Mar 21, 2019 · 3 revisions

Running FlightGoggles Simulation Framework on AWS or any Headless Linux Server

The following description is applicable to running FlightGoggles on any headless Linux server, including non-AWS instances.

These instructions are derived from here

Start by spinning up an EC2 instance. We recommend the following configuration:

Instance: p3.2xlarge or g3s.xlarge. p3.2xlarge is preferred, but g3s.xlarge is usable (has lower framerate). Amazon Base Image: ami-0826e0d47dd8eebf6 https://aws.amazon.com/marketplace/pp/B077GCZ4GR

Now we need to set up a virtual display. Install Xorg:

sudo apt-get install xserver-xorg-core

Figure out the BusID of the GPU:

nvidia-xconfig --query-gpu-info

On a g3s.xlarge, the result is PCI:0:30:0

Now we need to configure Xorg. Run this command (replace the BusID, if appropriate):

sudo nvidia-xconfig -a --allow-empty-initial-configuration --virtual=3200x1800 --busid PCI:0:30:0

Read the output. If it says that it wrote the file XF86Config, we need to rename it manually:

sudo mv /etc/X11/XF86Config /etc/X11/xorg.conf

Now reboot. Once restarted, run the following commands:

export DISPLAY=:0
sudo X :0 &

These commands need to be run after every reboot.

To test that graphical applications run now, try to run glxgears. If the output looks something like ??? frames in 5.0 seconds = ??? FPS, then it's working. Follow the install instructions from here to get flightgoggles running.

If you would like to see the output of the simulation locally, you will need to set the ROS_MASTER_URI and ROS_IP environment variables appropriately on your EC2 instance and on your local machine (see code below). Note that each EC2 instance will have 2 ip addresses - set ROS_IP to the external IP address. Also be sure to open up inbound and outbound ports on the EC2 instance through the web portal.

On AWS:

export ROS_MASTER_URI=http://ec2_public_ip:11311
export ROS_IP=ec2_public_ip
roslaunch flightgoggles core.launch

On your local machine:

export ROS_MASTER_URI=http://ec2_public_ip:11311
export ROS_IP=local_machine_public_ip
roslaunch flightgoggles teleopAWSFromLocalMachine.launch # Requires that FlightGoggles is also installed locally

Assuming that you have FlightGoggles installed on AWS and on your local machine, you should be able to see the output of flightgoggles on your local machine via rviz.