I'm implementing a set of loops to control pitch-and-roll angular positions.
In an inner-loop, motor speeds are adjusted to achieve desired angular rates of rotation (the "inner-loop setpoints").
An outer-loop decides these desired angular rates (the "inner-loop setpoints") based on the aircraft's angular positions.
Outer-loop
- Frequency = ~400Hz
- Outer PV = input angular position (in degrees)
- Outer SP = desired angular position - input angular position (in degrees)
Inner-loop
- Frequency = ~760Hz
- Inner PV = input angular rotation (in degrees-per-second)
- Inner SP = constant1 * Outer MV (in degrees-per-second)
- PWM = Inner MV / constant2 (as percentile)
I understand what I-gain does and why this is important, but I'm not able to see any practical reason for also having I-gain specified in the outer-loop. Surely the inner-loop would compensate for any accumulated error, leaving no error to compensate for in the outer-loop, or is my thinking flawed?
Any example gain values to elaborate would be greatly appreciated.