Quadrocopter axis stabilization

Hi there!

I'm building a quadrocopter even though I know there a perfect working systems out there, but I want to learn something. I have a very accurate measurement of the actual attitude by a fusion of a gyro- and a accelerometer.

What I'm actually struggling at the moment is to give the motors the accurate corrections. I'm trying to stabilize one axis (the other motors aren't connected) and the motors work smoothly. To be very clear, my problem is only to translate the attitude information into accurate corrections for the motors.

My best attempt so far was to calculate the actual turning speed and trying to match it with the actual angle. So if the angle is 45degrees, the speed should be 45 degrees per second. This is overrun with a check that the angle speed does not get too high and doens't get infinetly small. The whole algorhytm runs with 100 Hertz. The problem is, that it swings around the actual target position and I don't know how to overcome the problem.

Any idea is appreciated!


Looks like you need to read up on PID control.

There's a PID library that will help you solve this problem.

Awesome, thanks! I’ll definitely use this from now on. I knew about PID, but didnt know there was a library to do this. Great!

good reading:

There is a MUCH easier way to measure altitude far more accurately. Pressure. You didn't mention ESC or PWM. I assume that's how you are controlling the motors. I'm doing something similar.

attitude, sbright :wink:

I’m sorry my eyes are playing tricks on me. I have rarely heard that word being used, but of course it is correct.