资源简介

matlab实现的利用backstepping算法设计的移动机器人轨迹跟踪控制器,有四种轨迹,分别是直线、圆、椭圆和不规则轨迹。

资源截图

代码片段和文件信息

t=0:0.1:100;
n=length(t);
a=1;b=1.5;
l=0.2005;
r=0.097;
e=[];
u=[];
se=[];
se(1)=pi*3/4;
k1=0.01;k2=0.01;ky=1.5;ks=15.2;
ser=[];vc=[];
x=[];y=[];xe=[];ye=[];see=[];
x(1)=1.2;y(1)=0.8;
w=[];w(1)=0.3;
v=[];v(1)=0.4;
xr=[];yr=[];yr(1)=0;xr(1)=1;ser(1)=pi/2;
p=[];seo=[];
for i=1:n
    vc=2.5-2*i*0.1/(0.1*i+5);wc=1+0.2*i/(0.1*i+5);
    vcd=-0.2*((0.1*i+5)^(-1))+0.02*i*((0.1*i+5)^(-2));
    wcd=0.2*((0.1*i+5)^(-1))-0.02*i*((0.1*i+5)^(-2));rc=0.2;
    ser(i+1)=ser(i)+wc*0.1;
    xr(i+1)=xr(i)+0.1*vc*cos(ser(i+1));yr(i+1)=yr(i)+0.1*vc*sin(ser(i+1));
    se(i+1)=se(i)+0.1*w(i);
    x(i+1)=x(i)+0.1*v(i)*cos(se(i));
y(i+1)=y(i)+0.1*v(i)*sin(se(i));
e=[cos(se(i))*(xr(i)-x(i))+sin(se(i))*(yr(i)-y(i));
    -sin(se(i))*(xr(i)-x(i))+cos(se(i))*(yr(i)-y(i));
    ser(i)-se(i)];
xe(i)=e(1);ye(i)=e(2);see(i)=e(3);
jiaosd=wc+2*vc*ky*ye(i)*cos(see(i)/2)+ks*sin(see(i)/2);
yed=-(wc+2*ky*ye(i)*vc*cos(see(i))+ks*sin(see(i)/2))*xe(i)+vc*sin(see(i));
sed=-2*ky*ye(i)*vc*cos(see(i)/2)-ks*sin(see(i)/2);
jiaosdd=wcd+2*ky*(vc*yed+vcd*ye(i))*cos(see(i)/2)-ky*vc*ye(i)*sin(see(i)/2)*sed+0.5*ks*cos(see(i)/2)*sed;
xiansd=vc*cos(see(i))+k1*sin(atan(jiaosd))*jiaosd*xe(i)-k1*vc*sin(atan(jiaosd))*sin(see(i))+k2*(xe(i)-k1*sin(atan(jiaosd))*ye(i))-k1*cos(atan(jiaosd))*(1/(1+jiaosd^2))*jiaosdd*ye(i);
w(i+1)=jiaosd;v(i+1)=xiansd;
end
figure;
plot(x(1:1000)y(1:1000)‘:k‘);
hold on;
plot(xr(1:1000)yr(1:1000)‘r‘);h_xlabel=xlabel(‘x/m‘);h_ylabel=ylabel(‘y/m‘);h_legend=legend(‘实际轨迹‘‘期望轨迹‘2);legend boxoff;
set(h_xlabel‘fontsize‘16);set(h_ylabel‘fontsize‘16);set(gca‘fontsize‘14); set(h_legend‘fontsize‘18);
saveas(gcf‘renyiyi‘‘emf‘);
zuob1=(1:100)/10;
figure;plot(zuob1v(1:100)‘r‘);hold on; plot(zuob1w(1:100)‘g‘);
zuob=(1:1000);
figure;plot(zuob/10xr(1:1000)-x(1:1000)‘r‘);h_xlabel=xlabel(‘t/s‘);h_ylabel=ylabel(‘x_e/m y_e/m \theta_e/rad‘);hold on;plot(zuob/10yr(1:1000)-y(1:1000)‘:k‘);hold on;plot(zuob/10see(1:1000)+0.01‘--b‘);
h_legend=legend(‘x_e‘‘y_e‘‘\theta_e‘1);legend boxoff;
set(h_xlabel‘fontsize‘16);set(h_ylabel‘fontsize‘16);set(gca‘fontsize‘14);set(h_legend‘fontsize‘18); 
saveas(gcf‘renyier‘‘emf‘);





 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      15732  2013-12-19 00:10  trajectorytrack-backsteeping\3.jpg

     文件      18911  2013-12-19 00:10  trajectorytrack-backsteeping\4.jpg

     文件      37220  2013-12-06 14:50  trajectorytrack-backsteeping\renyier.emf

     文件       2193  2008-03-26 11:33  trajectorytrack-backsteeping\renyilj.m

     文件      26536  2013-12-06 14:50  trajectorytrack-backsteeping\renyiyi.emf

     文件       1523  2013-12-08 14:14  trajectorytrack-backsteeping\tuoyuan2lj.m

     文件      30092  2013-06-09 12:06  trajectorytrack-backsteeping\yuaner.emf

     文件       2085  2013-06-09 12:39  trajectorytrack-backsteeping\yuanljtest1.m

     文件      25284  2013-06-09 12:06  trajectorytrack-backsteeping\yuanyi.emf

     文件      30564  2013-12-09 16:47  trajectorytrack-backsteeping\zhier.emf

     文件       1992  2013-12-09 16:46  trajectorytrack-backsteeping\zhixianljtest1.m

     文件      21228  2013-12-09 16:47  trajectorytrack-backsteeping\zhiyi.emf

     文件        421  2012-05-29 08:07  trajectorytrack-backsteeping\新建文本文档.txt

     目录          0  2014-03-03 23:43  trajectorytrack-backsteeping

----------- ---------  ---------- -----  ----

               213781                    14


评论

共有 条评论