8. Single robotic arm sliding mode control based on interference observer
8.1 Single robotic arm model
By introducing a disturbance observer, the uncertainty and external disturbance of the controlled object can be accurately estimated, thereby reducing the gain in sliding mode control and effectively reducing chattering.
The dynamic equation of the uncertain single robotic arm is
(8.25)
Among them is the system output angle, is the moment of inertia, is the gravity, is the control input, is the unknown nonlinear friction, is the center of mass from the rotation center of the connecting rod, is the viscous friction of the connecting rod movement , and is the uncertainty of the corresponding parameter Value is the coefficient of elastic friction.
Change the formula (8.25) into
Then the uncertain single robotic arm can be described by the second-order differential equation:
(8.26)
Where , , and are known values, representative of uncertainties, the sum of the gravity term, and a friction term,
8.2 Design and analysis of sliding mode controller for single manipulator model
The sliding surface is designed as
(8.27)
Among them , is the location.
Aiming at the controlled object formula (8.26), the design sliding mode control law is
(8.28)
Among them is the estimated value of the term through the interference observer, and is the estimated error of the term.
The switching gain factor is designed as
(8.29)
The Lyapunov function is
due to
Substituting the control law equation (8.28) into the above equation, we get:
then
It can be seen that in order to be satisfied , it is necessary to be satisfied . If the estimation error of the term is small enough, the switching gain coefficient can be designed to be a small value, thereby effectively reducing chattering.
8.3 Design of interference observer
In order to observe the interference term, the observer is designed as
(8.30)
Which is the interference estimate, for the estimation , and gain configured by the pole.
The interference observer formula (9.30) is expressed as:
(8.31)
(8.32)
8.4 Simulation example
Assuming that the dynamic equation of a single robotic arm is
(8.33)
Among them .
Among the accused, take it . The control law is (8.28), and the interference observer takes the formula (8.31) and formula (8.32), which is taken . Take , without using the interference observer, in order to overcome the term, a design is needed , and the simulation results are shown in the figure and the figure. Take , use the interference observer, take , the simulation result is shown as in the picture.
Figure 9.1 Control input signal (M=2)
Figure 9.2 Position tracking and tracking error (M=2)
Figure 9.3 Interference and its observation results (M=2)
Simulation program:
simulink main program: chap9_5sim.mdl
Controller S function: chap9_5ctrl.m
function [sys,x0,str,ts]=spacemodel(t,x,u,flag)
switch flag,
case 0,
[sys, x0,str,ts] = mdlInitializeSizes;
case 3,
sys = mdlOutputs(t,x,u);
case{2,4,9}
sys = [];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes
sizes = simsizes;
sizes.NumOutputs =1;
sizes.NumInputs =5;
sizes.DirFeedthrough =1;
sizes.NumSampleTimes =1;
sys = simsizes(sizes);
x0 = [];
str = [];
ts = [0 0];
function sys = mdlOutputs(t,x,u)
r = u(1);
dr = cos(t);
ddr = -sin(t);
th = u(2);
dth = u(3);
fp = u(5);
e = r-th;
de = dr - dth;
c = 3;
s = de+c*e;
b = 15;
a = 5;
M = 2;
if M ==1 % Traditional with SMC
Kf = 6;
% Kf = 0.15;
ut = 1/a*(c*de+ddr+b*dth+Kf*sign(s));
elseif M ==2 % SMC with observer
Kf = 0.15;
ut = 1/a*(c*de+ddr+b*dth+1*fp+Kf*sign(s));
end
sys(1) = ut;
Disturbance observer S function: chap9_5obv.m
function [sys,x0,str,ts]=s_function(t,x,u,flag)
switch flag,
case 0,
[sys, x0,str,ts] = mdlInitializeSizes;
case 1,
sys = mdlDerivatives(t,x,u);
case 3,
sys = mdlOutputs(t,x,u);
case{2,4,9}
sys = [];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates =2;
sizes.NumDiscStates =0;
sizes.NumOutputs =1;
sizes.NumInputs =4;
sizes.DirFeedthrough =0;
sizes.NumSampleTimes =0;
sys = simsizes(sizes);
x0 = [0;0];
str = [];
ts = [];
function sys = mdlDerivatives(t,x,u)
r = sin(t);
dr = cos(t);
ddr = -sin(t);
ut = u(1);
dth = u(3);
x2 = dr - dth;
K1 = 1500;
K2 = 200;
a =5;b = 15;
sys(1) = K1*(x2-x(2));
sys(2) = x(1)-b*x(2)-a*ut+K2*(x2-x(2))+ddr+b*dth+b*x(2);
function sys = mdlOutputs(t,x,u)
sys(1) = x(1);
Controlled object S function: chap9_5plant.m
function [sys,x0,str,ts] = s_function(t,x,u,flag)
switch flag,
case 0,
[sys,x0,str,ts] = mdlInitializesSizes;
case 1,
sys = mdlDerivatives(t,x,u);
case 3,
sys = mdlOutputs(t,x,u);
case{2,4,9}
sys = [];
otnerwise
error(['Unhandled flag = ',num2str(flag)]);
end
function [sys,x0,str,ts] = mdlInitializeSizes
sizes = simsizes;
sizes.NumContStates =2;
sizes.NumDiscStates =0;
sizes.NumOutputs =3;
sizes.NumInputs =1;
sizes.DirFeedthrough =0;
sizes.NumSampleTimes =0;
sys = simsizes(sizes);
x0 = [0;0];
str = [];
ts = [];
function sys = mdlDerivatives(t,x,u)
ut = u(1);
b = 15;
a = 5;
f = 5+0.15*sin(t);
ddth = -b*x(2)+a*ut-f;
sys(1)=x(2);
sys(2)=ddth;
function sys = mdlOutputs(t,x,u)
f = 5+0.15*sin(t);
sys(1) = x(1);
sys(2) = x(2);
sys(3) = f;
Drawing program: chap9_5plot.m
close all;
figure(1);
subplot(211);
plot(t,y(:,1),'r',y(:,2),'b');
xlabel('time(s)');
ylabel('Position tracking');
subplot(212);
plot(t,y(:,1)-y(:,2),'r');
xlabel('time(s)');
ylabel('Position tracking error');
figure(2);
plot(t,ut(:,1),'r');
xlabel('time(s)');
ylabel('Control input');
figure(3);
plot(t,f(:,3),'r',t,f(:,4),'b');
xlabel('time(s)');
ylabel('f and fp');
The Simulink simulation diagram and the m file of the corresponding S-Function function have been packaged and uploaded to the resource. The code has been slightly changed. Please download if necessary.