Attitude Holding Under Constant Disturbance
The spacecraft is commanded to hold a target attitude. The model includes attitude angle \( \theta \), angular velocity \( \omega \), control torque \( \tau \), and a small constant disturbance torque.
The disturbance torque may represent simplified environmental effects such as solar pressure, atmospheric drag torque, magnetic effects, or small modelling bias.
Why PD Can Leave a Steady-State Error
A PD controller uses attitude error and angular velocity:
The proportional term pulls the spacecraft toward the target. The derivative term damps motion. But under a constant disturbance torque, PD may settle at a non-zero attitude error because the proportional term must generate a balancing torque.
This means the spacecraft can look stable, but still not point exactly where required.
Adding Integral Action
PID adds an accumulated error term:
The integral term keeps accumulating error until it produces enough torque to cancel the disturbance. This is why PID can remove steady-state error.
But integral action has a serious weakness: it can keep growing even when the actuator is already saturated.
Integrator Windup
Real actuators cannot provide unlimited torque:
If the controller asks for more torque than the actuator can deliver, the output is clipped. However, the integral term may continue accumulating error. This is called windup.
Windup can cause overshoot, slow recovery, oscillation, and poor pointing response even though PID was added to improve the controller.
Why Integral Action Changes System Behaviour
The integral term accumulates past error over time. This allows the controller to generate a torque that cancels constant disturbances.
However, the integral term does not respond to actuator limits. When the actuator saturates, the applied torque stops increasing, but the integral term may continue to grow.
This is why PID can outperform PD in ideal conditions, but fail in realistic systems unless actuator constraints are explicitly handled.
Compare PD, PID, and PID with Anti-Windup
Select a controller mode and adjust the gains. The simulation includes a constant disturbance torque and actuator saturation. Watch how attitude error, torque, and the integral term behave.
Compare Controllers
This overlay runs PD, PID, and PID with anti-windup using the same gains and disturbance. It helps show how the three controllers behave differently under the same physical limits.
Anti-Windup and Real System Constraints
Anti-windup prevents the integral term from growing uncontrollably when the actuator is saturated. A simple approach is conditional integration.
This is not the only anti-windup method, but it demonstrates the engineering idea clearly: the controller must know that the actuator has physical limits.
if (!isSaturated) {
integralError += error * dt;
}
The important lesson is that PID is not automatically better than PD. It is better only when the integral term is handled carefully.
What This Problem Shows
Stable and damped, but may leave steady-state error under constant disturbance.
Can remove steady-state error, but may suffer from integrator windup.
Respects actuator limits and prevents the integral term from growing unrealistically.
The engineering lesson is: