ArduPilot code, modified version for use on Microsoft Visual Studio. Compatibility with Arduino studio still maintained.
Also contains parser of KML files, for importing fly paths drawn in Google Earth.
1) Download and extract ArduPilot_20090211.zip
2) Download Arduino AVR studio
3) Extract above into ArduPilot.vs\arduino-0012
4) If you don't have Microsoft Visual Studio 2005 yet, you can download free edition here
(choose Visual C++ Express 2005)
5) The code is still compatible with Arduino studio, simply run arduino.exe and open project from ArduPilot.vs\ArduPilot
Build instructions under Visual Studio:
- Open workspace ArduPilot.sln
- Workspace contains folder "Source files" with ArduPilot code, this is where changes can be made
- Another folder "System" is containing source files from Arduino studio needed to run ArduPilot executable, do not modify these
- Build project as usual, if you see "Created ArduPilot.hex" in log window, then everything is OK
- To upload to board, use Upload.bat from command prompt (you need to specify correct port in -P parameter)
Note: if you change anything in *.h files, hit Rebuild Solution, because source dependency is not working in this case
Why using MS Visual Studio for building ArduPilot code, when Arduino studio does the same thing?
Well, if you're a programmer, then answer is clear - VStudio has better text editor, it will assist you in writing code by tools such as finding variable/function definition and declaration, text editor code highlighting, provides auto-complete, etc.
Alghough we don't use C++ compiler from Visual Studio, rather custom build step is used with AVR compiler, mentioned advantages will help to make the code reliable and robust.
On other hand, Arduino studio has very simple text editor, usable for the task, but if we have better tools, why not using them.
Note: Visual Studio can be used on Windows only, so using Arduino studio makes sense for Linux/Mac users.
How to use KML parser:
This tool transforms KML file from Google Earth into ArduPilot friendly file.
- In Google Earth, use Add -> Path (Ctrl+Shift+T)
- Click to define waypoints
- Do not connect last waypoint with first, it would create polygon which is not supported
- Save the path in KML format (not KMZ)
- Use KML parser to extract coordinates and create ArduPilot compatible file; the utility accepts 2 parameters - source KML file and destination H file; first is your KML path file from Google Earth, second is usually set to ArduPilot\waypoints.h
, this will create waypoints file compilable by ArduPilot code. There's testing KML file as well as KML_test.bat file which puts proper parameters to the KML tool.
- Compile ArduPilot executable and upload to board
Source code is provided for KML parser tool. It is compilable under MS Visual Studio, and runs on Windows.
Problems and tasks:
- Google Earth doesn't allow to define altitude for individual waypoints, or to export KML file with absolute altitude,
so we end up with same altitude for every waypoints for now.
We can fly on same altitude level, or manually tune altitude in generated waypoints.h file, or come with some other fix (suggestions are welcome).