自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx

上传人:b****8 文档编号:28689678 上传时间:2023-07-19 格式:DOCX 页数:18 大小:16.85KB
下载 相关 举报
自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx_第1页
第1页 / 共18页
自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx_第2页
第2页 / 共18页
自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx_第3页
第3页 / 共18页
自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx_第4页
第4页 / 共18页
自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx

《自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx》由会员分享,可在线阅读,更多相关《自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx(18页珍藏版)》请在冰豆网上搜索。

自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap.docx

自主移动机器人路径规划新方法附录MATLAB程序代码fpp与mmap

自主移动机器人路径规划新方法

MATLAB程序代码

fpp.m

functionvarargout=fpp(varargin)

%FPPM-fileforfpp.fig

%FPPbyitselfcreatesanewFPPorraisestheexisting

%singleton*.

%

%H=FPPreturnsthehandletoanewFPPorthehandleto

%theexistingsingleton*.

%

%FPP('CALLBACK'hobxxxxjecteventDatahandles...)callsthelocal

%functionnamedCALLBACKinFPP.Mwiththegiveninputarguments.

%

%FPP('Property''Value'...)createsanewFPPorraisesthe

%existingsingleton*.Startingfromtheleftpropertyvaluepairsare

%appliedtotheGUIbeforefpp_OpeningFcngetscalled.An

%unrecognizedpropertynameorinvalidvaluemakespropertyapplication

%stop.Allinputsarepassedtofpp_OpeningFcnviavarargin.

%

%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone

%instancetorun(singleton)".

%

%Seealso:

GUIDEGUIDATAGUIHANDLES

%Edittheabovetexttomodifytheresponsetohelpfpp

%LastModifiedbyGUIDEv2.516-Dec-201008:

30:

01

%Begininitializationcode-DONOTEDIT

gui_Singleton=1;

gui_State=struct('gui_Name'mfilename...

'gui_Singleton'gui_Singleton...

'gui_OpeningFcn'@fpp_OpeningFcn...

'gui_OutputFcn'@fpp_OutputFcn...

'gui_LayoutFcn'[]...

'gui_Callback'[]);

ifnargin&&ischar(varargin{1})

gui_State.gui_Callback=str2func(varargin{1});

end

ifnargout

[varargout{1:

nargout}]=gui_mainfcn(gui_Statevarargin{:

});

else

gui_mainfcn(gui_Statevarargin{:

});

end

%Endinitializationcode-DONOTEDIT

%---Executesjustbeforefppismadevisible.

functionfpp_OpeningFcn(hobxxxxjecteventdatahandlesvarargin)

%ThisfunctionhasnooutputargsseeOutputFcn.

%hobxxxxjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%varargincommandlineargumentstofpp(seeVARARGIN)

%Choosedefaultcommandlineoutputforfpp

handles.output=hobxxxxject;

%Updatehandlesstructure

guidata(hobxxxxjecthandles);

%UIWAITmakesfppwaitforuserresponse(seeUIRESUME)

%uiwait(handles.figure1);

map=[];

setappdata(0'map'map);

posf=0;

setappdata(0'posf'posf);

mapf=0;

setappdata(0'mapf'mapf);

axes(handles.axes1)%Selecttheproperaxes

axis([11001100-10300])

view([-20-1520])

set(handles.axes1'XMinorTick''on')

%---Outputsfromthisfunctionarereturnedtothecommandline.

functionvarargout=fpp_OutputFcn(hobxxxxjecteventdatahandles)

%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);

%hobxxxxjecthandletofigure

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Getdefaultcommandlineoutputfromhandlesstructure

varargout{1}=handles.output;

%---Executesonbuttonpressinpushbutton1.

functionpushbutton1_Callback(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletopushbutton1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

posf=0;

setappdata(0'posf'posf);

mapf=0;

setappdata(0'mapf'mapf);

i=1:

100;

j=1:

100;

w=str2double(get(handles.edit1'String'));

map=[];

setappdata(0'map'map);

A=zeros(100100);

axes(handles.axes1)%Selecttheproperaxes

mesh(ijA(ij))

axis([11001100-10300])

view([-20-1520])

set(handles.axes1'XMinorTick''on')

axes(handles.axes2)%Selecttheproperaxes

contour(ijA(ij)60)

set(handles.axes2'XMinorTick''on')

%---Executesonbuttonpressinpushbutton2.

functionpushbutton2_Callback(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletopushbutton2(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

posf=0;

setappdata(0'posf'posf);

mapf=1;

setappdata(0'mapf'mapf);

axes(handles.axes2)%Selecttheproperaxes

set(handles.axes2'XMinorTick''on')

axis([11001100]);

%holdon

h=msgbox('Drawawallbyusingtheleftmousebuttonforstartandrightmousebuttonforendingthewall');

uiwait(h5);

ifishandle(h)==1

delete(h);

end

but=0;

%but=1leftbut=3right

while(but~=1)

[xsysbut]=ginput

(1);

end

but=0;

while(but~=3)

[xeyebut]=ginput

(1);

end

xs=round(xs*10)/100;

ys=round(ys*10)/100;

xe=round(xe*10)/100;

ye=round(ye*10)/100;

map=getappdata(0'map');

w=str2double(get(handles.edit1'String'));

map=mmap([xsys][xeye]mapw);

setappdata(0'map'map);

i=1:

100;

j=1:

100;

x=map(:

2);

y=map(:

1);

w=map(:

3);

R=[];

A1=[];

%GoalY=y(length(x));

%GoalX=x(length(x));

forI=1:

100

forJ=1:

100

R=[];

forr=1:

length(x)-1

R=[Rw(r)/((J/10-y(r))^2+(I/10-x(r))^2)];

end

%RG=sqrt((J/10-GoalY)^2+(I/10-GoalX)^2);

A1(IJ)=sum(R);

if(A1(IJ)>300)

A1(IJ)=300;

end

end

end

A=A1;

axes(handles.axes1)%Selecttheproperaxes

mesh(ijA(ij))

axis([11001100-10300])

view([-20-1520])

set(handles.axes1'XMinorTick''on')

axes(handles.axes2)%Selecttheproperaxes

contour(ijA(ij)60)

set(handles.axes2'XMinorTick''on')

%---Executesonbuttonpressinpushbutton3.

functionpushbutton3_Callback(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletopushbutton3(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

i=1:

100;

j=1:

100;

mapf=getappdata(0'mapf');

if(mapf==1)

map=getappdata(0'map');

x=map(:

2);

y=map(:

1);

w=map(:

3);

R=[];

A1=[];

%GoalY=y(length(x));

%GoalX=x(length(x));

forI=1:

100

forJ=1:

100

R=[];

forr=1:

length(x)-1

R=[Rw(r)/((J/10-y(r))^2+(I/10-x(r))^2)];

end

%RG=sqrt((J/10-GoalY)^2+(I/10-GoalX)^2);

A1(IJ)=sum(R);

if(A1(IJ)>300)

A1(IJ)=300;

end

end

end

A=A1;

axes(handles.axes1)%Selecttheproperaxes

mesh(ijA(ij))

axis([11001100-10300])

view([-20-1520])

set(handles.axes1'XMinorTick''on')

axes(handles.axes2)%Selecttheproperaxes

contour(ijA(ij)60)

set(handles.axes2'XMinorTick''on')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

w=str2double(get(handles.edit1'String'));

h=msgbox('Selectthetargetusingtheleftmousebutton');

uiwait(h5);

ifishandle(h)==1

delete(h);

end

but=0;

while(but~=1)

[xvalyvalbut]=ginput

(1);

end

pos=[xval/10yval/10];

setappdata(0'pos'pos);

posf=1;

setappdata(0'posf'posf);

axes(handles.axes2)%Selecttheproperaxes

holdon

plot(xvalyval'ro');

holdoff

else

msgbox('Pleaseselectorcreatemapatfirst');

end

%---Executesonbuttonpressinpushbutton4.

functionpushbutton4_Callback(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletopushbutton4(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

w=str2double(get(handles.edit1'String'));

map=getappdata(0'map');

pos=getappdata(0'pos');

posf=getappdata(0'posf');

if(posf==1)

xval=round(pos

(1)*10)/10;

yval=round(pos

(2)*10)/10;

map=[map;

xvalyvalw];

[ABLMFNoSolxxyy]=getpath(map);

i=1:

100;

j=1:

100;

if(LMF==1)

%display('LocalMinimumexists')

set(handles.text2'String''LocalMinimumexists')

end

if(NoSol==1)

%display('NoSolution')

set(handles.text2'String''NoSolutionhasbeenfound')

else

if(LMF==1)

%display('LocalMinimumexists')

set(handles.text2'String''LocalMinimumexists')

else

%display('ASolutionexist')

set(handles.text2'String''Pathhasbeenfound')

end

end

axes(handles.axes1)%Selecttheproperaxes

mesh(ijA(ij)+B(ij))

axis([11001100-10300])

view([-20-1520])

set(handles.axes1'XMinorTick''on')

holdoff

axes(handles.axes2)%Selecttheproperaxes

contour(ijA(ij)+B(ij)60)

set(handles.axes2'XMinorTick''on')

holdon

plot(yyxx'*')

holdoff

posf=0;

setappdata(0'posf'posf);

else

msgbox('Pleaseselectthetargetpositionfirst');

end

functionedit1_Callback(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletoedit1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

%Hints:

get(hobxxxxject'String')returnscontentsofedit1astext

%str2double(get(hobxxxxject'String'))returnscontentsofedit1asadouble

%---Executesduringobxxxxjectcreationaftersettingallproperties.

functionedit1_CreateFcn(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletoedit1(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled

%Hint:

editcontrolsusuallyhaveawhitebackgroundonWindows.

%SeeISPCandCOMPUTER.

ifispc&&isequal(get(hobxxxxject'BackgroundColor')get(0'defaultUicontrolBackgroundColor'))

set(hobxxxxject'BackgroundColor''white');

end

%---Executesonbuttonpressinpushbutton5.

functionpushbutton5_Callback(hobxxxxjecteventdatahandles)

%hobxxxxjecthandletopushbutton5(seeGCBO)

%eventdatareserved-tobedefinedinafutureversionofMATLAB

%handlesstructurewithhandlesanduserdata(seeGUIDATA)

posf=0;

setappdata(0'posf'posf);

mapf=1;

setappdata(0'mapf'mapf);

i=1:

100;

j=1:

100;

w=str2double(get(handles.edit1'String'));

map1=[];

map1=mmap([30][32.5]map1w);

map1=mmap([32.5][62.5]map1w);

map1=mmap([36][310]map1w);

map1=mmap([76][710]map1w);

map1=mmap([76][86]map1w);

map=map1;

setappdata(0'map'map1);

x=map(:

2);

y=map(:

1);

w=map(:

3);

R=[];

A1=[];

%GoalY=y(length(x));

%GoalX=x(length(x));

forI=1:

100

forJ=1:

100

R=[];

forr=1:

length(x)-1

R=[Rw(r)/((J/10-y(r))^2+(I/10-x(r))^2)];

end

%RG=sqrt((J/10-GoalY)^2+(I/10-GoalX)^2);

A1(IJ)=sum(R);

if(A1(IJ)>300)

A1(IJ)=300;

end

end

end

A=A1;

axes(handles.axes1)%Selecttheproperaxes

mesh(ijA(ij))

axis([11001100-10300])

view([-20-1520])

set(handles.axes1'XMinorTick''on')

axes(handles.axes2)%Selecttheproperaxes

contour(ijA(ij)60)

set(handles.axes2'XMinorTick''on')

%---Exe

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 小学教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1