ArduPilot code - now for MS Visual Studio plus parsing of Google Earth KML files

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.

Installation instructions:
1) Download and extract
2) Download Arduino AVR studio
3) Extract above into ArduPilot.vs\arduino-0012 folder
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 folder

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).

Views: 2261

Comment by Saiful Azuwan on January 12, 2009 at 6:17am
Cool... Great job...
Comment by tychoc on January 12, 2009 at 7:37am
Very nice! I feel more at home in VStudio.

Comment by bGatti on January 13, 2009 at 7:35pm
Since google earth doesn't work. I'd recommend a mashup on google maps.
I wrote a mashup - you can set altitude in a textbox, then click, the web page will generate any format you like.

Here is the page I did years ago. It still has some debug code.

the custom code is all client-side java so you can see how its done.
If Chris will host a page with some shared access, I'm sure this could be whipped into shape in a few evenings.
Comment by bGatti on January 13, 2009 at 7:37pm
PS. to test the page - click ok on the debug msgbox(s). once the page shows maps, click on a button, the click on the main map to place that icon.
Comment by Nick Sargeant on January 13, 2009 at 11:26pm
I was going to try and make as mashup between these two google maps api websites.

My plan is you could add waypoints by searching or dragging on one map and then on the second map it shows the route lists the lat/long. You would specify the altitude by double clicking on one of the markers and entering it
Comment by bGatti on January 14, 2009 at 2:35pm
Nick, did you run the ViPOR page?

It allows for waypoints to be clicked onto the map with a mouse, and it generates a waypoint list.
Comment by Migliorini Alessandro on March 4, 2009 at 4:28pm
hi Michal, i have one little problem with ardusim compiling in VC++ 2005, this is the result of compiler:

1>------ Build started: Project: ArduPilot, Configuration: Release Win32 ------
1>Impossibile trovare il percorso specificato.
1>Project : error PRJ0019: A tool returned an error code from "HardwareSerialX.cpp"
1>Build log was saved at "file://c:\Users\kattivik\Desktop\Arduino\ArduPilot.vs\_build\BuildLog.htm"
1>ArduPilot - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

you can help me?

thk's :D
Comment by Migliorini Alessandro on March 4, 2009 at 4:32pm
I have upload the compiling logfile here:

i need help!

Comment by Michal B on March 4, 2009 at 10:54pm
Maybe you don't have folder arduino-0012 inside of project folder, where is AVR Studio. Read instructions above.
Comment by Bryan Cuervo on March 7, 2009 at 6:18am
I'm building your simulator with hardware-in-the-loop. Got the X-plane, GE, Ardusim, baud rate at 19200, port set to 49003, the correct com #; but not sure about installing the modified code. Are you saying to create a project folder and name it "ArduPilot.vs" and then extract Ardupilot and Arduino into it? In other words, should there be a Main folder called Ardupilot.vs that contains both extracted contents? I'm getting errors during upload that say a hex file cannot be found in applet.


You need to be a member of DIY Drones to add comments!

Join DIY Drones


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service