I have been looking at the firmware and it is a lot of code. I am curious how many lines of code are in the project and I thought it might be less than 100,000, but would like to get an estimate.
You need to be a member of diydrones to add comments!
Replies
Simply answer: Yes
There are more than 100.000 lines of code that our dev teams have been writing. Originally we had most of the code in normal Arduino sketches but now most of them have been moved to libraries. Most of the code is used on every platform.
ArduCopter specific code is mainly that code in mentioned as Arduino Sketch. Same type sketch files you can find from ArduPlane and ArduRover.
In past few years we replaced all original Arduino libraries and current system does not even look like a Arduino anymore. Thou you should still be able to compile it in normal Arduino IDE environment but if you use that it wont be as compact as compiled with our special compilers. Arduino IDE does rather badly optimized code and it might not fit anymore in to the APM hardware. So more optimized compiling environment is highly suggested to use.
Also as we run this same code on multiple different platforms like Arduino, uDroid, BeagleBone and PIxhawk (STM32) those cannot be compiled in Arduino IDE as it's only for Arduino systems.
On top of just main firmware running on electronics we need to remember all Mission Planner, APM Planner, Droidplanner softwares too so total code included among whole APM system can easily go over 400.000 lines or even more and it's growing every day.
Jani / Original ArduCopter team leader
That is very interesting. Thank you for all the hard work on this project. I am very impressed with the 400,000+ lines of code, but I am also interested in how little code could be necessary to fly the arducopter. It can be more difficult for me to read and learn many lines of code.
John
thanks for the quick response. so I guess that would be 28,900 lines since it is an Arduino sketch, correct?
All of the code in these files form the Ardupilot project. Ardupilot includes ArduPlane, ArduCopter and ArduRover. Most of the code is C/C++ in shared libraries. There is code for multiple platforms and also test code included. As for exactly how many 'lines of code' actually contribute directly to any one binary executable for given settings, I will leave that for someone else to work out....
Hi, latest Ardupilot master as reported by cloc:
http://cloc.sourceforge.net v 1.60 T=6.42 s (211.1 files/s, 86581.6 lines/s)
Files
Language
Blank
Comment
Code
699
C/C++ Header
19202
42999
80906
249
C++
10251
15300
47721
186
Arduino Sketch
6674
8857
28928
46
C
2468
1915
8952
38
XML
317
269
7065
57
Python
1491
756
6217
36
Bourne Shell
241
83
1303
18
make
565
782
988
6
C#
70
121
449
3
Perl
114
36
399
2
CSS
35
4
221
2
HTML
51
2
168
1
MSBuild scripts
0
7
79
1
MATLAB
24
46
52
2
Bourne Again Shell
18
54
25
1
ASP.Net
0
0
3
1347
41521
71231
183476