Build your own Autopilot - tutorial

I have written a tutorial on how to program your own AutoPilot/Flight Controller from scratch using an arduino/ArduPilot/RaspberryPi.  The tutorial will walk you through everything from reading the RC radio and controlling the motors through to how the PIDs are stacked on top of each other to get stable flight. Information on how to do this is quite hard to find on the Internet, so I hope this article will make the world of flight controllers more accessible and encourage more people to contribute to ArduCopter.

You can find the full article here:

http://oweng.myweb.port.ac.uk/build-your-own-quadcopter-autopilot/

and a video of the code from the article in action (you can download the code and try it on your APM - it'll behave like a KK board):



Note: the code actually flies better than the video demonstrates - my PID settings weren't optimally tuned!

Views: 10437

Tags: arduino, ardupilot, build, controller, diy, flight, pi, pids, raspberry

Comment by Jernej Plešnar on July 31, 2013 at 10:40am

very nice, arduino is really awesome


3D Robotics
Comment by Chris Anderson on July 31, 2013 at 10:49am

This is awesome. Huge props to Gareth for the hard work that went into this. Can't wait to see it grow. 

Comment by The Sun on July 31, 2013 at 12:30pm

That is amazing.

Raspberry pi = awesome choice.

Comment by The Sun on July 31, 2013 at 12:35pm

Also having a look at the actual write up, you went over the code in an absolutely perfect way.

Thank you for the post 

Comment by Daniel Nugent on July 31, 2013 at 12:46pm

Hi!

Cool project! I am also making my own auto pilot. I was wondering about APHAL. From the way I understand it, it is a script which intializes I/O ports and Communications to interface with a given device/microcontroller. Therefore making it easy to transfer APM code between platforms without having to port over the main code(for the most part). I was wondering if you had any experience in modify/creating APHAL device files. Ive skimmed your project and I it appears you made APHAL file/script for the raspberry pi?

I am asking because I am looking to improve the outdated ArduIMU v3. I want to use the sensor reading and Euler conversion part of the ArduPilot code but in order to do that I would need to make my own APHAL file/script for the ArduIMU v3? Correct me if Im wrong. 

Do I have my information correct? Could you help me out with some resources or point me in a certain direction? 

Comment by Gareth on July 31, 2013 at 1:37pm

Daniel

There is an empty HAL on the github which gives you a template to implement your own.  It's largely a low level wrapper, pin read/write, timers, buses, etc.  It doesn't do sensor fusion - you need the mpu6050 inertialsensor library for that.

Best

Gareth

Comment by Daniel Nugent on July 31, 2013 at 2:39pm

Thanks. I looked at the empty APHAL. I had no idea what was going on. I dont think I understand the system on a large enough scale to comprehend everything that is going on. Im sure I could put my time into it to solve my problem, but there is probably an easier way. I have looked into the mpu6050 library before, I guess I'll have to take a deeper look into it and see if I can modify it to be used without an APHAL.

Thanks for your help.

Comment by Crashpilot1000 on July 31, 2013 at 2:44pm

Thank you very much for sharing your code with explanation!

Comment by Crashpilot1000 on July 31, 2013 at 3:22pm

BTW: What do you think of the native mpu earthframe representation? I found a zip here http://ardupilot.com/downloads/?did=35 but I haven't looked at it - mainly because it needs some mac software to display the data. But there must be a difference :) .......

Comment by Jesse on July 31, 2013 at 3:34pm

That is arguably the most practical, useful and clear explanation I have seen yet!!  I will most definitely be using your tutorial to move on one of my projects in a few months!!!  Thanks very much for sharing this!!

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2014   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service