I' m working on a university project and i encountered a problem i can't apparently solve by myself. The project consist in a 2D helicopter shape hanging from the ceiling which only has tail blade rotor driven by a DC motor, a motor shield to control it (HW-095) and a GY-251 board which mount an MPU6050. The objective is to bring back the shape to the starting position after a disturb (me pushing it). To do it i' m using this PID controller library: https://playground.arduino.cc/Code/PIDLibrary/
As input of the controller i have the yaw value from the MPU6050 and i write the output to the enable PIN of the motor shield as PWM signal to modulate the response.
I tried many methods to set the constant parameters Kp, Kd, Ki but it seems like whatever constants i use the system always diverges from the setpoint and permanently oscillate. Can anybody give some hints on how to set those?
What i tried: Method 1: Setting Kd, Ki to 0 and increasing Kp untill steady oscillation occur, calculate period of the oscillation to set Ki, Kd via Zieger Nichols tabulated guide. Setting Kd, Ki to 0. Increasing Kp untill steady oscillation, set it to 0 again and set Kd to a value where it kept the helicopter in the position i put it(I couldn't make it), set Ki to eliminate the steady error.