Skip to content

Instantly share code, notes, and snippets.

@deliastephens
Last active July 18, 2019 17:29
Show Gist options
  • Save deliastephens/0a1a4bb08aabdcee886fdf26f636a139 to your computer and use it in GitHub Desktop.
Save deliastephens/0a1a4bb08aabdcee886fdf26f636a139 to your computer and use it in GitHub Desktop.

This guide is meant to replace the one on the official ArduPilot website, which appears to be somewhat deprecated.

Required Software

  1. Cygwin with the required packages.
  2. MAVProxy for Windows
  3. GCC Compiler. Make sure to accept the license, install to default location, accept the SSL certificate, and check the option to "Add path to environment variable."
  4. FlightGear

1. Installing Cygwin

  1. Download setup-x86_64.exe.
  2. Run the following command in a DOS prompt where you downloaded setup-x86_64.exe.
setup-x86_64.exe -P autoconf,automake,ccache,gcc-g++,git,libtool,make,gawk,libexpat-devel,libxml2-devel,python27,python2-future,python27-libxml2,python27-pip,libxslt-devel,python27-devel,procps-ng,zip,gdb,ddd

Use the default options, clicking "Next" to continue.

2. Installing GCC Compiler

This is only necessary if you want to simulate Pixhawk boards. Download from here.

  1. Accept license.
  2. Install to default location.
  3. Accept SSL certificate.
  4. Check option to "Add path to environment variable." Restart Cygwin if it hasn't been started.

3. Download ArduPilot Source

Use git to clone the ArduPilot software.

In the folder where you want ArduPilot to be, type the following commands:

git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git submodule update --init --recursive

Adding New Locations

If you want to change the default location of FlightGear, open the file ardupilot/Tools/autotest/fg_plane_view.bat and add a few options:

    --lat=20.819083 ^
    --long=-100.414276 ^
    --altitude=2023 ^

I then changed the locations.txt file, adding this line:

MEX=20.819083,-100.414276,2023,360

Now, FlightGear Plane View defaults to the test location in Mexico.

4. Installing Extras

Open the Cygwin64 Terminal and install extra packages with the following command:

pip2 install empy pyserial pymavlink

5. Installing FlightGear

Download and install FlightGear from: https://www.flightgear.org/download/

It's a 1.6GB file, so it might take a while.

Once installed, make sure to enable the option to "Automatically download scenery", or FlightGear will give you untextured surroundings.

6. Running Everything

After determining that everything is configured correctly,

  1. Open two Cygwin windows. One window will be your FlightGear window, and the other will be your MAVProxy window.
  2. In both windows,
cd /your-ardupilot-directory/Tools/autotest
  1. In the FlightGear window
cd Tools/autotest
./fg_plane_view.bat
  1. In the MAVProxy window:
python sim_vehicle.py --console --out <YOUR_IP_ADDRESS>:14550 -L MEX -v ArduPlane

To find your IP address, simply run ipconfig in cmd.exe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment