I'm programming a quad from scratch (for fun) and have got gyro/accel data and pwm working fine, but I'm strugging on the PID stuff.
I tried tuning a PID with Input = pitch angle, output = motor offset, where:
motor[front].pulse = 1000 + throttle + pidout
motor[back].pulse = 1000 + throttle - pidout
I couldn't get it to stop oscillating and then I read about using PIDs to control the rate (rather than angle). so I changed my code to:
motor[front].pulse = 1000 + throttle + (pitchRCIN + gyro_x) * Kp
motor[back].pulse = 1000 + throttle - (pitchRCIN - gyro_x) * Kp
but the quad struggles to turn regardless of Kp. My theory is that as soon as it overshoots the angular rate it applies reverse to slow rate and just oscillates (albeit with small/invisible amplitude) rather than moving.
Can I not use PIDs with angle in and pwm out? Is rate controlled better and daisy chain with angle pid? Any idea why above rate only isnt working?