The inner loop uses a second-order state-space controller to stabilize the pendulum in its
upright position ( control), while the outer loop uses a Proportional-Derivative (PD)
controller to control the cart position. Note that we use a PD rather than PID controller
because the plant already provides some integral action.
Design Requirements
Use TuningGoal requirements to specify the desired closed-loop behavior. Specify a
response time of 3 seconds for tracking a setpoint change in cart position.
% Tracking of x command
req1 = TuningGoal.Tracking('xref','x',3);
To adequately reject impulse disturbances on the tip of the pendulum, use an LQR
penalty of the form
that emphasizes a small angular deviation and limits the control effort.
% Rejection of impulse disturbance dF
Qxu = diag([16 1 0.01]);
req2 = TuningGoal.LQG('dF',{'Theta','x','F'},1,Qxu);
Control of an Inverted Pendulum on a Cart