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!
You need to be a member of diydrones to add comments!
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
Thanks Gareth! I was planning to hack the quadcopter code-base to develop an autopilot for my tilt-rotor quadcopter, but this should be a much easier way to start.
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.
It looks like you are using PID_PITCH_RATE for pitch, roll and yaw when calculating the outputs in the acro stabilization controller. Of course this will work, but you'd be using the pitch rate value for each axis. Am i losing it? Sorry if so! :-)
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/
Awesome post thanks!
How so? To my knowledge it is correct - and most of the code in the article was pasted from the working/correct completed code.