Single-Axis Spacecraft Attitude Holding
Consider a rigid spacecraft rotating about one principal axis. The state contains attitude angle \( \theta \) and angular velocity \( \omega \). The controller commands torque \( \tau_c \), while the spacecraft is also subjected to a constant disturbance torque \( \tau_d \).
Here \(J\) is the spacecraft moment of inertia about the controlled axis. The disturbance may represent a simplified persistent effect such as solar-radiation-pressure torque, aerodynamic torque, residual magnetic torque, actuator bias, or model mismatch.
Why PD Can Leave a Steady-State Pointing Error
Define the pointing error as
A PD controller commands
The proportional term produces restoring torque, while the derivative term damps angular motion. Under a constant disturbance, however, a non-zero equilibrium error may be required to generate enough proportional torque to balance the disturbance.
Provides stable, damped attitude regulation with simple implementation and no integrator state.
Zero steady-state pointing error in the presence of a persistent constant disturbance.
How Integral Action Removes the Bias
A PID-like spacecraft attitude law augments the controller with accumulated error:
In discrete time,
The integral state stores past error. Under a constant disturbance, it can build the exact control torque needed to cancel the disturbance while allowing the instantaneous pointing error to return toward zero.
Integrator Windup Under Actuator Saturation
Real actuators cannot supply unlimited torque. Reaction wheels, control-moment gyros, thrusters, magnetic torquers, and other actuators all have finite authority.
The controller may request a torque \( \tau_{cmd} \) larger than the actuator can deliver. Saturation clips the applied torque:
If the integrator continues accumulating error while the actuator is saturated, the internal control demand can grow far beyond the realizable hardware output. This is integrator windup.
The result can be larger overshoot, longer settling time, sluggish recovery after leaving saturation, and unnecessarily large internal torque demand.
Anti-Windup and Real System Constraints
The simplest educational anti-windup strategy is conditional integration. Instead of always updating the integral state, integration is paused when saturation is active and the current error would drive the actuator still farther into saturation.
This is more useful than simply freezing the integrator whenever saturation occurs, because it still allows the stored integral state to unwind when the error is helping the controller return toward the allowable actuator region.
const pushingFurtherIntoPositiveSaturation =
rawTorque > tauMax && error > 0;
const pushingFurtherIntoNegativeSaturation =
rawTorque < -tauMax && error < 0;
const blockIntegration =
pushingFurtherIntoPositiveSaturation ||
pushingFurtherIntoNegativeSaturation;
if (!blockIntegration) {
integralError += error * dt;
}More advanced implementations may use back-calculation, tracking anti-windup, integrator clamping, or actuator-aware dynamic compensation.
Compare PD, PID, and PID with Anti-Windup
Adjust the spacecraft inertia, target attitude (entered in degrees), controller gains, disturbance torque, and actuator torque limit. The plots update automatically. Compare the selected controller with the other two architectures using exactly the same physical conditions.
Selected Controller — Performance Metrics
Compare All Three Controllers
The next plots run PD, PID without anti-windup, and PID with anti-windup under identical spacecraft inertia, disturbance, gain, target, and actuator constraints.
Controller Comparison Metrics
| Controller | Final error (rad) | Overshoot (%) | Settling time (s) | Max |τcmd| (N·m) | Saturation time (s) | Max |I| |
|---|
How to Read the Plots
Check overshoot, settling time, steady-state error, and whether the target is actually reached.
The gap between them reveals actuator saturation and lost control authority.
Shows which controller term dominates the torque demand and when the I-term is building.
\(|\tau_{cmd}|/\tau_{max}>1\) means the controller is requesting more torque than the actuator can provide.
Rapid growth during saturation is a direct indicator of windup risk.
A well-behaved closed-loop trajectory should converge toward \(e=0,\omega=0\).
What This Problem Shows
Simple and damped, but a constant disturbance can require a non-zero steady-state pointing error.
Integral action can remove steady-state bias, but unrestricted integration can create windup during saturation.
Accounts for actuator saturation and limits excessive integral accumulation while preserving integral action.
The deeper engineering lesson is: