Build your own Autopilot - tutorial

3689539485?profile=original

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://ghowen.me/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!

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • link is dead. 

  • Hello every body

    I can not access the link which have been  provided here

    is there any one who has the file and is interstead in sharing them with me

    my email is mozareh@outlook.com

    thank you for your kindness

    best regards

  • John: well spotted thanks. Ill fix this now.

    Harry and Pat: lll add a note about this. Thanks

  • Thanks @Pat Hickey!!  I didnt even see the Ardupilot pulldown.  I was selecting a regular old mega from the board options and kept getting HAL related errors. 

  • Developer

    Make sure you have the APM project version of Arduino if you're using code based on the AP_HAL. The HAL depends on some changes to the Arduino IDE to work properly.

    You can download the IDE for mac and windows here:

    http://ardupilot.com/downloads/?did=45

    http://ardupilot.com/downloads/?did=44

    And you can find some instructions showing you how to select the right board type in the modified IDE here:

    http://dev.ardupilot.com/wiki/setting-up-to-program-arducopter/

  • How so? To my knowledge it is correct - and most of the code in the article was pasted from the working/correct completed code.

  • Oh well, I dont whats wrong since that's where I put em.

  • In your sketches folder, you need a directory called libraries that contains all the libs.

    Best

    Gareth

  • "AP_HAL_AVR_APM2 was not declared in this scope" 

    I've got the library in the Arduino directory. 

    Is there somewhere I need to #define or #include something or is it more complicated?

  • Thomas

    Not sure I really follow you - the purpose was to describe how the control algorithm works to stabilise a quad and how to code it.  The HAL library was really immaterial to the article.

    Best

    Gareth

This reply was deleted.