Hello, i'm currently working on a rotary inverted pendulum, main objective being stabilizing it in its upright position and possibly following a reference on the pendulum arm. For reference : α will be the pendulum angle, θ the arm position. I'm trying to set up a cascade controller, exploiting the transfer functions
and therefore finding
. I'll put an image of the simulink scheme below, i'm not sure if the problem is the tuning or the overall idea.
The model is linearized around the unstable equilibrium, and it should be precise enough since with Pole Placement and LQR it works, here's the code to have State Space.
a_33 = -(Jp*(km^2/Rm + br))/Jt;
a_43 = -(mp*l*r*(km^2/Rm +br))/Jt;
B = [0; 0; Jp*km/Rm; mp*r*l*km/Rm]/Jt;
G_alpha_theta = G(2)/G(1);
G_alpha_theta_simpl = minreal(G_alpha_theta,1e-3);
I'm aware I could use the gains found through pole placement to then set-up a PD like control, but i'd like to do it directly by shaping the PIDs on the transfer functions. For the tuning I've tuned C_theta on
and C_alpha on
. The order of the outputs is
but i'm not using velocities for the PID control since on the real system they're not measurable directly.