✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
汽车工业经过100多年的发展,汽车技术已向着智能化发展,这将人类从枯燥的汽车驾驶生活中解救出来,也符合未来汽车的发展趋势。自动泊车系统是其中的一个方面。研究自动泊车系统,可以减少驾驶人员的操作负担,降低了驾驶人员的疲劳感及泊车过程中的碰撞和刮擦事故的发生,提高驾驶安全性,具有一定的实际意义。本文致力于研究自动平行泊车系统的控制方法,并通过仿真验证了该方法可以实现平行泊车。针对车辆低速倒车这一运动过程,建立了车辆数学模型。根据分析车辆数学模型,得到能够满足多数情况下的泊车路径。由于自动泊车过程可分解为寻找最佳泊车位置及从最佳泊车位置倒入停车位两个过程,针对这两个过程,分析了无障碍式及有障碍式的泊车路径。
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]曲龙. 基于MATLAB的自动泊车系统仿真研究[D]. 沈阳理工大学, 2013.
❤️ 关注我领取海量matlab电子书和数学建模资料
❤️部分理论引用网络文献,若有侵权联系博主删除