there is no need to calculate the difference which will be multiplied with gains!
Adding the signal (input) in the way you did is absolutely the same as setting a setpoint. The same.
there is no need to MULTIPLY THE GAIN WITH THE SETPOINT ( set point is already in error value which is the difference between the gyro and the set point )
I don't think it is the same.This is only true when your setpoint (as determined by your control input) is zero.Normal PID:output = Pgain *(actual - setpoint) + Igain*(sum of errors) + Dgain*(change in error)Your controller:output = Pgain *(actual) - setpoint + Igain*(sum of actual) + Dgain*(change in actual)(here 'actual' will be your gyro reading)(I believe normally it would be written as setpoint-actual but it doesn't matter too much)Ignore I and D for now, and consider the following scenarios:A) Pgain = 2, actual = 10, setpoint = 0normal PID output = 2 * (10 - 0) = 20your controller output = (2 * 10) - 0 = 20Now the setpoint is not zeroB) Pgain = 2, actual = 0, setpoint = 30normal PID output = 2 * (0 - 30) = -60your controller output = (2 * 0) - 30 = -30C) Pgain = 2, actual = 0, setpoint = 50normal PID output = 2 * (0 - 50) = -100your controller output = (2 * 0) - 30 = -30I hope you can see that your controller is unaffected by the Pgain and therefore the response is not proportional to the error (difference between setpoint and actual) which is the point of a P controller.Now see this scenario:D) Pgain = 2, actual = 20, setpoint = 20normal PID output = 2 * (20 - 20) = 0your controller output = (2 * 20) - 20 = 20In this case you are exactly where you want to be, so there should be no output, but your controller is still trying to correct the motors!(If Pgain = 1 then you won't see this)Now consider the I term:E) actual = 20, setpoint = 20normal PID error to add to I term: 0your controller error to add to I term: 20The error will be zero, but your Iterm will keep growing and affecting the output when you don't want it to.What you are doing does not make sense. The issues with it are somewhat masked (I assume) by having a Pgain of 1, and mostly wanting a setpoint of zero.
a big mistake to consider P gain of mine equals the same gain of standerd PID sys ! you cant just erase the setpoint from the standerd PID and multiply it with the same gain! and wait to see results !
have you learned the code i have published ?
the minus values may not be always as you mention , reading the code deeply will help
comparing it to controller code on this site will be easier to understand http://www.brokking.net/ymfc-3d_v2_downloads.html
i have been working on my cuad and i have always wondering why error = gyrovalue-setpoint
again i thought just looking at the code for any expert than me will help , yes gyrovalue is the change of angle and that is a basic work of gyro does it give any thing else , i mean the gyro ?? it gives basically degrees/sec
my friend USING only gyro WILL stabilize the drone , that's my experience with this project!...... unfortunately that's the best i can do to show my work ...... thank you for your kind participation ......