📄 autonavigator.m
字号:
handles.status_cb=get(hObject,'Value');guidata(hObject,handles);% --- Executes on button press in checkbox2.function checkbox2_Callback(hObject, eventdata, handles)% hObject handle to checkbox2 (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 checkbox2handles.trt=get(hObject,'Value');guidata(hObject,handles);% --- Executes on button press in checkbox3.function checkbox3_Callback(hObject, eventdata, handles)% hObject handle to checkbox3 (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 checkbox3handles.tft=get(hObject,'Value');guidata(hObject,handles);% --- Executes on button press in checkbox4.function checkbox4_Callback(hObject, eventdata, handles)% hObject handle to checkbox4 (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 checkbox4handles.tvb=get(hObject,'Value');guidata(hObject,handles);% --- Executes on button press in checkbox9.function checkbox9_Callback(hObject, eventdata, handles)% hObject handle to checkbox9 (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 checkbox9if get(hObject,'Value') % UIWAIT makes autonavigator wait for user response (see UIRESUME) uiwait(handles.figure1);else uiresume(handles.figure1);endfunction edit22_Callback(hObject, eventdata, handles)% hObject handle to edit22 (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 edit22 as text% str2double(get(hObject,'String')) returns contents of edit22 as a doublehandles.delta=str2double(get(hObject,'String'));guidata(hObject,handles);% --- Executes during object creation, after setting all properties.function edit22_CreateFcn(hObject, eventdata, handles)% hObject handle to edit22 (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 radiobutton1.function radiobutton1_Callback(hObject, eventdata, handles)% hObject handle to radiobutton1 (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 radiobutton1% --- Executes on button press in radiobutton2.function radiobutton2_Callback(hObject, eventdata, handles)% hObject handle to radiobutton2 (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 radiobutton2% --- Executes on button press in radiobutton3.function radiobutton3_Callback(hObject, eventdata, handles)% hObject handle to radiobutton3 (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 radiobutton3% --- Executes on selection change in listbox2.function listbox2_Callback(hObject, eventdata, handles)% hObject handle to listbox2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns listbox2 contents as cell array% contents{get(hObject,'Value')} returns selected item from listbox2% --- Executes during object creation, after setting all properties.function listbox2_CreateFcn(hObject, eventdata, handles)% hObject handle to listbox2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox 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 Initialize.function Initialize_Callback(hObject, eventdata, handles)% hObject handle to Initialize (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% this function is used to control manually the motion of the vehicle uwing mouse buttons x=handles.x; y=handles.y; angle_v=handles.angle_v; angle_t=handles.angle_t; v=handles.v; status_cb=handles.status_cb; tft=handles.tft; trt=handles.trt; tvb=handles.tvb; while(1) handles=guidata(hObject); left=handles.left; right=handles.right; vplus=handles.vplus; vminus=handles.vminus; [lf rf vpf vmf]=hum_cnt(x,y,angle_v,angle_t,v,status_cb,tft,trt,tvb,left,right,vplus,vminus); if lf==1 handles.left=0; guidata(hObject,handles); end if rf==1 handles.right=0; guidata(hObject,handles); end if vpf==1 handles.vplus=0; guidata(hObject,handles); end if vmf==1 handles.vminus=0; guidata(hObject,handles); end end % --- Executes on button press in RightSteer.function RightSteer_Callback(hObject, eventdata, handles)% hObject handle to RightSteer (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) handles.right=1; handles.left=0; handles.vplus=0; handles.vminus=0; guidata(hObject,handles);% --- Executes on button press in LeftSteer.function LeftSteer_Callback(hObject, eventdata, handles)% hObject handle to LeftSteer (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) handles.right=0; handles.left=1; handles.vplus=0; handles.vminus=0; guidata(hObject,handles); %distance=hum_cnt(x,y,angle_v,angle_t,v,status_cb,tft,trt,tvb,left,right,vplus,vminus); % --- Executes on button press in vplus.function vplus_Callback(hObject, eventdata, handles)% hObject handle to vplus (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) handles.right=0; handles.left=0; handles.vplus=1; handles.vminus=0; guidata(hObject,handles);% --- Executes on button press in vminus.function vminus_Callback(hObject, eventdata, handles)% hObject handle to vminus (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) handles.right=0; handles.left=0; handles.vplus=0; handles.vminus=1; guidata(hObject,handles);% --- Executes on button press in StartKeyHum.function StartKeyHum_Callback(hObject, eventdata, handles)% hObject handle to StartKeyHum (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; status_cb=handles.status_cb; tft=handles.tft; trt=handles.trt; tvb=handles.tvb;while(1) action_code=double(get(gcbf,'Currentcharacter')); left=0; right=0; vplus=0; vminus=0; if action_code==28 left=1; right=0; vplus=0; vminus=0; set(gcbf,'Currentcharacter','c'); elseif action_code==29 left=0; right=1; vplus=0; vminus=0; set(gcbf,'Currentcharacter','c'); elseif action_code==30 left=0; right=0; vplus=1; vminus=0; set(gcbf,'Currentcharacter','c'); elseif action_code==31 left=0; right=0; vplus=0; vminus=1; set(gcbf,'Currentcharacter','c'); elseif action_code==120 break; end hum_cnt(x,y,angle_v,angle_t,v,status_cb,tft,trt,tvb,left,right,vplus,vminus); end% --- Executes on selection change in pathcalc.function pathcalc_Callback(hObject, eventdata, handles)% hObject handle to pathcalc (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: contents = get(hObject,'String') returns pathcalc contents as cell array% contents{get(hObject,'Value')} returns selected item from pathcalc% --- Executes during object creation, after setting all properties.function pathcalc_CreateFcn(hObject, eventdata, handles)% hObject handle to pathcalc (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called% Hint: listbox 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -