Robot Dynamics and Control Study Notes (8)————Single Manipulator Sliding Mode Control Based on Disturbance Observer

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 \tiny k_{1}and effectively reducing chattering.

        The dynamic equation of the uncertain single robotic arm is

                                            \small \left ( I+\Delta I \right )\ddot{\theta }+\left ( d+\Delta d \right )\dot{\theta }+\delta _{0}\theta +mglcos\theta =u-f_{c}\left ( \dot{\theta },u\right )                    (8.25)

Among them \small \thetais the system output angle, \small I=\frac{4}{3}ml^{2}is the moment of inertia, \small mgis the gravity, \small uis the control input, \small f_{c}\left ( \dot{\theta },u \right )is the unknown nonlinear friction, is the center of mass from the rotation center of the \small lconnecting rod, is the viscous friction of the connecting rod movement \small d, \small \Delta Iand \small \Delta dis the uncertainty of the corresponding parameter Value \small \delta _{0}is the coefficient of elastic friction.

        Change the formula (8.25) into

                                          \small \ddot{\theta }=\frac{1}{I}u-\frac{d}{I}\dot{\theta }-\frac{\Delta I}{I}\ddot{\theta }-\frac{\Delta d}{I}\dot{\theta }-\frac{\delta _{0}}{I}{\theta }-\frac{1}{I}mglcos\theta -\frac{1}{I}f_{c}\left ( \dot{\theta },u \right )

        Then the uncertain single robotic arm can be described by the second-order differential equation:

                                                                       \small \ddot{\theta }=-b\dot{\theta }+au-f                                                 (8.26)

        Where \small b=\frac{d}{I}> 0, \small a=\frac{1}{I}> 0, \small aand \small bare known values, \small frepresentative of uncertainties, the sum of the gravity term, and a friction term, 

                                                   \small f=\frac{\Delta I}{I}\ddot{\theta }+\frac{\Delta d}{I}\dot{\theta }+\frac{\delta _{0}}{I}\theta +\frac{1}{I}mglcos\theta +\frac{1}{I}f_{c}\left ( \hat{\theta },u \right ) 

8.2 Design and analysis of sliding mode controller for single manipulator model

        The sliding surface is designed as

                                                                           \small s=ce+\dot{e},c> 0                                               (8.27)

Among them \small e=r-\theta, \small ris the location.

        Aiming at the controlled object formula (8.26), the design sliding mode control law is                                                     

                                                           \small u(t)=\frac{1}{a}\left ( c\dot{e}+\ddot{r}+b\dot{\theta }+\hat{f}+k_{1} sgn\left ( s \right )\right )                              (8.28)

Among them \small \hat{f}is \small fthe estimated value of the term through the interference observer, and \small \hat{f}is \small fthe estimated error of the term.

        The switching gain factor is \small k_{f}designed as

                                                                            \small k_{f}> \left | \tilde{f} \right |                                                          (8.29)

        The Lyapunov function is

                                                                            \small V_{1}=\frac{1}{2}s^{2}

        due to

                                                      \ small \ dot {s} = c \ dot {e} + \ ddot {e} = c \ dot {e} + \ ddot {r} - \ ddot {\ theta} = c \ dot {e} + \ ddot {r} + b \ dot {\ theta} -au + f

        Substituting the control law equation (8.28) into the above equation, we get:

                     \tiny \dot{s}=c\dot{e}+\ddot{r}+b\dot{\theta }-\left ( c\dot{e}+\ddot{r} +b\dot{\theta }+\hat{f}+k_{f}sgn\left ( s \right )\right )+f=-\left ( \hat{f}+k_{1}sgn\left ( s \right ) \right )+f=f-k_{1}sgn\left ( s \right )

then

                                                                   \small \dot{V}_{1}=s\dot{s}=s\tilde{f}-k_{1}\left | s \right |<0

        It can be seen that in order to be satisfied \small \dot{V}_{1}< 0, it is necessary to be satisfied \small k_{f}> \left | \tilde{f} \right |. If \small fthe estimation error of the term \small \tilde{f}is small enough, the switching gain coefficient \small k_{f}can be designed to be a small value, thereby effectively reducing chattering.

8.3 Design of interference observer

         In order to observe the interference \small fterm, the observer is designed as

                                               \small \begin{bmatrix} \dot{\hat{f}}\\ \dot{\hat{x}} \end{bmatrix}=\begin{bmatrix} 0 & 0\\ 1 & 0 \end{bmatrix}\begin{bmatrix} \hat{f}\\ \hat{x} \end{bmatrix}+\begin{bmatrix} 0\\ 1 \end{bmatrix}\left ( \ddot{r}+b\dot{\theta } \right )+\begin{bmatrix} 0\\ -a \end{bmatrix}u+\begin{bmatrix} k_{1}\\ k_{2} \end{bmatrix}\left [ \dot{e}-\hat{x} \right ]              (8.30)

Which \small \hat{f}is the interference \small festimate, \small \hat{x}for the \small \dot{e}estimation \small \tilde{x}=\dot{e}-\hat{x}, \small k_{1}and \small k_{2}gain configured by the pole.

        The interference observer formula (9.30) is expressed as:

                                                                           \small \dot{\hat{f}}=k_{1}\tilde{x}                                                          (8.31)

                                                              \small \dot{\hat{x}}=\hat{f}-au+k_{2}\tilde{x}+\ddot{r}+b\dot{\theta }                                            (8.32)

8.4 Simulation example

        Assuming that the dynamic equation of a single robotic arm is

                                                                   \small \ddot{\theta }=-b\dot{\theta }+au-f                                                   (8.33)                            

Among them \small a=5,b=15.

        Among the accused, take it \small f=5+0.15sint. The control law is (8.28), \small c=3.0and the interference observer takes the formula (8.31) and formula (8.32), which is taken \small k_{1}=1500,k_{2}=200. Take \small M=1, without using the interference observer, in order to overcome the \small fterm, a design is needed \small k_{f}=6.0, and the simulation results are shown in the figure and the figure. Take \small M=2, use the interference observer, take \small k_{f}=0.15, 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.

Guess you like

Origin blog.csdn.net/weixin_38452841/article/details/108787164