Can't stabilize system with PID
4 次查看(过去 30 天)
显示 更早的评论
Hi. I'm trying to stabilize a model for this articol: https://ethz.ch/content/dam/ethz/special-interest/mavt/dynamic-systems-n-control/idsc-dam/Research_DAndrea/Cubli/Cubli_IROS2012.pdf , with a PID controller, and it's not working. I don't even know that this is the corect order of the cascade PID. I even try to take each individual part of the cascade PID and simulate it and use the tuner for that. And still it doesn't working. Does anyone know what to do?
This is the cascade PID:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1723106/image.png)
This is the attempt to try to take individual part of the cascade and simulate:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1723111/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1723116/image.png)
This is the Control System tuner:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1723121/image.png)
2 个评论
Sam Chak
2024-6-26
编辑:Sam Chak
2024-6-26
First, you should show us how you obtained the transfer function in the image. Using parameters given in the paper (code provided by @Aquatris), you can compare and notice that there are discrepancies. Most likely, you have supplied your own values to the parameters.
%% Parameters
l = 0.085;
lb = 0.075;
mb = 0.419;
mw = 0.204;
Ib = 3.34e-3;
Iw = 0.57e-3;
Cb = 1.02e-3;
Cw = 0.05e-3;
Km = 25.1e-3;
g = 9.81;
%% State-space model
A = [0 1 0
(mb*lb + mw*l)*g/(Ib + mw*l^2), -Cb/(Ib + mw*l^2), Cw/(Ib + mw*l^2)
-(mb*lb + mw*l)*g/(Ib + mw*l^2), Cb/(Ib + mw*l^2), -Cw*(Ib + Iw + mw*l^2)/(Iw*(Ib + mw*l^2))];
B = [0
- Km/(Ib + mw*l^2)
Km*(Ib + Iw + mw*l^2)/(Iw*(Ib + mw*l^2))];
C = eye(3);
sys = ss(A, B, C, 0);
%% Transfer functions
G = tf(sys)
%% For SISO systems only (may not work on Cubli)
Gp = G(1);
Gc = pidtune(Gp, 'pidf')
Gcl = feedback(Gc*Gp, 1);
step(Gcl), grid on
采纳的回答
Aquatris
2024-6-26
编辑:Aquatris
2024-6-26
One thing you can do is use symbolic PID gains, plug them in your closed loop transfer function, and find the values via pole placement strategy. Below I provide the code where I use full state feedback and find a proportional gain to stabilize it, kind of like an LQR without optimization.
% model Parameters
l = 0.085;
lb = 0.075;
mb = 0.419;
mw = 0.204;
Ib = 3.34e-3;
Iw = 0.57e-3;
Cb = 1.02e-3;
Cw = 0.05e-3;
Km = 25.1e-3;
g = 9.81;
% model state-space matrices
A = [0 1 0;
(mb*lb+mw*l)*g/(Ib+mw*l^2) -Cb/(Ib+mw*l^2) Cw/(Ib+mw*l^2);
-(mb*lb+mw*l)*g/(Ib+mw*l^2) Cb/(Ib+mw*l^2) -Cw*(Ib+Iw+mw*l^2)/(Iw*(Ib+mw*l^2))];
B = [0
-Km/(Ib+mw*l^2)
Km*(Ib+Iw+mw*l^2)/(Iw*(Ib+mw*l^2))];
C = eye(3); % all outputs [theta_b theta_bDot theta_wDot]
sys = ss(A,B,C,0); %state space representation
% symbolic gain K, which is 1x3 matrix, full state feedback
syms K [1 3]
closedLoopPoles = eig(A-B*K*C); % for stability, we want [ real(closedLoopPoles) < 0 ]
% Gains found from pole placement, poles should be at -8 -20 and -27
sol = solve(closedLoopPoles==[-8;-20;-27],K);
% 2nd elements of the solution are actual numbers so use them
Kval = double([sol.K1(2),sol.K2(2),sol.K3(2)])
% form the closed loop and check stability
closedLoop = feedback(sys*Kval,eye(3));
damp(closedLoop)
t = 0:0.001:10;
u = [ones(length(t),1) zeros(length(t),1) zeros(length(t),1)]; % inputs for [theta_b theta_bDot theta_wDot]
lsim(closedLoop,u,t)
0 个评论
更多回答(1 个)
Sam Chak
2024-6-27
Here is the alternative control solution for finding the gains using LQR approach.
%% Parameters
l = 0.085;
lb = 0.075;
mb = 0.419;
mw = 0.204;
Ib = 3.34e-3;
Iw = 0.57e-3;
Cb = 1.02e-3;
Cw = 0.05e-3;
Km = 25.1e-3;
g = 9.81;
%% State-space model
A = [0 1 0
(mb*lb + mw*l)*g/(Ib + mw*l^2), -Cb/(Ib + mw*l^2), Cw/(Ib + mw*l^2)
-(mb*lb + mw*l)*g/(Ib + mw*l^2), Cb/(Ib + mw*l^2), -Cw*(Ib + Iw + mw*l^2)/(Iw*(Ib + mw*l^2))];
B = [0
- Km/(Ib + mw*l^2)
Km*(Ib + Iw + mw*l^2)/(Iw*(Ib + mw*l^2))];
C = eye(3);
sys = ss(A, B, C, 0);
%% LQR gain design
K = lqr(A, B, eye(size(A)), 1)
%% Closed-loop system
closedLoop = feedback(sys*K, eye(size(A)))
%% Simulation
t = 0:0.01:2;
u = zeros(length(t), 3);
x0 = [pi/4, 0, 0]';
lsim(closedLoop, u, t, x0), grid on
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!