5
$\begingroup$

I'm interested in quadcopters/multi-rotors and want to eventually code my own flight controller ala an APM and/or Pixhawk. I've got a little experience in programming (i.e i know about if/else/else if conditionals), and have done a little programming with PHP, though it was procedural code.

I currently have a quadcopter that i built/assembled myself that is running on a f450 frame, using a APM 2.6 flight controller,so i have a reasonable grasp of how a quad works, and i would like to take it a step further and make my own adjustments to the code base, with the eventual aim of coding my own flight controller.

I've had a look at the code base, but am still unable to get a grasp of what the code is actually doing....yet. How would i go about learning how to code a flight controller?

I'm thinking that i would have to learn C++ & OOP first, but how familiar/proficient would i have to be with C++ before i can reasonably attempt to edit the code base?Also, what else would i need to learn apart from C++ & OOP?I am looking at setting a 6 month timeframe/deadline for me to do this, would it be possible?

$\endgroup$
  • $\begingroup$ In my opinion, start doing simulation with OpenGL ( stick with C/C++). Get acquainted with the quadrotor models linear and nonlinear. The system is so complicated. master and Phd thesis's have been published regarding this matter. For simulation, the problem is getting harder because you need to have a good programming skills. The bottom line is that you might not get an answer for this question. $\endgroup$ – CroCo May 27 '15 at 16:39
  • $\begingroup$ U just need to learn programing AVR microcontroller in c language, u can find tutorials on youtube , or u can find books on avr programing , ofcourse youtube is an easy choice . $\endgroup$ – M0xff Dec 10 '15 at 17:56
2
$\begingroup$

Seeking proficiency in C++ or in OOP in general would either have to be a result of obtaining the necessary knowledge in order to browse through the code-base of the flight controllers that you mentioned, or with the eventual goal that this is what you would use when implementing your own flight controller.

The first thing is familiarizing yourself with the syntax and semantics of the language(s) used in the implementation of the flight controllers that you're interested in adjusting. The tricky part is actually determining what the code is doing. It helps if the code base is well documented and that the code is developed in a concise manner. For example, the functions and variables are named appropriately so that their purpose is clearly understood. Otherwise be prepared to follow through the logic of the code.

Once you have that down, one of the efficient ways when trying to decipher what the code is doing is to start from the beginning. Look for where the program starts when the flight controller is first turned on or is commanded to start executing whatever it needs to execute. Also what sort of initialization is it doing. Another thing is what sort of communication protocols that might be in play if the flight controller were to communicate with others. And then just work from there.

Ignoring the details for now, the sole purpose of a flight controller is really to monitor and control the whole system and possibly relay any information to others perhaps a ground station of something. This means having the knowledge of the sort of hardware/sensors/etc. that you need and need to be physically present in order to obtain the required data and make sense of it. Based on the data this will determine how the quadcopter should behave/maneuver.

As for wanting to implement your own flight controller it depends on what you are seeking. Are you looking to take the existing flight controllers and replace the program installed in its entirety or are you looking to design and build your own flight controller platform and then create your own flight controller code.

  • For the first case, look at the related documentation/datasheets of the flight controller at interest. In particular see if it's possible to make your own adjustments to the flight controller code.
  • For the second case, you might want to look into embedded systems development.
$\endgroup$
4
$\begingroup$

Controlling a flying robot (or anything else) is a very complex subject (well, people are doing PhD on it..). I can recommend this free online course on the subject (I have taken it myself). It will give you a little taste of what it is.

$\endgroup$
  • $\begingroup$ The link is broken. $\endgroup$ – CroCo May 27 '15 at 16:26
  • 1
    $\begingroup$ @CroCo Well, this is the nature of outside links.. Updated to a new iteration of the course. $\endgroup$ – Eugene Sh. May 27 '15 at 16:28
  • 1
    $\begingroup$ @CroCo Probably, but the learning experience is different. The course has programming exercises on a nice simulation platform and discussion forums. $\endgroup$ – Eugene Sh. May 27 '15 at 16:32
  • 1
    $\begingroup$ @CroCo It's python $\endgroup$ – Eugene Sh. May 27 '15 at 16:42
  • 1
    $\begingroup$ @ott Controlling using joysticks or in the best case some pre-made controller? Yes, sure. But the question here is about the underlying theory. $\endgroup$ – Eugene Sh. May 28 '15 at 21:21
3
$\begingroup$

The course suggested by @Eugene Sh is a good one to understand in depth the relevant details. If you have general idea about how an aircraft (fixed wing) operates it will be actually helpful to you. Refer Small Unmanned Aircraft:Theory and Practice by Randal Beard, one of the pioneers in aerial vehicle research and T.Mclain. This is about fixed wing aircraft, but the navigation and guidance principles are same for both fixed wind and quad/tri-copters. This book is written in a very simple language with minimal equations. Will be very good for testing out some of your guidance strategies

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.