A few weeks ago the new version of the free Visual Micro addin for Visual Studio was released. The addin provides full featured, 100% compatible, arduino development inside all Visual Studio 2008 and 2010 versions (except for express). This release means that we can code, compile, upload and burn bootloaders to any Arduino microprocessor using Visual Studio. Arduino for Visual Studio can be downloaded from here
Click to see more example images of arduino visual studio
The addin provides complete compatibility with all arduino libraries and cores, in addition to intellisense, goto compiler errors and many other useful features. One useful example is the "Auto Pause" and "Auto Resume" of serial before and after upload (unless using ISP).
Multiple ground station and/or uav projects can be organised in a single Visual Studio solution
Compiler #defines are shown clearly in all source code. A high speed compiler uses file modification times to optimise the work required. Below you can see that an arducopter compile was completed in 5 seconds. An unlimited number of serial tool windows are available.
This example shows the compilations resulting from clicking a visual studio "Build Solution" command.
Note: The ArduCopterMegaHybrid project is a full arducopter program with a minor change to the "pwm out", it's switched to i2c for the SD21 servo board. This project is not available for release it just happened to be available to demonstrate the speed of the visual studio arduino compiler
There are a few un-documented features still to be tested. One, for example, is an option to switch on support for parent library folders. This might be useful for diy drones projects that require two different versions of the same library. The feature allows the compiler to look for an additional "Libraries" folder in the parent folder of the current sketch.
Another feature we might find useful is a menu command that toggles all related sources in/out of the current project. "Project>Show All Arduino Files" does not affect sketch compilation, instead, this feature includes the sources of the arduino core and all of the libraries that have been "#included" into the current sketch. This makes is very easy for library developers/explorers to optionally work with libraries and core within their sketch projects.
Read more about Arduno for Visual Studio
Comments
@Robert+ If you toggle the libraries into your visual studio arducopter project then you can use the visual studio object browser to explore the project and see variables, inheritence etc. You can toggle the libs in using the "Project>Show All Arduino Files" menu item. I believe there are also many free c++ tools on the Visual Studio Gallery that automatically show maps of which methods are called from where and by what. I am sure there is also a free automatic documentation tool :)
@ Rob I agree with Fab and Ellison. The Arducopter code is really something special and well done. No one can critisize the code or the creators.
I suggest that you start off with a smaller project ( there are many on the Arduino Forum), and get to know your way around the Arduino Code Framework. Once familiar with the way Arduino does things, you will be able to follow the Arducopter code more effectively. What also helps a lot is to familiarize yourself with the diagram and the working of the devices used in the hardware. You will find example software for almost all the devices on the IMU. Do this and before you know it, you are flying.
@Ellison, no defence necessary. I do not mean to criticize the code. I'm just nowhere near educated enough in programming to make sense of any of it.
@Ellison yep arducopter is excellent and I am sure they will document once priorities allow. It is the result of a lot of clever weaving around the inefficiencies of the arduino core. Some of the inefficiencies have been resolved in the 01 version due out soon.
@Robert The vs addin is 100% compatible with arduino ide. If you have any issues then please report them on the http://www.visualmicro.com/forums so we can either explain or fix.
So far no one has reported that "only some of the copter files are being included in a vs project" and I have opened arducopter many times.
Please note that the files will only be opened if you open them yourself, but they should ALL automatically be "included" in the Visual Studio project.
You can open sketches lots of ways. The easiest being "File>Open Arduino Project". However you can do as you did and just open any .pde from any sketch folder. The addin automatically looks for the correct master pde and also looks to see if a project already exists.
As far as seeing the libraries is concerned. By default associated files are shown under the "Dependencies" explorer node. However there is a very useful feature on the "Project" menu called "Include All Arduino Files" that will add the c/cpp/h sources of the libraries into the arducopter project. This will make them very easy to see and will also allow them to be inspected in the Visual Studio object browser. The same menu item removes them again, so it toggles library sources in/out of the project
All comments are welcome and there is no need for your kind thanks. We now have many users who have tested the addin but I expect that we will still find a problem or two. You will be welcome on the forum and we will help you make it work fully
I better come in and defence of ArduCopter code. As a longer-term programmer (20 years), I must say that I find no problem with the structure of Arducopter code at all. It's classic use of object oriented programming structure with some real time stuff thrown in.
@ Robert
What you're calling, "...leave it up to you to figure out where the function is defined.." is the object oriented aspect of the design. Class inheritance and polymorphism. For instance the class sonar is defined as main class, and then you can have different devices providing the same functionality. So in the code you can declare a sonar, and use it regardless of what type of sonar it is.
You're right about needing an index. I noticed that there is no documentation on the class structure. Some one should create one. It would go a long way towards making the code more navigable, and understandable, especially for those not familiar with object oriented programming.
I'm a mech. eng. and have done a bit of Basic programming back in the day, as well as controls theory in school. Recently due to a career path change, I had to teach myself ladder logic and variable speed industrial drive programming which I am now pretty good at. I have read and understand the basics are Arduino. The thing I find so baffling about Arducopter is that it seems to be pretty complex, with many functions defined within the libraries or... I don't even know what to call them... the other .pde files that are associated with arducopter.pde. Such as Attitude.pde
So I see a function, and want to understand what it does. But Arduino seems to leave it up to you to figure out where that function is defined. With so many places to look, it's daunting. I hoped the VS plugin would help with this, and it does, but I don't really even know how to open the arducopter properly. I did it one way (couldn't even explain what I did, I'm just flailing about) and it opened arducopter.pde with the associated libraries. The function cross-reference worked for all the libraries, but the other .pde files were not opened, and I think it couldn't find some functions within those. So I closed that, and opened it another way, and it opened all the other files, such at attitude.pde, but not the libraries. So now it couldn't find those functions.
It's all pretty daunting. What I think would help a lot would be if there were a way to provide a stripped down version of arducopter, such as by removing anything and everything to do with HIL simulation. I find a lot of code deals with that, and it muddies the water for me. Something else that would really help would be some kind of appendix that lists and briefly describes the functions and variables. Some kind of function block diagram would be great as well.
I'm not intending to criticize the work done by the contributors so far. My hats off to you, it's all opened my mind to the complexities of programming. I shall never again yell at a malfunctioning program "why the He^% don't you just F*&king WORK!" :)
@robert. funny :) the arducopter program is clever but breaks many of the arduino rules for new learners. The new version of the arduino firmware due soon will negate the need for some of the complexities. However arducopter is still a huge project in arduino terms. It's not rocket science but it is better to start with a much simpler project such as an arduino example that just reads a simple sensor. You will quickly find the arduino stuff is quite easy, the complex stuff, for me, is the angles and the maths!! best of luck :)
Robert,
If it is the Arducopter firmware that you are referring to, don't feel alone friend. It is reserved for the gifted Guru's of flight. The rest of us just ride along.
With regard to the VS2010 and VM, we can help. What seems to dazzle you most?
Well, I downloaded and installed VS and VM in the hopes that it would help me get a grasp on the Arducopter program.... but I'm afraid it's completely beyond my reach. :(