✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
自主导引/导航车(Automated Guided Vehicles, AGV)又称无人搬运车或者轮式移动机器人,是指一种能够按照预先设定的路径行驶的无人驾驶智能化运输车辆,而且AGV的轨迹跟踪控制系统是一个典型的具有非完整约束的非线性系统.在过去的几十年中,因其潜在的广泛应用前景,有关AGV的研究受到了越来越多的学者和专家的关注和重视.
⛄ 部分代码
function guictrl(task)
% ========================================
% PROGRAM AIM :
% COMPLEMENTRY TO Navigate.m FILE
% ========================================
% HOW TO RUN :
% WILL RUN THROUGH Navigate.m
% ========================================
% SATVIR SINGH SIDHU, ARUN KHOSLA, JASBIR SINGH SAINI
% MAY 2009
% COPYRIGHT RESERVED
% ========================================
sys = get(gcf, 'UserData');
FigNum = watchon;
XLoc = findobj(gcf, 'Tag', 'XLoc');
YLoc = findobj(gcf, 'Tag', 'YLoc');
VAng = findobj(gcf, 'Tag', 'VAng');
TAng = findobj(gcf, 'Tag', 'TAng');
Velo = findobj(gcf, 'Tag', 'Velo');
Fou = findobj(gcf, 'Tag', 'Fou');
data.L = 30;
data.W = 13;
data.X = str2num(get(XLoc, 'String')); % X-Coordinate of Reference Point
data.Y = str2num(get(YLoc, 'String')); % Y-Coordinate of Reference Point
data.V = str2num(get(VAng, 'String')); % Vehicle Angle
data.T = str2num(get(TAng, 'String')); % Front Tyre Angle
data.v = str2num(get(Velo, 'String')); % Vehicle Velocity
data.F = str2num(get(Fou, 'String')); % Footprint of Uncertainty
VRef = findobj(gcf, 'Tag', 'VRef');
FTyr = findobj(gcf, 'Tag', 'FTyr');
RTyr = findobj(gcf, 'Tag', 'RTyr');
VBnd = findobj(gcf, 'Tag', 'VBnd');
% [VRef FTyr RTyr VBnd]
dsp = [get(VRef, 'Value') get(FTyr, 'Value') get(RTyr, 'Value') get(VBnd, 'Value')];
watchoff;
if task(1) == '#'
% CLOSE BUTTON PRESSED
if strcmp(task, '#Clos')
delete(gcf)
% HELP BUTTON PRESSED
elseif strcmp(task, '#SPlots')
FigNum = watchon;
NVS = findobj(gcf, 'Tag', 'NSpace'); % Handle for Navigation Space
hgsave(NVS, 'NVplots');
watchoff;
% CLEAR BUTTON PRESSED
elseif strcmp(task, '#Clr')
cla
% X LOCATION CHANGED
elseif strcmp(task, '#Xloc')
FigNum = watchon;
XLoc = findobj(gcf, 'Tag', 'XLoc');
Xloc = str2num(get(XLoc, 'String'));
if Xloc<0
Xloc = 0;
set(XLoc, 'String', num2str(Xloc));
elseif Xloc>200
Xloc = 200;
set(XLoc, 'String', num2str(Xloc));
end
data.X = Xloc
vehicle(data, dsp);
watchoff;
% Y LOCATION CHANGED
elseif strcmp(task, '#Yloc')
FigNum = watchon;
YLoc = findobj(gcf, 'Tag', 'YLoc');
Yloc = str2num(get(YLoc, 'String'));
if Yloc<0
Yloc = 0;
set(YLoc, 'String', num2str(Xloc));
elseif Yloc>200
Yloc = 200;
set(YLoc, 'String', num2str(Xloc));
end
data.Y = Yloc
vehicle(data, dsp);
watchoff;
% VEHICLE ANGLE CHANGED
elseif strcmp(task, '#Vang')
FigNum = watchon;
VAng = findobj(gcf, 'Tag', 'VAng');
V = str2num(get(VAng, 'String'));
if V<-90
V = -90;
set(VAng, 'String', num2str(V));
elseif V>270
V = 270;
set(VAng, 'String', num2str(V));
end
data.V = V
vehicle(data, dsp);
watchoff;
% TYRE ANGLE CHANGED
elseif strcmp(task, '#Tang')
FigNum = watchon;
TAng = findobj(gcf, 'Tag', 'TAng');
T = str2num(get(TAng, 'String'));
if T<-35
T = -35;
set(TAng, 'String', num2str(T));
elseif T>35
T = 35;
set(TAng, 'String', num2str(T));
end
data.T = T
vehicle(data, dsp);
watchoff;
% VEHICLE VELOCITY CHANGED
elseif strcmp(task, '#Vel')
FigNum = watchon;
Velo = findobj(gcf, 'Tag', 'Velo');
v = str2num(get(Velo, 'String'));
data.v = v;
watchoff;
% TRACE VEHICLE REFERENCE = Y/N
elseif strcmp(task, '#VRef')
FigNum = watchon;
VRef = findobj(gcf, 'Tag', 'VRef');
VR = get(VRef, 'Value');
watchoff;
% TRACE FRONT TYRES = Y/N
elseif strcmp(task, '#FTyr')
FigNum = watchon;
FTyr = findobj(gcf, 'Tag', 'FTyr');
FT = get(FTyr, 'Value');
watchoff;
% TRACE REAR TYRES = Y/N
elseif strcmp(task, '#RTyr')
FigNum = watchon;
RTyr = findobj(gcf, 'Tag', 'RTyr');
RT = get(RTyr, 'Value');
watchoff;
% TRACE VEHICLE BOUNDARY = Y/N
elseif strcmp(task, '#VBnd')
FigNum = watchon;
VBnd = findobj(gcf, 'Tag', 'VBnd');
VB = get(VBnd, 'Value');
watchoff;
% FOU MATRIX
elseif strcmp(task, '#Fou')
FigNum = watchon;
Fou = findobj(gcf, 'Tag', 'Fou');
data.F = str2num(get(Fou, 'String'));
if length(data.F) ~= (length(sys.Input)+length(sys.Output))
Str = '0';
for i = 2:(length(sys.Input)+length(sys.Output))
Str = strcat(Str, ' 0');
end
set(Fou, 'String', strcat('[', Str, ']'));
end
watchoff;
end
% START NAVIGATION
else strcmp(task, 'Sim')
F = data.F;
sys2 = ST1toIT2(sys, F);
% ========================
sys2.Name='SecondFLS'; % CHANGING THE FILENAME
assignin('base', 'it2fls', sys2); % SENDING IT2 FLS STRUCTURE INTO WORKSPACE
wrgfs(sys2); % WRITING GFS FILE
% ========================
for i=1:1000
TF = 5; % For LPA
% TF = 1; % For CCA
data.T = TF*runIT2([data.X data.V], sys2);
ndata = LPAlgo(data);
% ndata = CCAlgo(data);
if ndata.Y>=200
break;
end
data = ndata;
pause(0.0001);
end
end
⛄ 运行结果
⛄ 参考文献
[1]张美娜, 吕晓兰, 陶建平,等. 农用车辆自主导航控制系统设计与试验[J]. 农业机械学报, 2016, 47(7):6.
[2]陈威, 张喜斌, 李卫华,等. 自主导航车辆的轨迹纠偏方法及轨迹纠偏装置,车辆控制系统:, CN112550289A[P]. 2021.