Wednesday, March 9, 2011

Setting up the Ardupilot software

The Ardupilot software uses the Arduino environment to compile and download to the Ardupilot board.  Here's how to set up your environment for that.

Download and install the Arduino Software
  • The software is here:  Get the latest version.  There are pre-compiled binaries for Mac, Windows, Linux-32 and Linux-64.
  • I'm using a Mac.  It's a DMG with the Arduino software, ready to drag into your Applications folder.
  • There's also an enhanced FTDI USB driver.  It's a package that installs using a password.
Set up a Working Environment
  • This is a software project, and tidy housekeeping now will pay off handsomely in the end!
  • I chose this as my base directory: $HOME/Dropbox/projects/ardupilot.  I'll call this $TOP below.
  • Later we'll set up a SVN checkout.
  • For now we'll just unzip the Ardupilot and Arducopter distributions here.  I'll save local copies of the zipfiles in $TOP/dist.
Dowload and unzip the Ardupilot Software
  • From here:
  • The following is what I did from the mac command line... Adust to your favorite workflow.
  • cd $TOP/dist
    cd ..
    unzip dist/
Download and unzip the Arducopter Software
Set up the Libraries
  • The most painful step in getting things set up is getting the libraries installed.
  • Here's the biggest pain in the whole software setup.  There might be a better way, but this is an area where the Arduino software could stand improving.
  • Find your Sketchbook path.
  • On mac:
    grep sketchbook.path ~/Library/Arduino/preferences.txt
  • Go to the sketchbook path just discovered.
  • mkdir libraries, if it does not already exist
  • cd to the libraries directory.
  • copy all the folders in the ArduPilot project libraries directory here.
    $ cp -rp ~/Dropbox/projects/ardupilot/1.0-BETA/libraries/* .
  • restart the Arduino program.  These libraries should now be available during compiliation.
Test your installation
  • Start the Arduino program
  • From the top menu, File/Sketchbook/libraries should show you the libraries you just copied, something like the screenshot below.
  • Open the standard "blink" Arduino Demo: Menu: File / Examples/ 1.Basics / Blink
  • Compile by pressing the "Verify" button.
  • If that works, add the line
    to the beginning of the file
  • Compile again.  If this works, your libraries have been installed.
  • If it doesn't work, get ready to pull out lots of hair and gnash your teeth.
Build the Ardupilot Software
  • start the Arduino system
  • asdf
  • File/Load the main ArduPilot program, ArduPilotMega/ArduPilotMega.pde
  • When you compile, you will get an error like this:
    config.h:58:3: error: #error XXX You must define GPS_PROTOCOL in APM_Config.h
    (ignore the Aduino environment highlighting, and scroll back in the error window to the beginning of the error messages.  this is another area where the Aduino system could use some work.)
  • Look in APM_Config.  See where is says "READ THIS. REALLY! READ THIS."?  Take that advice.

Build the Arducopter Software

No comments:

Post a Comment