ArduPlane, ArduCopter, ArduRover, ArduSub source
Go to file
Randy Mackay 8bbc93bb04 Copter: added CH7 switch to enabling/disable the sonar in flight
This indirectly switches surface tracking on/off which is useful to
avoid tracking the tops of uneven objects when far above the ground
2013-01-14 14:00:08 +09:00
APMrover2 Rover: fixed a build warning 2013-01-13 20:05:14 +11:00
ArduCopter Copter: added CH7 switch to enabling/disable the sonar in flight 2013-01-14 14:00:08 +09:00
ArduPlane Plane: ensure ahrs.init() is called 2013-01-13 17:32:48 +11:00
Tools Tools: fixed build_examples.sh to not depend on board in config.mk 2013-01-14 07:03:16 +11:00
cmake Worked on ArduCopter cmake options. 2012-04-19 16:05:08 -04:00
libraries HAL_AVR_SITL: fixed log dump 2013-01-14 08:26:29 +11:00
mk PX4: fixed build on MacOS 2013-01-11 13:46:13 +11:00
.gitignore git: ignore some more file types 2013-01-04 14:58:36 +11:00
.project ArduPlane cmake build working. 2011-10-31 13:18:48 -04:00
COPYING.txt cmake overhaul, cleaned up readme, added license 2011-09-30 17:32:51 -04:00
Doxyfile.in Working on doxygen support. 2011-11-25 21:35:20 -05:00
README.md README fixes. No functional changes. 2013-01-08 17:59:32 -08:00
README_AP_HAL.md AP HAL Readme: updated for changes to scheduler 2012-12-20 14:51:27 +11:00
reformat.sh better commit message for uncrustify 2012-08-17 11:36:07 -07:00
uncrustify_cpp.cfg fixes to preprocessor retab settings 2012-08-17 11:36:07 -07:00
uncrustify_headers.cfg small changes to uncrustify_headers.cft 2012-08-21 18:59:13 -07:00

README.md

Getting the source

We'll assume you are putting the source in /home/name/ardupilot.

You can either download the source using the "ZIP" button at https://github.com/diydrones/ardupilot, or you can grab it from github using git:

git clone git://github.com/diydrones/ardupilot.git

Building using Arduino

First install the libraries:

  1. Copy the libraries directory to your /path/to/arduino/hardware/libraries/ or /path/to/arduino/libraries directory.

  2. Restart the Arduino IDE.

Each library comes with a simple example. You can find the examples in the menu File→Examples

Building using make

  1. Go to the directory of the sketch and type make.

  2. Type make upload to upload according to the parameters in config.mk.

For example:

cd ArduPlane  # or ArduCopter etc.
make
make upload

Building using cmake

cd ArduPlane  # or ArduCopter etc.
mkdir build
cd build

# If you have Arduino installed in a non-standard location you by
# specify it by using -DARDUINO_SDK_PATH=/path/to/arduino
cmake .. -DAPM_BOARD=mega -DAPM_PORT=/dev/ttyUSB0  # Or -DAPM_BOARD=mega2560

make  # Will build the sketch.
make ArduPlane-upload  # Will upload the sketch.

If you have a sync error during upload, reset the board or power cycle the board before the upload starts.

Building using Eclipse

Generating the Eclipse project for your system

mkdir /home/name/apm-build 
cd /home/name/apm-build
cmake -G"Eclipse CDT4 - Unix Makefiles" \
  -D CMAKE_BUILD_TYPE=Debug \
  -D BOARD=mega \
  -D PORT=/dev/ttyUSB0 \
  ../ardupilot/ArduCopter

Change the ../ardupilot/ArduCopter above to be whatever sketch you want to build.

Note: Unix can be substituted for MinGW/MSYS/NMake (for Windows). See http://www.vtk.org/Wiki/Eclipse_CDT4_Generator).

Define options

  • CMAKE_BUILD_TYPE choose from DEBUG, RELEASE etc.

  • PORT is the port for uploading to the board, COM0 etc. on Windows, /dev/ttyUSB0 etc. on Linux.

  • BOARD is your board type, mega for the 1280 or mega2560 for the 2560 boards.

  • ARDUINO_SDK_PATH to specify the path to your Arduino installation if it isn't in the default path.

Importing the Eclipse build project

  1. Import project using Menu File→Import.

  2. Select General→Existing projects into workspace.

  3. Browse to where your build tree is and select the root build tree directory.

  4. Keep "Copy projects into workspace" unchecked.

You should now have a fully functional eclipse project.

Importing the Eclipse source project

You can also import the source repository (/home/name/ardupilot) if you want to modify the source/commit using git.

Configuring Eclipse to recognize PDE files

  • File association: Go to Window→Preferences→General→Content Types. This tree associates a filename or filename pattern with its content type so that tools can treat it properly. Source and header files for most languages are under the Text tree. Add "*.pde" as a C++ Source.

  • Autocompletion: Right click on source project→Properties→Project References→apm-build Project

  • Regenerating the Eclipse source project file: cmake -G"Eclipse CDT4 - Unix Makefiles" -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE /home/name/ardupilot

Build a package using cpack

cd build
cmake ..
make package
make package_source