-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathturtlebot3_guide.m
714 lines (559 loc) · 29.4 KB
/
turtlebot3_guide.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
function varargout = turtlebot3_guide(varargin)
% TURTLEBOT3_GUIDE MATLAB code for turtlebot3_guide.fig
% TURTLEBOT3_GUIDE, by itself, creates a new TURTLEBOT3_GUIDE or raises the existing
% singleton*.
%
% H = TURTLEBOT3_GUIDE returns the handle to a new TURTLEBOT3_GUIDE or the handle to
% the existing singleton*.
%
% TURTLEBOT3_GUIDE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in TURTLEBOT3_GUIDE.M with the given input arguments.
%
% TURTLEBOT3_GUIDE('Property','Value',...) creates a new TURTLEBOT3_GUIDE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before turtlebot3_guide_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to turtlebot3_guide_OpeningFcn via varargin.
%
% *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 turtlebot3_guide
% Last Modified by GUIDE v2.5 08-Apr-2020 15:15:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @turtlebot3_guide_OpeningFcn, ...
'gui_OutputFcn', @turtlebot3_guide_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if 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 turtlebot3_guide is made visible.
function turtlebot3_guide_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 command line arguments to turtlebot3_guide (see VARARGIN)
% Choose default command line output for turtlebot3_guide
% user code
axes(handles.axes2);
imshow('img/turtlebot3_with_logo.png');
% addpath("utils/");
% addpath("img/");
% addpath("linker/");
addpath(genpath(""));
handles.output = hObject;
handles.log_level = "DEBUG";
handles.robot_position = [];
% handles.app.robot_num = 1;
% handles.app.robot_position = [];
% handles.app.task_type = [];
% handles.app.robot_namespace = [];
% handles.app.robot_namespace_increase = "";
guidata(hObject, handles);
delete_timer();
handles.timer1000 = timer(...
'ExecutionMode', 'fixedRate', ... % Run timer repeatedly.
'Period', 1, ... % Initial period is 1 sec.
'TimerFcn', {@timer_1000ms,hObject}); % Specify callback function.
handles.timer500 = timer(...
'ExecutionMode', 'fixedRate', ... % Run timer repeatedly.
'Period', 0.5, ... % Initial period is 1 sec.
'TimerFcn', {@timer_500ms,hObject}); % Specify callback function.
start(handles.timer1000);
start(handles.timer500);
guidata(hObject, handles);
% UIWAIT makes turtlebot3_guide wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = turtlebot3_guide_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 structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton_log_level.
function pushbutton_log_level_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_log_level (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes1);
% x = 1:0.01:10;
% y = sin(x);
% plot(x,y);
id = get(handles.listbox_log_level,'Value');
item = get(handles.listbox_log_level, 'String');
set_value = item(id);
handles.log_level = set_value;
log_manager(hObject, eventdata, handles, "INFO", strcat("The log level is setted: ", set_value ));
guidata(hObject, handles);
% function timer_1000ms(hObject,eventdata,hfigure)
% % Timer timer1 callback, called each time timer iterates.
% % Gets surface Z data, adds noise, and writes it back to surface object.
% handles = guidata(hfigure);
% log_manager(hObject, eventdata, handles, "DEBUG", "start button");
% x = 1:0.01:10;
% y = sin(x);
% plot(handles.axes1, 1,1, 'o', 'DisplayName', "ROBOT1"); hold on;
% plot(handles.axes1, 2,2, 'o', 'DisplayName', "ROBOT2"); hold on;
% plot(handles.axes1, 3,3, 'o', 'DisplayName', "ROBOT3"); hold on;
% plot(handles.axes1, 4,4, 'o', 'DisplayName', "ROBOT4");
% xlim(handles.axes1,[-10 10]);
% ylim(handles.axes1,[-10 10]);
% % legend(handles.axes1);
% % plot(handles.axes2, x,y);
% guidata(hfigure, handles);
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- 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
% x = 1:0.01:10;
% y = sin(x);
% plot(hObject, x,y);
% Hint: place code in OpeningFcn to populate axes1
% --- Executes on selection change in listbox1.
function listbox1_Callback(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox1
% --- Executes during object creation, after setting all properties.
function listbox1_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on key press with focus on listbox1 and none of its controls.
function listbox1_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata structure with the following fields (see MATLAB.UI.CONTROL.UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over listbox1.
function listbox1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to listbox1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
eventdata
hObject
handles
% --- Executes on button press in pushbutton_start.
function pushbutton_start_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_start (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "start button");
% --- Executes on button press in checkbox_experiment.
function checkbox_experiment_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_experiment (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
checkboxstate = get(hObject, 'Value');
if checkboxstate == 1
handles.app.task_type = "experiment";
end
if get(handles.checkbox_simulation, 'Value') == 1
set(handles.checkbox_simulation, 'Value', 0) ;
end
guidata(hObject, handles);
% Hint: get(hObject,'Value') returns toggle state of checkbox_experiment
% --- Executes on button press in checkbox_simulation.
function checkbox_simulation_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_simulation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
checkboxstate = get(hObject, 'Value');
if checkboxstate == 1
handles.app.task_type = "simulation";
end
if get(handles.checkbox_experiment, 'Value') == 1
set(handles.checkbox_experiment, 'Value', 0) ;
end
guidata(hObject, handles);
% Hint: get(hObject,'Value') returns toggle state of checkbox_simulation
function edit_select_robot_num_Callback(hObject, eventdata, handles)
% hObject handle to edit_select_robot_num (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 edit_select_robot_num as text
% str2double(get(hObject,'String')) returns contents of edit_select_robot_num as a double
log_manager(hObject, eventdata, handles, "DEBUG", "edit_select_robot_num");
string = get(handles.edit_select_robot_num, 'String');
handles.app.robot_num = str2double(string);
handles.app.robot_position = zeros(2,handles.app.robot_num);
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function edit_select_robot_num_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_select_robot_num (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
string = get(hObject, 'String');
handles.app.robot_num = str2double(string);
handles.app.robot_position = zeros(2,handles.app.robot_num);
guidata(hObject, handles);
% --- Executes on selection change in listbox_log.
function listbox_log_Callback(hObject, eventdata, handles)
% hObject handle to listbox_log (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox_log contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox_log
log_manager(hObject, eventdata, handles, "DEBUG", "listbox_log");
% --- Executes during object creation, after setting all properties.
function listbox_log_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox_log (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in listbox3.
function listbox3_Callback(hObject, eventdata, handles)
% hObject handle to listbox3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox3 contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox3
log_manager(hObject, eventdata, handles, "DEBUG", "listbox3");
% --- Executes during object creation, after setting all properties.
function listbox3_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox3 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on selection change in listbox_log_level.
function listbox_log_level_Callback(hObject, eventdata, handles)
% hObject handle to listbox_log_level (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "listbox_log_level");
% Hints: contents = cellstr(get(hObject,'String')) returns listbox_log_level contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox_log_level
% --- Executes during object creation, after setting all properties.
function listbox_log_level_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox_log_level (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --------------------------------------------------------------------
function menu_setup_Callback(hObject, eventdata, handles)
% hObject handle to menu_setup (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "menu_setup");
% --------------------------------------------------------------------
function robots2_Callback(hObject, eventdata, handles)
% hObject handle to robots2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "robots2");
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "Untitled_3");
% --------------------------------------------------------------------
function ROS_MASTER_IP_Callback(hObject, eventdata, handles)
% hObject handle to ROS_MASTER_IP (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "setup_basic");
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over pushbutton_log_level.
function pushbutton_log_level_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to pushbutton_log_level (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% handles.debug_level =
% --- Executes on button press in pushbutton_log_box_clear.
function pushbutton_log_box_clear_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_log_box_clear (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(handles.listbox_log, 'String', []);
log_manager(hObject, eventdata, handles, "DEBUG", "pushbutton_log_box_clear");
% --- Executes on selection change in popupmenu_topics.
function popupmenu_topics_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu_topics (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_topics contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu_topics
% --- Executes during object creation, after setting all properties.
function popupmenu_topics_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu_topics (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton_update_topics.
function pushbutton_update_topics_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_update_topics (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "pushbutton_update_topics");
topiclist = rostopic("list");
top = "topics...";
topiclist = [top;topiclist];
set(handles.popupmenu_topics, 'String', topiclist);
% --- Executes on button press in pushbutton_get_topic_run.
function pushbutton_get_topic_run_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_get_topic_run (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "pushbutton_get_topic_run");
id = get(handles.popupmenu_topics, 'Value');
topics = get(handles.popupmenu_topics, 'String');
topic = topics(id); topic = convertCharsToStrings(topic);
sub = rossubscriber(topic); msg = receive(sub, 1000);
info = showdetails(msg);
set(handles.listbox_rostopic_box, 'String', info);
% --- Executes on button press in pushbutton_get_topic_stop.
function pushbutton_get_topic_stop_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_get_topic_stop (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
log_manager(hObject, eventdata, handles, "DEBUG", "pushbutton_get_topic_stop");
% --- Executes on button press in checkbox_number_inc.
function checkbox_number_inc_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_number_inc (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 checkbox_number_inc
checkboxstate = get(hObject, 'Value')
if checkboxstate == 1
handles.app.robot_namespace_increase = "number";
end
if get(handles.checkbox_alphabet_inc, 'Value') == 1
set(handles.checkbox_alphabet_inc, 'Value', 0) ;
end
guidata(hObject, handles);
% --- Executes on button press in checkbox_alphabet_inc.
function checkbox_alphabet_inc_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_alphabet_inc (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 checkbox_alphabet_inc
checkboxstate = get(hObject, 'Value')
if checkboxstate == 1
handles.app.robot_namespace_increase = "alphabet";
end
if get(handles.checkbox_number_inc, 'Value') == 1
set(handles.checkbox_number_inc, 'Value', 0) ;
end
guidata(hObject, handles);
function edit_namespace_prefix_Callback(hObject, eventdata, handles)
% hObject handle to edit_namespace_prefix (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 edit_namespace_prefix as text
% str2double(get(hObject,'String')) returns contents of edit_namespace_prefix as a double
string = get(hObject, 'String');
handles.app.robot_namespace_prefix = convertCharsToStrings(string);
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function edit_namespace_prefix_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_namespace_prefix (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
string = get(hObject, 'String');
handles.app.robot_namespace_prefix = convertCharsToStrings(string);
guidata(hObject, handles);
% --- Executes on button press in checkbox_experiment.
function checkbox12_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_experiment (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 checkbox_experiment
% --- Executes on button press in checkbox_simulation.
function checkbox11_Callback(hObject, eventdata, handles)
% hObject handle to checkbox_simulation (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 checkbox_simulation
% --- Executes on button press in checkbox13.
function checkbox13_Callback(hObject, eventdata, handles)
% hObject handle to checkbox13 (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 checkbox13
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
function edit_master_ip_Callback(hObject, eventdata, handles)
% hObject handle to edit_master_ip (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 edit_master_ip as text
% str2double(get(hObject,'String')) returns contents of edit_master_ip as a double
% --- Executes during object creation, after setting all properties.
function edit_master_ip_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_master_ip (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton_connect_ros.
function pushbutton_connect_ros_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_connect_ros (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
addpath('../matlab/utils/');
ip = get(handles.edit_master_ip, 'String');
ip = convertCharsToStrings(ip);
ros_init(ip);
% --- Executes on selection change in listbox_rostopic_box.
function listbox_rostopic_box_Callback(hObject, eventdata, handles)
% hObject handle to listbox_rostopic_box (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns listbox_rostopic_box contents as cell array
% contents{get(hObject,'Value')} returns selected item from listbox_rostopic_box
% --- Executes during object creation, after setting all properties.
function listbox_rostopic_box_CreateFcn(hObject, eventdata, handles)
% hObject handle to listbox_rostopic_box (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: delete(hObject) closes the figure
delete_timer();
delete(hObject);
% --- Executes during object creation, after setting all properties.
function checkbox_alphabet_inc_CreateFcn(hObject, eventdata, handles)
% hObject handle to checkbox_alphabet_inc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
if get(hObject, 'Value') == 1
handles.app.robot_namespace_increase = "alphabet";
end
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function checkbox_number_inc_CreateFcn(hObject, eventdata, handles)
% hObject handle to checkbox_number_inc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
if get(hObject, 'Value') == 1
handles.app.robot_namespace_increase = "number";
end
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function checkbox_simulation_CreateFcn(hObject, eventdata, handles)
% hObject handle to checkbox_simulation (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
if get(hObject, 'Value') == 1
handles.app.task_type = "simulation";
end
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function checkbox_experiment_CreateFcn(hObject, eventdata, handles)
% hObject handle to checkbox_experiment (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
if get(hObject, 'Value') == 1
handles.app.task_type = "exteriment";
end
guidata(hObject, handles);
% --- Executes on button press in pushbutton_namespace_update.
function pushbutton_namespace_update_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_namespace_update (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% disp(handles.app)
data = get(handles.uitable_init_position, 'Data');
handles.app.robot_namespace = cell(handles.app.robot_num, 1);
for i = 1 : handles.app.robot_num
if handles.app.robot_namespace_increase == "number"
handles.app.robot_namespace{i} = (strcat(handles.app.robot_namespace_prefix, string(i)));
else
handles.app.robot_namespace{i} = (strcat(handles.app.robot_namespace_prefix, (char(97-1+i))));
end
% data{i,4} = handles.app.robot_namespace{i};
log_manager(hObject, eventdata, handles, "INFO", handles.app.robot_namespace{i});
end
guidata(hObject, handles);