-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgatherDHentry.m
52 lines (38 loc) · 1.35 KB
/
gatherDHentry.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function [DH_entry] = gatherDHentry()
%A Basic file to take input from the user via a series of prompts
%close all
%Boolean for handling DH entry, 0 = false, 1 = true
%DH_entry = 0;
%Create a figure for the input ui
fig = uifigure('Name','DH Input','Position',[600 360 360 360]);
%Create a group for the selection buttons
bg = uibuttongroup(fig,'Position', [150 150 180 100]);
rb1 = uiradiobutton(bg,'Text','Enter DH Parameters','Position',[10 10 150 20], 'Value',0);
rb2 = uiradiobutton(bg,'Text','Enter Robot Parameters','Position',[10 30 180 20],'Value',0);
%Create a panel for the confirmation button
%pnl_con = uipanel(fig);
%Create a confirmaiton button on the panel
btn_con = uibutton(fig,'Text','Confirm','Position',[150 20 60 20],...
'ButtonPushedFcn', @(btn_con,event) ButtonPushed(fig, rb1,rb2));
%Start waiting to let the user adjust thier choice
uiwait(fig)
%Call the callback to find the value of DH_entry
ButtonPushed(fig,rb1,rb2)
%Close the input box
close(fig)
end
function DH_entry = ButtonPushed(fig, rb1, rb2)
%%Entering DH paramters directly
if(rb1.Value == 1)
DH_entry = 1;
%resume after the confirm botton has been pressed
uiresume(fig)
%Enter Robot paramters
elseif(rb2.Value == 1)
DH_entry = 0;
uiresume(fig)
%Somehow if no buttons are selected
else
return
end
end