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 ArduPilot_20090211.zip2) Download Arduino AVR studio3) Extract above into ArduPilot.vs\arduino-0012 folder4) If you don't have Microsoft Visual Studio 2005 yet, you can download free edition here (choose Visual C++ Express 2005)

97313933rp8.th.png

5) The code is still compatible with Arduino studio, simply run arduino.exe and open project from ArduPilot.vs\ArduPilot folder

45989029tl7.th.png

Build instructions under Visual Studio:- Open workspace ArduPilot.sln- Workspace contains folder "Source files" with ArduPilot code, this is where changes can be made

39172840xv6.th.png

- 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

81251678yb2.th.png

- 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 caseWhy 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.Usage:- In Google Earth, use Add -> Path (Ctrl+Shift+T)

58930586ya9.th.png

- Click to define waypoints

47404789fu2.th.jpg

- Do not connect last waypoint with first, it would create polygon which is not supported- Save the path in KML format (not KMZ)

29333280mv9.th.png

68114144gu3.th.png

- 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 boardSource 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).
E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Is an arduino addin for visual studio of interest? It is free, it is arduino boards aware, automatically provides intellisense on core and your own libs.

    The visual studio addin is arduino ide sketch compatible. If you would like to beta test the addin please email beta@visualmicro.com. More info can be found at http://www.visualmicro.com
  • Arduino in Visual Studio Beta

    I'm keen to hear from anyone that would like to beta test an arduino extension for visual studio called Visual Micro. The extension makes it easy to build on new or existing sketches.

    Visual Micro maintains sketch compatibility with arduino whilst allowing visual studios C++ intellisense to work with ANY core and ALL libraries.

    The product is “boards.txt” and “serial port” aware, retains the board and port per project and allows arduino library folders to be added via a single menu click.

    For anyone who doesn't know or can't remember arduino class, struct and method names the intellisense is very useful. You can read more about more Visual Micro features here

    If you would like to register as a beta tester please send us an email or use the link on the Visual Micro home page.

    Thanks

    Visual Micro Development Team
  • Got it to compile, thanks. My directory structure was wrong. Now I'd like to test it. I haven't been able to get the program to execute under Windows. What am I missing? Thanks for any help.
  • Hello,

    I have been unable to get this to compile. I followed the instructions carefully, but I get a message saying:

    Error 1 error PRJ0019: A tool returned an error code from "HardwareSerialX.cpp" ArduPilot ArduPilot

    What error (thanks, Microsoft!)? I've checked the Includes and even specified the locations explicitly. Please help -- it's difficult to know where to go from here, as I can't even get to the first step.
  • hello Michal,
    for making ardu pilot to interface with x-plane is visual studio is that much necessary ... isn't possible with arduino-0017 alone for coding the processor ? i have every thing for simulation but not yet started because of this confusion.... pls advice
  • I had the same problems with the AVR, I'm trying the C++ now.
  • Finally got things running by getting out of Arduino environment and working through Visual C++.
    Hardware in the loop simulation seems to work but now the issue is with X-Plane. Full size aircraft work fine but the RC plane goes nuts! It will either weather vane like mad or constantly roll back and forth. Any one else have these issues?
  • I tried to add a picture of the Arduino IDE upload errors. Not sure if it worked---
  • Thanks Michal,
    Got everything downloaded and extracted. I'm following these instructions-- "5) The code is still compatible with Arduino studio, simply run arduino.exe and open project from ArduPilot.vs\ArduPilot folder" The .pde code compiles fine in Arduino but I get errors during upload. Some of these errors are:
    -----applet/ArduPilot.cpp:147: multiple definition of `C_ardupilot::C_ardupilot()
    and
    -----ArduPilot\applet\ArduPilot.hex': No such file

    Where am I going wrong?
    Thanks
  • I fixed the ArduPilot_20090211.zip now, download it again. It contains those ArduPilot.vs folder, so just extract the zip somewhere. Then copy AVR Studio into that ArduPilot.vs folder.
    Hope this helps.
This reply was deleted.