Servers by jDrones

How to learn Drone programming as a beginner?

Hi guys,
I am new to Ardupilot and this forum. I’ve been reading about ardupilot and px4 and 3dr and everything else and my mind is blown, the separation of ardupilot and Dronecode and the fall of 3DR has made me super sad.
I’ve posted this before on DIYDrones with no response. I want to learn programming for drones. Where do I start? What resources to use?
I don’t know much programming except for printing the Fibonacci series with C++ :stuck_out_tongue: I want to become a pro drone programmer who makes and programs drones for a living. I also want to contribute to the ardupilot community for the revolution it has brought, I want to be a part of it. I want to participate in GSOC doing a project with ardupilot. My skillset is close to zero at this moment but I want to develop it.

Basically, if someone who has zero experience in coding wants to make programs for drones and wants to contribute to the open source autopilot communities; where should he start and what should he do?

Thanks,
NItesh

http://ardupilot.org/dev/index.html

and

http://ardupilot.org/dev/docs/contributing.html

Nltesh, Think about getting an Arduino development kit and try writing simple programs. There are tons of projects at http://www.arduino.org/ and that is where the original Ardupilot project started. The parts are inexpensive and there is lots of support.

@amilcarlucas Thank you so much. It was an extensive read but worth it :slight_smile:

@mike I was thinking about it but now I will definitely do it as you suggested. Thanks.

Don’t forget that ‘drone programming’ extends beyond the flight controller.
DroneKit, or ROS, when used with ArduPilot open up some amazing possibilities.
This YouTube series is a good intro to dronekit https://www.youtube.com/playlist?list=PLuteWQUGtU9BcXXr3jCG00uVXFwQJkLRa

Yes, that’s what I meant by drone programming. Thanks though.
I can imagine a future where we’ll be playing with drones dog fights and stuff on VR using ROS/Dronekit and so much more fun and professional stuff. Drones are the future. Too bad that a single company has a monopoly in this market. Did you look at tealdrones btw? They look promising.

1 Like

Tealdrones are using KISS FC software, but looks their hardware could support ArduPilot. Once they start running ArduPilot… then they will look promissing :stuck_out_tongue_winking_eye: not before

I think Teal have basically used the Kiss powered sports drone to distract from the fact that they haven’t delivered on the jetson powered drone.
Shifting to ArduPilot would probably help George get the jetson powered drone to market, and allow them to use a common stack across the product line, but let’s wait and see.

I didn’t notice that before. I thought they were using a custom flight stack. Ardupilot on the teal sport will be useless tbh. but on the upcoming teal 2. I can only imagine the possibilities.
Anyway, back to the point. So getting an Arduino kit is the best way to go? Shouldn’t there be something more to it? Shouldn’t I get some books or an online course or anything else like that? If yes could I have some suggestions please :blush: ?

The ArduPilot tutorials are worth a look: http://ardupilot.org/dev/docs/learning-the-ardupilot-codebase.html
particularly if you already have a Pixhawk or similar.
Specifically for learning to code, ArduPilot is C++. Arduino shares some similarities, and is a great entry pathway to embedded coding, but has significant differences too.
A raspberry pi is also a great, cheap platform to launch into embedded coding from, and like arduino has a massive community with examples and support.
What type of thing do you enjoy? The core stability and navigation code requires deep, specialist engineering and mathematical knowledge that isn’t easily self taught. Device drivers, and new modes/functions are less daunting but still challenging and really important.

Thank you, James. Damn, that’s a lot to read. I will surely read it all but slowly. I don’t have a Pixhawk but will be getting one soon.

I think I’ll go with Arduino first and then I’ll move to PI/Beaglebone/Odroid/???.
I am not sure about what I like/enjoy in programming. I am not sure which part of drone programming will interest me. I want to explore. 2 years back I went to a C++ programming language summer course in one of my countries best institutes but the class was really crappy. It sucked and I didn’t learn anything. I lost interest in coding because of that. I enjoy the hardware part more though. I’ll be going to college next year and I guess there I’ll get some exposure and I can learn some stuff. The college that I plan to go to has a team that participates in the AUVSI-SUAS competition every year yet they don’t have a very good obstacle avoidance system. I want to contribute to that and also work on something like this https://www.youtube.com/watch?v=ec1EF2UaQ4U&t=2s. Tealdrone 2 has the hardware but lacks the software and the sensors for this, that’s why I was interested in tealdrone :smiley: .

Something like obstacle avoidance comes under what category? Do I need to have strong mathematical knowledge and specialist engineering?

Sorry for burdening you with so many questions. It’s been a month since I’ve started researching on various autopilot systems and my curiosity keeps increasing every day. Thank you if you’ve come this far.

The reason why object avoidance is in an early state is because it is a hard problem that needs both engineering skills and mathematical skills.

You are picking an hard problem to solve.

You should not be surprised that Physics and Math are very important to flight controller development, either from a coding perspective or hardware design perspective. So either way take as much Physics and Math as you can.

1 Like

@amilcarlucas As someone once said, “If it’s easy it’s no fun.”

@mike Yes, I will take as much physics and maths as I can. Thank you. I am excited :stuck_out_tongue: to learn more and delve into the world of endless possibilities.

I think you need, in the beginning, to separate the subject areas, much like they do in schools until you at least get to an intermediate level. IMO, a Raspberry Pi 3 (RPi), with keyboard, mouse, and monitor, are your least expensive (and maybe the most fun) method of learning the very fundamentals of programming in general. It has a programming tutorial method but it’s aimed at children so might not be fun at first. You will outgrow it quickly. For books, you can’t go wrong learning BASIC for more fundamentals and theory. Use the $35 RPi (plus whatever you want to spend on monitor, mouse, and keyboard) to do the practice sessions for any programming language you would like to learn. After you have a good handle on BASIC, the best programming book, bar none, is “Learning to Program in C,” by Thomas Plum, also known as “The Red Book.” He has a clever way of introducing the new concepts as if you already knew them all along. He moves from the fundamentals to more advanced concepts at a reasonable pace. When you’re comfortable with C, then and only then, move to C++ learning. I submit you can’t learn C++ without knowing C already.
What you desire is quite advanced in physics, mathematics, and programming languages, so it is not a one-stop shop.
If you need background in basic electronics and circuits, Arduino kits are the cheapest and easiest way to get there and are directly applicable to “drone programming.” To help you with learning Arduino, start by getting Visuino ($20/year) to do your graphical programming of circuit setups before jumping headlong into mixing electronics AND programming concepts at the same time.
That’s my advice and is worth every penny you just paid for it.

2 Likes

Hi Nitesh
Alsoif you are going to be interested in the nav/obstacle avoidance field i would suggest learning some good info on Neural Network programming and deep learning as that is the future of autonomous navigation.
2 good intros for that which are free are on Coursera Machine Learning by Andrew Ng and Deep Learning Specialization
Thats my small contribution to your huge but ultimately enjoyable undertaking
Cheers
Al

@skypuppy1 Damn, that was long. I already have a pc so I don’t think I’ll have to buy a raspi+mouse+keyboard to learn or is the raspi going to be used for something else that I don’t understand here?
The learning with Arduino and visuino approach seems to be more appealing tbh. Do I really have to start with BASIC then move to C and then finally to C++? Can’t I directly start with C++? I am asking this because I know a few guys who learnt programming in Python. Thank you though. I feel following your suggestion may take time but will be worth it.

@eye-zen thank you Al. I would definitely look at your suggestion.

Thanks everyone for your suggestions.

Do you think it practical to jump into integrals and derivatives without having first learned algebra and trig?

Haha, good point. I’ll go with BASICS then.
@skypuppy1
PS: I have a question. What exactly is the difference between different programming languages? As per my understanding, the major difference is the syntax. The inherent concepts are almost the same. So what difference does it make if you start with any language? Correct me if I am wrong which I most probably am :wink:

Most of them have the common control flow basics, implemented with varying degrees of finesse. Very few are implemented with adequate data flow concepts. Some are oriented more toward specific tasks and while good at that one type of task, they suck at anything else. So the first thing to do is determine what the goals of a project are, determine the required resources in dollars, time, brainpower, and etc. You’ve identified your current goal as an applications programmer, that of playing with drones. (Whether you get paid for it or not, you’re still playing!) If you’re at the beginning and are unsure which direction you want to take, then take the University approach: learn about languages in general and learn some examples of each problem domain and which tools fit that domain best. Lots of time, but you get laid a lot during school.
Some computer languages are tailored, some are generalized. Your problem domain is identified as zeroing in on drones this time. Ok, that helps narrow your options enormously. Within that domain, you figure out which subdomains exist, then subsequently, which (or all) of those you wish to tackle.
IMO, there are different approaches available. The easiest, by far, is what most have chosen: a general purpose language (like C or C++) along with some subdomain specific languages/tools, like Fourier Transforms, sensor fusion, and image recognition and processing, for decoding live data sensors (navigation, obstacle avoidance, etc.)
Each language and sadly, each version of a language, has it’s own syntax variants. Between languages, syntax varies WILDLY. Some low level languages (2nd generation) like assembler, are time and head-space intensive. 3rd gen languages, like C, BASIC, Ruby, Lisp, require less time and are less head-space intensive because you can think (and program) on a higher level because all the drudge work is already built into the language. 4th and 5th gen languages are on the horizon (a few are already well developed) but aren’t popular due to the enormous learning curve required. Long learning time, but short programming time while requiring intense head-space effort during that time. Some 6th gen’s are on the horizon that are coupled with AI but they’re still in the labs at this point. AI still has a L-O-N-G way to go for this purpose.

If you want to see some extreme examples of syntax and capability, spend a little time looking at assembler, BASIC, Lisp, C, and SQL. Once you get over the headaches, you’ll understand better.

Servers by jDrones