HW 12 Control of An Inverted Pendulum On A Cart
HW 12 Control of An Inverted Pendulum On A Cart
HW 12 Control of An Inverted Pendulum On A Cart
on a cart
Behnam Farzi
MATRICOLA: 0318595
2022-2023
HW 12 Control of an inverted pendulum
on a cart
Instructions
Consider the model of an inverted pendulum on a cart given in Lecture 10 and set M= 5 Kg, m = 1 kg, l =
1m and assume that the state variables are perfectly measured and that the actuators are ideal.
1. Design a LQR control on the basis of the linear approximation about the origin with the aim of
making the origin attractive. Simulate for initial conditions (both for the cart and the pendulum)
different than zero.
2. Design a non linear decoupling control to achieve the stabilization of the origin and to force the
position of the pendulum to track a circle of diameter 0.5 m in 2 seconds starting from zero initial
tracking errors. Compare with the simulations at point 1 ( same initial conditions ); provide the
control inputs required to track the circle.
Set M=5 kg, m=1 kg, l=1 m, an inverted pendulum on a cart, state variables are measured, and actuators
are ideal.
1. Create an attractive origin by basing the LQR control on a linear approximation about the origin.
Simulate the pendulum's and the cart's initial conditions not to be 0.
2. Create a nonlinear decoupling control that forces the pendulum's position to track a circle with a
diameter of 0.5 m in 2 seconds starting from zero initial tracking errors. Provide the control inputs
necessary to track the circle and compare your results to the simulations at point 1 (which had the same
initial conditions).
𝑥 ′′ ′2
-1 𝑚𝑙𝜑 ∗ 𝑠𝑖𝑛𝜑 𝑢
=>[ ′′ ] = * M [ ]+[ ] (1)
𝜑 𝑚𝑔𝑙 ∗ 𝑠𝑖𝑛𝜑 0
𝑥′ 0 0 1 0 𝜒
𝜑 ′ 0 0 0 1 𝜑
=>[ ′ ]=[0 (𝑚 2
∗ 𝑙 2
∗ 𝑔)/((𝑀 + 𝑚) ∗ (𝐽 + 𝑚𝑙2 ) − 𝑚2 ∗ 𝑙2 )) 0 0]*[𝑣𝑀]+
𝑣𝑀
𝜔′ 0 (𝑚 ∗ 𝑙 ∗ 𝑔) ∗ (𝑀 + 𝑚)/((𝑀 + 𝑚)(𝐽 + 𝑚𝑙2 ) − 𝑚2 ∗ 𝑙2 )) 0 0 𝜔
0
0
[(𝐽 + 𝑚𝑙2 )/((𝑀 + 𝑚)(𝐽 + 𝑚𝑙2 ) − 𝑚2 ∗ 𝑙2 ))]*u
(𝑚𝑙)/((𝑀 + 𝑚)(𝐽 + 𝑚𝑙2 ) − 𝑚2 ∗ 𝑙2 ))
=> if we do the calculations we can see that the system is reachable. So we can move the system
from the initial point or a final one or to the equilibrium point.
=> we can use the state feedback to stabilize the system.