ArduPilot Basics for Dummies

Hi Guys,


This is my first post in this forum, but I have been reading on you progress for awhile now.

WOW! looks like you guys achieved so much with minimal HW and processing power.


A couple of month ago I finished a self balancing robot project (written on a PIC18). I proudly donated it to a local children science museum...where it will be treated nicely.As I am into RC planes for the past 20 and some years, I feel this a good time to take my programming skills to the next level with an auto pilot project. I am an analog hardware engineer dealing with power electronics but do have more than adequate programming skills. My drawback is my rusty linear algebra, as I am 12 years out of university...what I don't use daily I tend to forget. 


I read Williams and Paul's paper and after some linear algebra refresh I could understand the concept pretty well. Going over the arduino code I came across some things I could not understand.

I hope you can help me get things sorted out.


1- I would like to make sure that I understood the basic flow of data:


    - Take gyro data at regular intervals and integrate it to get the three angles

    - Take periodic accelerometer data and correct gyro roll & pitch drift with  

       the complementary filter

    - Take periodic magnetometer data to correct gyro yaw drift with complementary filter

    - Normalize the matrix.

    - use the roll/pitch/yaw rotation matrices to get the three angles as seen by earth coordinate system.

    - use a PI feedback to correct the errors


2- can you please elaborate on how the DCM matrix elements are orginized (yes.. the post title was for dummies)


3- Is the gyro data integrated once or twice to get an angle?


I am sure more questions will pop up, but I think this is enough for now.

Sorry for my lousy english.


Any help will be appreciated.





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

Join diydrones

Email me when people reply –


  • You lost me at 1!
    Lol it would be great if this could be simplified a bit. Or maybe point me to a book or something. I really want to know what exactly i'm building and the mention of gyros,accelerometers and linear algebra has got me interested! Best of luck with your project!
  • You may have titled this "ArduPilot Basics for Dummies" but as a total n00b it is way over my head. I have been dabbling in RC aerial photography but always with manually controlled aircraft. I was thinking of building something like the "Skywalker" airframe with a minimal autonomous capability. Here is what I had in mind. I like to use point-and-shoot Canons running the CHDK software with an intervalometer script. That eliminates any shutter controls. I just put in fresh batteries, a clean memory card, start the camera and then launch the aircraft of the kite if I am doing kite aerial photography. I believe in the KISS principle and this is what I have boiled it down to over the years. Now I envision another level of complexity but something far simpler than most of the systems discussed on this forum.

    I would like to launch my plane, climb to altitude with the cameras shooting using the intervalometer script but then be able to trigger the system so that the plane would "loiter" at an altitude while navigating along a few waypoints. I envision setting the waypoints and altitude to describe a holding pattern at the proper distance and orientation from the photo target. When the photo mission has flown for a sufficient time to fill the memory card with photos I would then take control and land the plane. My proposed use of this technology would be as simple as i could make it.

    Any comments? Should I start a new thread for this discussion?
  • Developer
    Hi SBD,

    I can't say that your questions are really clear, but I'll try to answer....

    1 - you probably understand the flow, but to make sure just look at the ArduIMU code.

    2 - you can organize the DCM elements in a variety of ways in software. In ArduIMU they are stored as a two dimensional array, with the first index being the row of the matrix and the second being the column.

    3 - when you talk about the gyro data being integrated make sure that you understand you cannot directly and separately integrate the three gyro signals to get three angles. You must combine the gyro signals, and this is why the DCM matrix is used. Each update of the DCM matrix involved one integration step of the gyro signals. Angles are then computed from the elements of the DCM matrix.
This reply was deleted.


DIY Robocars via Twitter
RT @chr1sa: Just a week to go before our next @DIYRobocars race at @circuitlaunch, complete with famous Brazilian BBQ. It's free, fun for k…
5 hours ago
DIY Robocars via Twitter
How to use the new @donkey_car graphical UI to edit driving data for better training
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Nov 26
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Nov 25
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord:
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch
Oct 23