HW 12 Control of An Inverted Pendulum On A Cart

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

HW 12 Control of an inverted pendulum

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).

We know that inverted pendulum on card is a generalization of a


spring- mass system.
=>mx’’+cx’+kx=Bu with Euler-Lagrange equation we have
𝑀+𝑚 𝑚 ∗ 𝑙 ∗ 𝑐𝑜𝑠𝜑 𝑥 ′′ −𝑚𝑙𝜑′2 ∗ 𝑠𝑖𝑛𝜑 𝑢
[ 2 ] *[𝜑 ′′ ]+[ ]=[ ]
𝑚 ∗ 𝑙 ∗ 𝑐𝑜𝑠𝜑 𝐽 + 𝑚𝑙 −𝑚𝑔𝑙 ∗ 𝑠𝑖𝑛𝜑 0

𝑥 ′′ ′2
-1 𝑚𝑙𝜑 ∗ 𝑠𝑖𝑛𝜑 𝑢
=>[ ′′ ] = * M [ ]+[ ] (1)
𝜑 𝑚𝑔𝑙 ∗ 𝑠𝑖𝑛𝜑 0

If 𝑥’=𝑣𝑀, 𝑣𝑀’=(𝑚𝑙𝜔2sin𝜑−𝑚𝑔sin𝜑cos𝜑)+u/(𝑀+𝑚sin2𝜑) (2)


𝜑’=𝜔, 𝜔’=−𝑚𝑙𝜔2sin𝜑cos𝜑+𝑔sin𝜑(𝑀+𝑚)−ucos𝜑/𝑙(𝑀+𝑚sin2𝜑) (3)
Because (1),(2),(3) are not linear we have to create a linear equation. So we linearize around the
equilibrium point xe (φ, x, uΜ, ω)e

𝑥′ 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.

You might also like