I'll talk about the basic theory first. Take a simple pendulum for example, where its nonlinear equation of motion can be approximated by a linear time-invariant model
with kg, m/s², m. (Also check if your pendulum complies with the standard model). The plant is given by .
For a 2nd-order system, we can first test if a PD controller gives a satifactory performance. If a PD controller is used
then the closed-loop system becomes
which can be rewritten as
From the characteristic polynomial (denominator), we want to stabilize the pendulum according to the desired Hurwitz polynomial:
. The easiest way to obtain the values of α and β is to refer to some performance tables proposed by the control theorists. If you cannot find such tables, you can easily calculate them using the Binomial coefficient formula. For example, for 3rd-order systems, the formula gives and , and these Hurwitz coefficients will give a critically-damped response. In this example, we will take and , which will give a deadbeat response (Modern Control Systems by Dorf & Bishop). Next, we have to determine based on the desired settling time using the formula where the normalized settling time for is 5 seconds. If s, then . Making the substitutions of α, β, into the Hurwitz polynomial, the control gains , and the time constant can be determined though solving some simple algebraic equations (for low order systems). This technique is similar to the Pole Placement. In this example, the control gains , and the time constant are found as .
The closed-loop system is now stable
, but we can easily add a pre-filter (after the reference signal ) to cancel out the zero (numerator) of , to revert the sign, and to maintain the DC gain of 1 . Having that, this control configuration guarantees the plant output follows the reference signal and settles within 2 seconds .
Now, you can try applying this to your pendulum.