Rate Controller for a QuadCopter.

MartinL:
Hi vortix2950,

Your pilot setpoint for each of the axis should be converted to degrees per second, I suggest initially mapping the signals to a full scale range of: ±180°/s for roll/pitch and around ±270°/s for yaw.

(A full scale range of ±45° is used for auto-level, but its first necessary to get the quadcopter flying in rate mode).

The proportional gain depends on the size of your quadcopter, for a small quadcopter I'd initially use around 0.6 for roll/pitch and 1.6 for yaw.

I'd also recommend using the 490Hz analogWrite() function mapped from 0 to 255 on digital pin's 3, 9, 10 and 11, rather than the 50Hz servo library.

The gyroscope's full scale range and digital filter only needs to be set once and therefore can be placed in the setup() portion of your code.

if i map the values to 0 255 and use analogwrite, the esc doesnt like that and motors just keeps beeping and never turn on.