Graphical Display of APM Program Structure

The Class Diagram features of Microsoft Visual Studio provide the facility to show graphically any area of an Apm program. This is an ideal way for new users to understand how ArduPilot and ArduCopter code is designed. 



Microsoft Visual Studio provides a 100% compatible development environment for Arduino and Apm. It is also used to create the diydrones GCS. The Arduino plugin for Visual Studio is free and available from here, Visual Studio can be downloaded for free via here

E-mail me when people leave their comments –

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

Join diydrones


  • Thanks Harry I am really pleased to hear that.


    Don't forget to check the right mouse menu when you are looking at code. Right click any code and select "Go To Definition" or "Find all references"

    "Find all references" can be especially useful with the Apm code because it shows every place that the syntax is used. For example which parts of the Apm code reference the gps?

  • Yeah, that took care of it.  Thank You, Fab.  This is quite powerful IDE, like going from a scooter to a Ducati.

  • Hi Harry, one point I forgot to mention. When you were looking for the upload, if you ticked the tools menu item called "Upload using programmer" then you will need to untick it for the normal upload to work :)

    If you didn't tick that option then ignore this note :)

  • Hi Harry, you should check out the documentation on the visualmicro site for help and join our forum. 

    You have choice to compile or compile and upload. The compile upload commands are any of the following:-

    • The little green arrow pointing to the right on the toolbar
    • The menu item "Debug>Start"
    • The menu item "Debug>Start without debugging"
    • Pressing the F5 key on the keyboard

    As concerns changing files to .ino, extension this is the Arduino standard since Arduino 1.0. and should work well in arduino. I'll try it later to see if I can see what you mean. In the meantime take a look at the arduino ide preferences screen for a checkbox that switches on auto rename to .ino. 

  • I tried to use it to upload to my ardupilot(legacy) and the only option I saw was load bootloader.  The reason for wanting to do that was mainly because VS changes all the .pde files to .ino and that means the arduino 1.0.1 wont open the files anymore.  It'd be nice to be able to upload after building/compiling.

  • cool i like it :)

  • With this diagram this will help me improve the IOS App that is in development at this time.

  • Harry has been using the class viewer but I recommend closing it while you are learning Class Diagrams. In my example you can see that I am using the Solution Explorer

    The Solution Explorer is the best VS window for navigating a project but, by default, it does not include the Apm libraries.

    Below you can see that the ArduPlane project is selected in the Solution Explorer and that I have just clicked the menu item called "PROJECT>Show all arduino files". clicking the menu item instantly brings all of the Apm libraries into the current project (as shown below).

    With the Apm libraries in the project, it will be easier to use the solution explorer for diagrams, as demonstrated earlier.


  • After you have a diagram of the objects you are trying to understand you can re-arrange them using standard drag/drop.

    When you drag them around the screen you will see the connection lines becoming clearer and easier to understand


  • Plotting the entire project isn't the most useful but well done for working it out :)

    Another way to work is to CTRL+CLICK select the .h files you want to include in a diagram and then right click "Class Diagram"

    If you select source code that does not contain classes then Visual Studio will show the warning box Harry mentioned.

    Below you can see the Right Click menu and selection that was used to create the ClassDiagram24 of the pressure sensor system in Apm


This reply was deleted.