Skip to content

Latest commit

 

History

History
98 lines (67 loc) · 3.73 KB

README.md

File metadata and controls

98 lines (67 loc) · 3.73 KB

Inverted_Pendulum_Control

(See full mathematics derivation: Practice Problem 5 Presentation.pdf)

Simulating and controlling 2D inverted pendulum with pole-placement method in MATLAB

Problem Statement

image

Initial conditions

Constants

Parameters Values
Rod's mass ($m$) $1 \quad \textrm{kg} $
Wheel's mass ($M$) $5 \quad \textrm{kg} $
Rod's half length ($l$) $2 \quad \textrm{m} $
Drag coefficient ($d$) $5 \quad \textrm{kg/s} $

Initial conditions

Parameters Values
Wheel's initial position ($x_0$) $-3 \quad \textrm{m} $
Wheel's initial velocity ($\dot{x}_0$) $0 \quad \textrm{m/s} $
Rod's initial angle ($\theta_0$) $+30 \degree$
Rod's initial angular velocity ($\dot{\theta}_0$) $0 \quad \textrm{rad/s} $

Target conditions

Parameters Target values
Wheel's position ($x_f$) $+2 \quad \textrm{m} $
Rod's angle ($\theta_f$) $0 \degree$

Finding the Equation of Motion

Define the axes with position direction as follow:

image
Free-body diagram

Assuming the rod has uniformly distributed mass, hence the center of gravity $CG(x_m, y_m)$ is located at the middle of the rod, which can be expressed as follow:

$$\eqalign{ x_m &= x + l\sin\theta \\ y_m &= l\cos\theta }$$

The time derivation can be obtained as

$$\eqalign{ \dot{x}_m &= \dot{x} + l\dot{\theta}\cos\theta \\ \dot{y}_m &= -l\dot{\theta}\sin\theta }$$

The Lagrangian Method

One of the most efficient ways to find the equation of motion of mechanical system is the Lagrangian method. To use the Lagrangian method the total Kinetic energy ($T$), the total Potential energy ($P$), the conservative force ($Q^{nc}$), and the nonconservative force ($Q^{c}$) must be identified

Total Kinetic Energy

$$\eqalign{ T &= T_{wheel} + T_{rod} \\ &= \left( {1\over2}M\dot{x}^2 \right) + \left( {1\over2}m\left( \dot{x}_m^2 + \dot{y}_m^2\right) \right) }$$

Results

Free fall response

wheelpend_freefall_compressed.mp4

wheelpend_freefall_graph

Pole placement - eigen values placed at [-1.3 -1.4 -1.5 -1.6]

wheelpend_control_slow_compressed.mp4

wheelpend_control_slow_graph

Pole placement - eigen values placed at [-2 -2.1 -2.2 -2.3]

wheelpend_control_medium_compressed.mp4

wheelpend_control_medium_graph

Pole placement - eigen values placed at [-3 -3.1 -3.2 -3.3]

wheelpend_control_fast_compressed.mp4

wheelpend_control_fast_graph

References

[1] Steve Brunton. (2017, January 29). Inverted Pendulum on a Cart [Control Bootcamp]. Youtube https://youtu.be/qjhAAQexzLg

[2] Steve Brunton. (2017, January 29). Pole Placement for the Inverted Pendulum on a Cart [Control Bootcamp]. Youtube https://youtu.be/M_jchYsTZvM