I am struggling with a completely self built/written quad copter I am working on.
I am working on the PID controller for balance, right now just with a P value and it only reacts on ROLL and PITCH to minimize potential errors. I put the prototype on a box and use ropes to restrain it so it can not damage something/me.
My main question is currently related to the motor controll function.
Currently my PID controller gives me a number from -1024 to +1024 for each axis depending on tilt etc.
Currently I use this value, multiply it by 0.4 and ADD/DEDUCT it from the global THROTTLE variable.
So each motor receives THROTTLE (0-1000) and then depending on its position the PID value*0.4 is added/deducted to/from the THROTTLE.
1000 would be max power, 0 would be minimal power.
I am new to motor control with air vehicles and I think the way I control the motor is not right for a stable balancing.
What is a good way to control the motor power based on a PID value ? So right now I use an absolute value based on what my PID returns, regardless of throttle.
Aside from the fact that I will still have to tweak that value as it would cause a crash on startup (the absolute value from the PID would be higher than the total throttle) I have a bad feeling in general about it.
My main concern is that this approach is fast in calculation (no divisions etc) but the PID values are always in the same range while the THROTTLE can be low (start). So on lower THROTTLE values the same tilt currently results in a stronger response than on high THROTTLE values.
I am sure someone with more experience than me could light me up how to properly tune the motor power based on the PID output.