Skip to content

ywang864/CartPole_LQR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

CartPole_LQR

Design a LQR controller for Cart Pole system in ROS/Gazebo

based on https://github.com/linZHank/invpend_experiment

To execute, go to catkin_ws, run source and catkin build

in one terminal, run roslaunch invpend_control load_invpend.launch

in a new one terminal, run rosrun rosrun invpend_control lqr_CartPole.py

Lagrangian Dynamics

mPole = 2 mCart = 20 g = 9.81 lPole = 0.5

A = np.matrix([[0, 1, 0, 0], [0, 0, (-12 * mPole * g) / ((12 * mCart) + mPole), 0], [0, 0, 0, 1], [0, 0, (12 * g * (mCart + mPole)) / (lPole * ((13 * mCart) + mPole)), 0] ])

B = np.matrix([0, 13 / ((13 * mCart) + mPole), 0, -12 / (lPole * ((13 * mCart) + mPole))]).T

LQR parameters

Q = np.diag([1, 10, 1, 1]) R = np.diag([0.1])

K, S, E = control.lqr(A, B, Q, R)

Plot

lqr

PID vedio

vokoscreenNG-2023-03-01_14-43-00.mp4

LQR vedio

vokoscreenNG-2023-03-01_14-01-38.mp4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published