quadcoptor Tuning

Hello world i am Tarkesh ,i am building an arduino quadcoptor for my personal project ,my project is about to be complete , but i am stuck with some tuning problems ,my quad will be communicatong via xbee,so all the PId tuning is done through serial communication in my code attached .

So i tried stabilizing rate mode and got the following constants value
P-4:24
I-4.10
D-0.25
This seems to work ,but not that fine ,it hold the angle for sometime like about 10seconds ,and during that period i see little vibrations ,so when i lower the I gain ,my quadcoptor tends to lose the upthrust and drift along Gravity ,so i thought i might increase my PIDoutput limits from (-250,250) to (-300,300),but with this new limits my quad doesnt even hold any angle

Is something wrong with my code ,or.am i missing something? ? guys do give ur views thanks in advance :slight_smile:

pitch_and_roll.ino (7.92 KB)