How Can I add feedbacks on control inverted pendulum with LQR?

2 views (last 30 days)
Oguzhan Akbas
Oguzhan Akbas on 2 Jul 2021
Commented: Yoshi Minagawa on 28 Jul 2021
Hello everybody,
I have inverted pendulum system anda mechanism. I want to control this mechanism. I designed a full state feedback control system but the system has a input(reference) and a output(angle and cart position). I have a motion PLC. I can read actual position and velocity values. But I don't know where to add this actual positions.
My control system picture:
My parameters:
M = 0.5;
m = 0.2;
b = 0.1;
I = 0.006;
g = 9.8;
l = 0.3;
p = I*(M+m)+M*m*l^2; %denominator for the A and B matrices
A = [0 1 0 0;
0 -(I+m*l^2)*b/p (m^2*g*l^2)/p 0;
0 0 0 1;
0 -(m*l*b)/p m*g*l*(M+m)/p 0];
B = [ 0;
C = [1 0 0 0;
0 0 1 0];
D = [0;
states = {'x' 'x_dot' 'phi' 'phi_dot'};
inputs = {'u'};
outputs = {'x'; 'phi'};
sys_ss = ss(A,B,C,D,'statename',states,'inputname',inputs,'outputname',outputs);
Q = C'*C;
R = 1;
K = lqr(sys_ss,Q,R)
Thanks in advanced.

Answers (1)

Yoshi Minagawa
Yoshi Minagawa on 2 Jul 2021
Hi Oguzhan,
The value actually measured and obtained corresponds to Y. Therefore, if you get position and velocity values of the cart, these should be elements of Y.
On the other hand, when you implement this controller in PLC, you need to get all state value (x, x_dot, phi, phi_dot) to calcurate control input using LQR controller. If there is some lack of them, you need to estimate these value. If you know the position and angle and not the derivative value, you can find them by simply differentiating. As another method, it is common to use an observer for state feedback control as shown below.
Please note that the measurable value corresponds to Y.
I hope this will help.
Yoshi Minagawa
Yoshi Minagawa on 28 Jul 2021
Hi Oguzhan,
I'm sorry for my delay response.
In my understanding, the block diagram for this system can be drawn as below.
Or considering all states can be taken, I think it can also be draw like as below.
(If we can get all the states, we may treat the measured value as x because it is not necessary to distinguish it from the measured value. )
By the way, LQR is one of the regulator, that mean that it is used to make the state quantity 0. So note that LQI etc. is usually used when controlling to follow the target value.(please see the detail below)
I hope this will help.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!