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!