⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autonavigator.m

📁 主要实现一无人自行车的控制自主导航
💻 M
📖 第 1 页 / 共 2 页
字号:
function varargout = autonavigator(varargin)%AUTONAVIGATOR M-file for autonavigator.fig%      AUTONAVIGATOR, by itself, creates a new AUTONAVIGATOR or raises the existing%      singleton*.%%      H = AUTONAVIGATOR returns the handle to a new AUTONAVIGATOR or the handle to%      the existing singleton*.%%      AUTONAVIGATOR('Property','Value',...) creates a new AUTONAVIGATOR using the%      given property value pairs. Unrecognized properties are passed via%      varargin to autonavigator_OpeningFcn.  This calling syntax produces a%      warning when there is an existing singleton*.%%      AUTONAVIGATOR('CALLBACK') and AUTONAVIGATOR('CALLBACK',hObject,...) call the%      local function named CALLBACK in AUTONAVIGATOR.M with the given input%      arguments.%%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one%      instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help autonavigator% Last Modified by GUIDE v2.5 13-Aug-2007 00:16:00% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @autonavigator_OpeningFcn, ...                   'gui_OutputFcn',  @autonavigator_OutputFcn, ...                   'gui_LayoutFcn',  [], ...                   'gui_Callback',   []);if nargin && ischar(varargin{1})   gui_State.gui_Callback = str2func(varargin{1});endif nargout    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else    gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before autonavigator is made visible.function autonavigator_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject    handle to figure% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% varargin   unrecognized PropertyName/PropertyValue pairs from the%            command line (see VARARGIN)% Choose default command line output for autonavigatorhandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes autonavigator wait for user response (see UIRESUME)% uiwait(handles.figure1);handles.x=10;handles.y=20;handles.angle_v=30;handles.angle_t=30;handles.conf='LE';handles.v=5;handles.status_cb=0;handles.tft=0;handles.trt=0;handles.tvb=0;handles.delta=0;handles.right=0;handles.left=0;handles.vplus=0;handles.vminus=0;guidata(hObject, handles);% --- Outputs from this function are returned to the command line.function varargout = autonavigator_OutputFcn(hObject, eventdata, handles)% varargout  cell array for returning output args (see VARARGOUT);% hObject    handle to figure% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;function edit1_Callback(hObject, eventdata, handles)% hObject    handle to edit1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit1 as text%        str2double(get(hObject,'String')) returns contents of edit1 as a doublehandles.x=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit1_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit2_Callback(hObject, eventdata, handles)% hObject    handle to edit2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit2 as text%        str2double(get(hObject,'String')) returns contents of edit2 as a doublehandles.y=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit2_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit2 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit3_Callback(hObject, eventdata, handles)% hObject    handle to edit3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit3 as text%        str2double(get(hObject,'String')) returns contents of edit3 as a doublehandles.angle_v=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit3 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit13_Callback(hObject, eventdata, handles)% hObject    handle to edit13 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit13 as text%        str2double(get(hObject,'String')) returns contents of edit13 as a doublehandles.angle_t=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit13_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit13 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit14_Callback(hObject, eventdata, handles)% hObject    handle to edit14 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit14 as text%        str2double(get(hObject,'String')) returns contents of edit14 as a doublehandles.v=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit14_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit14 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit15_Callback(hObject, eventdata, handles)% hObject    handle to edit15 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit15 as text%        str2double(get(hObject,'String')) returns contents of edit15 as a doublehandles.conf=get(hObject,'String');guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit15_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit15 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.%       See ISPC and COMPUTER.if ispc    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on button press in StartSim.function StartSim_Callback(hObject, eventdata, handles)% hObject    handle to StartSim (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)    x=handles.x;    y=handles.y;    angle_v=handles.angle_v;    angle_t=handles.angle_t;    v=handles.v;    conf=handles.conf;    status_cb=handles.status_cb;    tft=handles.tft;    trt=handles.trt;    tvb=handles.tvb;    delta=handles.delta;    and_method=get(handles.listbox2,'Value');    traj_algo=get(handles.pathcalc,'Value');    distance=track_gui(x,y,angle_v,angle_t,conf,v,status_cb,tft,trt,tvb,delta,and_method,traj_algo);       % --- Executes during object creation, after setting all properties.function Axes1_CreateFcn(hObject, eventdata, handles)% hObject    handle to Axes1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: place code in OpeningFcn to populate Axes1% --- Executes on button press in ClearWindow.function ClearWindow_Callback(hObject, eventdata, handles)% hObject    handle to ClearWindow (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)cla;clear all;% --- Executes on button press in checkbox1.function checkbox1_Callback(hObject, eventdata, handles)% hObject    handle to checkbox1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% Hint: get(hObject,'Value') returns toggle state of checkbox1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -