-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRR-Client-WebBrowser.html
1483 lines (1391 loc) · 80.9 KB
/
RR-Client-WebBrowser.html
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
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<meta charset="utf-8"/>
<!-- INCLUDE JQUERY -->
<script src="https://code.jquery.com/jquery-latest.js"></script>
<!-- INCLUDE RR AND PYODIDE -->
<script src="https://robotraconteur.github.io/robotraconteur_pyodide/pyodide.js"></script>
<!-- INCLUDE GOLDEN LAYOUT -->
<!-- GoldenLayout needs jQuery to work -->
<!-- <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script> -->
<!-- add GoldenLayout's main JS and CSS file, -->
<script type="text/javascript" src="https://golden-layout.com/files/latest/js/goldenlayout.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://golden-layout.com/files/latest/css/goldenlayout-base.css" />
<!-- goldenlayout-base.css contains purely the structural bits, so you also need a theme. -->
<!-- Just pick one of the available ones and include its CSS file -->
<!-- <link type="text/css" rel="stylesheet" href="https://golden-layout.com/files/latest/css/goldenlayout-dark-theme.css" /> -->
<link type="text/css" rel="stylesheet" href="https://golden-layout.com/files/latest/css/goldenlayout-light-theme.css" />
<!-- INCLUDE BLOCKLY -->
<script src="./blockly/blockly_compressed.js"></script>
<script src="./blockly/blocks_compressed.js"></script>
<!-- include blockly code generators -->
<script src="./blockly/javascript_compressed.js"></script>
<script src="./blockly/python_compressed.js"></script>
<!-- include blockly custom blocks -->
<!-- <script src="./blockly-customBlocks/print_div_block.js"></script> -->
<script src="./blockly-customBlocks/jog_joint_blocks.js"></script>
<script src="./blockly-customBlocks/jog_cartesian_blocks.js"></script>
<script src="./blockly-customBlocks/camera_blocks.js"></script>
<script src="./blockly-customBlocks/utils_blocks.js"></script>
<script src="./blockly-customBlocks/tool_blocks.js"></script>
<!-- include language for blockly msgs -->
<script src="./blockly/msg/js/en.js"></script>
<!-- INCLUDE CROPPER -->
<link rel="stylesheet" href="./cropperjs/dist/cropper.css">
<script src="./cropperjs/dist/cropper.js"></script>
<!-- INCLUDE STYLES -->
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<!-- Golden Layout Containers -->
<div id="wrapper">
<ul id="menuContainer"></ul>
<div id="layoutContainer"></div>
<li id = "robotOptsContainer">
<form>
<label for="chosen_robot">Select robot:</label>
<select name="available_robots" id="available_robots">
<!-- <option value="sawyer">Sawyer</option>
<option value="ur">UR</option>
<option value="abb">ABB</option> -->
<!-- <option value="4">4</option> -->
</select>
</form>
<button id="start_robot_btn" type="button" onclick="run_robot()">Start</button>
</li>
<div id="saveLayoutStateContainer">
<div class="btn-group">
<button id="saveLayoutState_btn" type="button">Save Current Layout State</button>
<button id="loadSavedLayoutState_btn" type="button">Reload with Saved Layout</button>
<button id="defaultLayoutState_btn" type="button">Reload with Default Layout</button>
</div>
</div>
</div>
<!-- General JS -->
<script type="text/javascript" src="./webui_bootstrap.js"></script>
<!-- Auto robot discovery -->
<script type="text/javascript" src="./scripts-discovery.js"></script>
<script type="text/javascript" src="./scripts-robot.js"></script>
<script type="text/javascript" src="./scripts-vision.js"></script>
<!-- Content HTMLs -->
<template id="template_JointSpaceControl">
<table id="table_JointSpaceControl" border="1" > <!-- border="1" > -->
<Tr>
<TH align="center" COLSPAN="6"> <H3>Joint Space Control</H3> </TH>
</Tr>
<Tr>
<TH> <H4>Min<br>(deg)</H4></TH>
<TH> <H4></H4></TH>
<TH> <H4>Current<br>(deg)</H4></TH>
<TH> <H4></H4></TH>
<TH> <H4>Max<br>(deg)</H4></TH>
<TH> <H4>Angle Input<br>(deg)</H4></TH>
</Tr>
<tr>
<td> <div align="center" id="j1_neg_limit"> N/A </div> </td>
<td> <button id="j1_neg_btn" type="button">J1-</button></td>
<td> <div align="center" id="j1_angle_out"> N/A </div> </td>
<td> <button id="j1_pos_btn" type="button">J1+</button></td>
<td> <div align="center" id="j1_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j1_angle_in" placeholder="deg_j1" value="0" > </td>
</tr>
<tr>
<td> <div align="center" id="j2_neg_limit"> N/A </div> </td>
<td> <button id="j2_neg_btn" type="button">J2-</button></td>
<td> <div align="center" id="j2_angle_out"> N/A </div> </td>
<td> <button id="j2_pos_btn" type="button">J2+</button></td>
<td> <div align="center" id="j2_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j2_angle_in" placeholder="deg_2" value="0" > </td>
</tr>
<tr>
<td> <div align="center" id="j3_neg_limit"> N/A </div> </td>
<td> <button id="j3_neg_btn" type="button">J3-</button></td>
<td> <div align="center" id="j3_angle_out"> N/A </div> </td>
<td> <button id="j3_pos_btn" type="button">J3+</button></td>
<td> <div align="center" id="j3_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j3_angle_in" placeholder="deg_j3" value="0" > </td>
</tr>
<tr>
<td> <div align="center" id="j4_neg_limit"> N/A </div> </td>
<td> <button id="j4_neg_btn" type="button">J4-</button></td>
<td> <div align="center" id="j4_angle_out"> N/A </div> </td>
<td> <button id="j4_pos_btn" type="button">J4+</button></td>
<td> <div align="center" id="j4_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j4_angle_in" placeholder="deg_j4" value="0" > </td>
</tr>
<tr>
<td> <div align="center" id="j5_neg_limit"> N/A </div> </td>
<td> <button id="j5_neg_btn" type="button">J5-</button></td>
<td> <div align="center" id="j5_angle_out"> N/A </div> </td>
<td> <button id="j5_pos_btn" type="button">J5+</button></td>
<td> <div align="center" id="j5_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j5_angle_in" placeholder="deg_j5" value="0" > </td>
</tr>
<tr>
<td> <div align="center" id="j6_neg_limit"> N/A </div> </td>
<td> <button id="j6_neg_btn" type="button">J6-</button></td>
<td> <div align="center" id="j6_angle_out"> N/A </div> </td>
<td> <button id="j6_pos_btn" type="button">J6+</button></td>
<td> <div align="center" id="j6_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j6_angle_in" placeholder="deg_j6" value="0" > </td>
</tr>
<tr>
<td> <div align="center" id="j7_neg_limit"> N/A </div> </td>
<td> <button id="j7_neg_btn" type="button">J7-</button></td>
<td> <div align="center" id="j7_angle_out"> N/A </div> </td>
<td> <button id="j7_pos_btn" type="button">J7+</button></td>
<td> <div align="center" id="j7_pos_limit"> N/A </div> </td>
<td> <input type="text" id="j7_angle_in" placeholder="deg_j7" value="0" > </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> <button id="j_angles_submit_btn" type="button">Move to angles!</button> </td>
</tr>
<tr>
<td COLSPAN="6"> <button id="stop_btn" type="button" >STOP! </button> </td>
</tr>
</table>
</template>
<template id="template_TaskSpaceControl">
<table id="table_TaskSpaceControl" border="1" >
<Tr>
<TH align="center" COLSPAN="2"> <H3>Task Space Control</H3> </TH>
</Tr>
<Tr>
<TH align="center" COLSPAN="2"> <H4>Position</H4> </TH>
</Tr>
<tr>
<td> <button id="X_neg_btn" type="button">X-</button> </td>
<td> <button id="X_pos_btn" type="button">X+</button> </td>
</tr>
<tr>
<td > <button id="Y_neg_btn" type="button">Y-</button> </td>
<td > <button id="Y_pos_btn" type="button">Y+</button> </td>
</tr>
<tr>
<td > <button id="Z_neg_btn" type="button">Z-</button> </td>
<td > <button id="Z_pos_btn" type="button">Z+</button> </td>
</tr>
<Tr>
<TH align="center" COLSPAN="2"> <H4><br>Orientation</H4> </TH>
</Tr>
<tr>
<td > <button id="theta_X_neg_btn" type="button">θ<sub>X</sub>-</button> </td>
<td > <button id="theta_X_pos_btn" type="button">θ<sub>X</sub>+</button> </td>
</tr>
<tr>
<td > <button id="theta_Y_neg_btn" type="button">θ<sub>Y</sub>-</button> </td>
<td > <button id="theta_Y_pos_btn" type="button">θ<sub>Y</sub>+</button> </td>
</tr>
<tr>
<td > <button id="theta_Z_neg_btn" type="button">θ<sub>Z</sub>-</button> </td>
<td > <button id="theta_Z_pos_btn" type="button">θ<sub>Z</sub>+</button> </td>
</tr>
<tr>
<td COLSPAN="2">
<table style="text-align: center; display: block; border: 1px solid; ">
<Tr> <TH > <H4>Current Pose wrt Base</H4> </TH> </Tr>
<tr> <td align="left"> ZYX Angles (deg): </td> </tr>
<tr> <td> <div align="left" id="cur_ZYX_angles"></div> </td></tr>
<tr> <td align="left"> Position (m): </td> </tr>
<tr> <td> <div align="left" id="cur_position"></div> </td></tr>
</table>
</td>
</tr>
</table>
</template>
<template id="template_SavePlaybackPoses">
<table id="table_SavePlaybackPoses" border="1" >
<Tr>
<TH align="center" COLSPAN="3"> <H3>Save & Playback Poses</H3> </TH>
</Tr>
<Tr>
<TH align="center" COLSPAN="3"> <H4>Saved Poses</H4> </TH>
</Tr>
<tr>
<td COLSPAN="3">
<select id="saved_poses_list" name="saved_poses_list" size="5" multiple style="width: 100%; font-size: 16px;">
<!-- <option value="0,0,0,0,0,0,0">0,0,0,0,0,0,0</option> -->
</select>
</td>
</tr>
<tr>
<td COLSPAN="3"> <button id="save_pose_btn" type="button" style="width: 100%;">SAVE Current Pose</button> </td>
</tr>
<tr>
<td COLSPAN="3"> <button id="up_sel_pose_btn" type="button" style="width: 100%;">Move UP Selected Pose</button> </td>
</tr>
<tr>
<td COLSPAN="3"> <button id="down_sel_pose_btn" type="button" style="width: 100%;">Move DOWN Selected Pose</button> </td>
</tr>
<tr>
<td COLSPAN="3"> <button id="del_sel_pose_btn" type="button" style="width: 100%;">REMOVE Selected Pose</button> </td>
</tr>
<tr>
<td COLSPAN="3"> <button id="go_sel_pose_btn" type="button" style="width: 100%;">GO to Selected Pose</button> </td>
</tr>
<tr>
<td> Speed (%): </td>
<td> <input id="joint_vel_range" type="range" min="0" max="100" value="100" step="5"
oninput="showJointVelValue()" onchange="showJointVelValue()"> </td>
<td> <div align="center" id="joint_vel_percentage"> 100 </div> </td>
</tr>
<tr>
<td COLSPAN="2"> Number of Loops: </td>
<td> <input type="number" id="num_loops_in" placeholder="number of loops" value="1" min="1"> </td>
</tr>
<tr>
<td COLSPAN="2"> Loop Time (s): </td>
<td> <input type="number" id="time_loops_in" placeholder="1 Loop time when speed is 100%" value="10.0" min="0" step="0.5"> </td>
</tr>
<tr>
<td COLSPAN="3"> <button id="playback_poses_btn" type="button" style="width: 100%;">(GO to initial pose and) <br> PLAYBACK Saved Poses!</button> </td>
</tr>
</table>
</template>
<template id="template_RobotStatus">
<table id="table_RobotStatus" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<Tr>
<TH align="center" COLSPAN="2">
<H3><BR> Robot Status</H3>
</TH>
</Tr>
<tr>
<TH> Robot State Flags: </TH>
<td>
<div align="left" id="print_div_flag_info"></div>
</td>
</tr>
<tr>
<TH>Joint Kinematic Info: </TH>
<td>
<div align="left" id="print_div_kin_info"></div>
</td>
</tr>
<tr>
<TH>Number of Joints:<br>
Joints Types (0:unkown, 1:revolute, 2:continuous, 3:prismatic, 4:wheel):<br>
Joint Velocity Limits:<br>
Joint Acceleration Limits:<br>
</TH>
<td>
<div align="left" id="print_div_num_info"></div>
</td>
</tr>
<tr>
<TH>End Effector Pose (wrt. Base Frame): </TH>
<td>
<div align="left" id="print_div_end_info"></div>
</td>
</tr>
<tr>
<TH>Desired Pose:<br>
Desired Inverse Kinematics Joint Angles (deg, rad):<br>
Is IK Solution Converged:
</TH>
<td>
<div align="left" id="print_div_ik_info"></div>
</td>
</tr>
</table>
</template>
<template id="template_RobotPreview">
<table id="table_RobotPreview" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<tr>
<td>
<iframe src="http://localhost:8000/index.html?noupdate=true" style="border:none; width: 100%; height: 100%" title="Robot Preview Iframe" id="iframe_RobotPreview"></iframe>
</td>
</tr>
</table>
</template>
<!-- Camera Feedback Area Template -->
<template id="template_CameraFeedback">
<table id="table_CameraFeedback" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<tr>
<td>
<form>
<label for="chosen_cam">Camera:</label>
<!-- <select name="available_cams" id="available_cams" onchange="run_vision()"> -->
<select name="available_cams" id="available_cams">
<!-- <option value="cam0">Cam0</option>
<option value="cam1">Cam1</option> -->
</select>
</form>
</td>
</tr>
<tr>
<td>
<!-- <canvas id="camera_image" width="320" height="240"></canvas> -->
<img id="camera_image">
</td>
</tr>
</table>
</template>
<!-- Train Vision Area template -->
<template id="template_TrainVision">
<table id="table_TrainVision" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<col width="160"><col >
<tr>
<td colspan = "2" align="left">
<form>
<label for="trained_visuals">Trained Visuals:</label>
<select name="trained_visuals" id="trained_visuals">
<!-- <option value="vis0">Visual_00</option> -->
</select>
</form>
</td>
</tr>
<tr>
<td rowspan="2">
<img id="selected_trained_visual"></img>
</td>
<td COLSPAN="1"> <button id="edit_name_selected_trained_visual_btn" type="button" style="width: 100%;">Edit Name</button> </td>
</tr>
<tr>
<td COLSPAN="1"> <button id="delete_selected_trained_visual_btn" type="button" style="width: 100%;">Delete</button> </td>
</tr>
<tr>
<td COLSPAN="2"> <button id="train_new_visual_btn" type="button" style="width: 100%;">Train New Visual</button> </td>
</tr>
</table>
<div id="modal_TrainVision" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span id="span_close" class="close">×</span>
<h2>Crop the image</h2>
</div>
<div class="modal-body">
<!-- <p>Some text in the Modal Body</p> -->
<div class="img-container">
<!-- <img id="image" src="../images/picture.jpg" alt="Picture"> -->
<!-- <img id="image" src="https://fengyuanchen.github.io/cropperjs/images/picture.jpg" alt="Picture"> -->
<img id="training_image">
</div>
</div>
<div class="modal-footer">
<!-- <h2>Modal Footer</h2> -->
<button type="button" id="btn_close">Cancel</button>
<button type="button" id="btn_reset">Reset</button>
<button type="button" id="btn_rot_m5">Rotate -5 deg</button>
<button type="button" id="btn_rot_p5">Rotate +5 deg</button>
<button type="button" id="btn_crop">Crop & Save</button>
</div>
</div>
</div>
</template>
<!-- Camera Calibration Area Template -->
<template id="template_CameraCalibration">
<table id="table_CameraCalibration" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<col><col>
<tr>
<td colspan = "2" align="left">
<form>
<label for="calibrated_cameras">Calibrated Cameras:</label>
<select name="calibrated_cameras" id="calibrated_cameras">
<!-- <option value="cam0">Camera_00</option> -->
</select>
</form>
</td>
</tr>
<tr>
<td align="right">Camera Matrix: </td>
<td>
<div align="left" id="print_div_selected_camera_matrix"></div>
</td>
</tr>
<tr>
<td align="right">Distortion Coefficients: </td>
<td>
<div align="left" id="print_div_selected_camera_distortion_coefficients"></div>
</td>
</tr>
<tr>
<td align="right">[R|t] of the 1st Calibration Pattern: </td>
<td>
<div align="left" id="print_div_selected_camera_RnT"></div>
</td>
</tr>
<tr>
<td align="right">RMS re-projection error: </td>
<td>
<div align="left" id="print_div_selected_camera_calibration_error"></div>
</td>
</tr>
<tr>
<td> <button id="delete_calibration_btn" type="button" style="width: 100%;">Delete</button> </td>
<td> <button id="calibrate_camera_btn" type="button" style="width: 100%;">Calibrate New</button> </td>
</tr>
</table>
<div id="modal_CameraCalibration" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span id="span_close_calibration" class="close">×</span>
<h2>Calibrate the Camera with a Checker Board </h2>
</div>
<div class="modal-body" id="modal_body_CameraCalibration">
<p>You need to use a planar Checker Board as the calibration object</p>
<p>If the selected camera is already calibrated, it will be overwritten. Otherwise a new calibration will be added.</p>
<table id="table_calibration_modal" border="1"> <!-- CELLPADDING="4" CELLSPACING="3"> -->
<col width="80%"><col width="20%"> <!-- It does not work, see css -->
<tr>
<td align="left">Please enter the Number of Squares in the WIDTH of the checker board: </td>
<td>
<input type="number" id="width_checkerboard_input" placeholder="width squares" value="8" min="1" style="font-size: 25px;">
</td>
</tr>
<tr>
<td align="left">Please enter the Number of Squares in the HEIGHT of the checker board: </td>
<td>
<input type="number" id="height_checkerboard_input" placeholder="height squares" value="7" min="1" style="font-size: 25px;">
</td>
</tr>
<tr>
<td align="left">Please enter one side length of the squares (in millimeters): </td>
<td>
<input type="number" id="square_size_input" placeholder="one side length of the squares (mm)" value="29.0" min="0" step="0.5" style="font-size: 25px;">
</td>
</tr>
<tr>
<td colspan = "2" align="left">Now capture checkerboard images from different positions and orientations </td>
</tr>
<tr>
<td align="left">For better results, at least 10 images are needed. </td>
<td> <button id="capture_img_calibration_btn" type="button" style="width: 100%;">Capture Image</button> </td>
</tr>
<tr>
<td>
<img id="calibration_camera_image"></img>
</td>
<td >
<div align="center" id="print_div_num_captured_calibration_imgs"></div>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<!-- <h2>Modal Footer</h2> -->
<button type="button" id="btn_close_calibration">Cancel</button>
<button type="button" id="btn_calibrate_n_save">Calibrate & Save</button>
</div>
</div>
</div>
</template>
<!-- ROBOT Calibration Area Template -->
<template id="template_RobotCameraCalibration">
<table id="table_RobotCameraCalibration" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<col><col>
<tr>
<td colspan = "2" align="left">
<form>
<label for="calibrated_robotcamerapairs">Calibrated Robot-Camera pairs:</label>
<select name="calibrated_robotcamerapairs" id="calibrated_robotcamerapairs">
<!-- <option value="robot-cam0">Robot00--Camera_00</option> -->
</select>
</form>
</td>
</tr>
<tr>
<td align="right">R<sub>(robot-camera)</sub>: </td>
<td>
<div align="left" id="print_div_selected_robotcamerapair_rotation_matrix"></div>
</td>
</tr>
<tr>
<td align="right">T<sub>(robot-camera)</sub>: </td>
<td>
<div align="left" id="print_div_selected_robotcamerapair_translation_vector"></div>
</td>
</tr>
<!-- <tr>
<td align="right">Calibration error: </td>
<td>
<div align="left" id="print_div_selected_robotcamerapair_calibration_error"></div>
</td>
</tr> -->
<tr>
<td> <button id="delete_robotcamerapair_calibration_btn" type="button" style="width: 100%;">Delete</button> </td>
<td> <button id="calibrate_robotcamerapair_btn" type="button" style="width: 100%;">Calibrate New</button> </td>
</tr>
</table>
<div id="modal_RobotCameraCalibration" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span id="span_close_robotcamera_calibration" class="close">×</span>
<h2>Calibrate Robot-Camera Pair Extrinsic Parameters with an ArUco Marker</h2>
</div>
<div class="modal-body" id="modal_body_RobotCameraCalibration">
<p>You need to attach an ArUco Marker as the calibration object to end effector of the robot</p>
<p>If the selected Robot-Camera pair is already calibrated, it will be overwritten. Otherwise a new calibration will be added.</p>
<table id="table_robotcamera_calibration_modal" border="1"> <!-- CELLPADDING="4" CELLSPACING="3"> -->
<col width="60%"><col width="40%"> <!-- It does not work, see css -->
<!-- <tr>
<td colspan = "2" align="left">Make sure you have defined a safe path in "Save & Playback" window for robot to travel during calibration. If you defined a safe path, press "OK". Otherwise press "Cancel". </td>
</tr> -->
<tr>
<td align="left">Selected Robot:</td>
<td>
<div align="left" id="print_div_robotcamera_calibration_selected_robot"></div>
</td>
</tr>
<tr>
<td align="left">Selected Camera: </td>
<td>
<div align="left" id="print_div_robotcamera_calibration_selected_camera"></div>
</td>
</tr>
<tr>
<td align="left">
<label for="dropdown_aruco_marker_dictionary">Please select the used ArUco Marker Dictionary:</label>
</td>
<td align="left">
<form >
<select name="dropdown_aruco_marker_dictionary" id="dropdown_aruco_marker_dictionary" style="width: 100%;">
<option value="cv2.aruco.DICT_4X4_50">DICT_4X4_50</option>
<option value="cv2.aruco.DICT_4X4_100">DICT_4X4_100</option>
<option value="cv2.aruco.DICT_4X4_250">DICT_4X4_250</option>
<option value="cv2.aruco.DICT_4X4_1000">DICT_4X4_1000</option>
<option value="cv2.aruco.DICT_5X5_50">DICT_5X5_50</option>
<option value="cv2.aruco.DICT_5X5_100">DICT_5X5_100</option>
<option value="cv2.aruco.DICT_5X5_250">DICT_5X5_250</option>
<option value="cv2.aruco.DICT_5X5_1000">DICT_5X5_1000</option>
<option value="cv2.aruco.DICT_6X6_50">DICT_6X6_50</option>
<option value="cv2.aruco.DICT_6X6_100">DICT_6X6_100</option>
<option value="cv2.aruco.DICT_6X6_250">DICT_6X6_250</option>
<option value="cv2.aruco.DICT_6X6_1000">DICT_6X6_1000</option>
<option value="cv2.aruco.DICT_7X7_50">DICT_7X7_50</option>
<option value="cv2.aruco.DICT_7X7_100">DICT_7X7_100</option>
<option value="cv2.aruco.DICT_7X7_250">DICT_7X7_250</option>
<option value="cv2.aruco.DICT_7X7_1000">DICT_7X7_1000</option>
<option value="cv2.aruco.DICT_ARUCO_ORIGINAL" selected>DICT_ARUCO_ORIGINAL</option>
<option value="cv2.aruco.DICT_APRILTAG_16h5">DICT_APRILTAG_16h5</option>
<option value="cv2.aruco.DICT_APRILTAG_25h9">DICT_APRILTAG_25h9</option>
<option value="cv2.aruco.DICT_APRILTAG_36h10">DICT_APRILTAG_36h10</option>
<option value="cv2.aruco.DICT_APRILTAG_36h11">DICT_APRILTAG_36h11</option>
</select>
</form>
</td>
</tr>
<tr>
<td align="left">Please enter the ID of the attached ArUco marker: </td>
<td>
<input type="number" id="arucomarker_id_input" placeholder="ID" value="7" min="1" style="font-size: 25px;">
</td>
</tr>
<tr>
<td align="left">Please enter one side length of the ArUco marker (in millimeters): </td>
<td>
<input type="number" id="arucomarker_size_input" placeholder="one side length of the marker (mm)" value="50.0" min="0" step="1" style="font-size: 25px;">
</td>
</tr>
<tr>
<td align="left">Please enter position vector from End Effector to center of the ArUco marker (in meters): </td>
<td>
<label for="eef_to_aruco_Tx">T<sub>X</sub>:</label>
<input type="number" id="eef_to_aruco_Tx_input" placeholder="(m)" value="0.0" step="0.01" style="font-size: 25px;">
<label for="eef_to_aruco_Ty">T<sub>Y</sub>:</label>
<input type="number" id="eef_to_aruco_Ty_input" placeholder="(m)" value="0.0" step="0.01" style="font-size: 25px;">
<label for="eef_to_aruco_Tz">T<sub>Z</sub>:</label>
<input type="number" id="eef_to_aruco_Tz_input" placeholder="(m)" value="0.05" step="0.01" style="font-size: 25px;">
</td>
</tr>
<tr>
<td align="left">Please enter RPY Euler angles from End Effector frame to the ArUco marker frame (in degrees): </td>
<td>
<label for="eef_to_aruco_Rx">θ<sub>X</sub>:</label>
<input type="number" id="eef_to_aruco_Rx_input" placeholder="(deg)" value="0.0" step="1.0" style="font-size: 25px;">
<label for="eef_to_aruco_Rz">θ<sub>Y</sub>:</label>
<input type="number" id="eef_to_aruco_Ry_input" placeholder="(deg)" value="0.0" step="1.0" style="font-size: 25px;">
<label for="eef_to_aruco_Rz">θ<sub>Z</sub>:</label>
<input type="number" id="eef_to_aruco_Rz_input" placeholder="(deg)" value="-90.0" step="1.0" style="font-size: 25px;">
</td>
</tr>
<tr>
<td colspan = "2" align="left">Now capture ArUco marker images from different positions and orientations </td>
</tr>
<tr>
<td rowspan = "4" align="left" id="table_cell_for_saved_poses"></td>
<td>
<button id="jog_sel_pose_btn" type="button" style="width: 100%;">GO to Selected Pose</button>
</td>
</tr>
<tr>
<td style="white-space: nowrap;">
<button id="jog_prev_pose_btn" type="button" style="width: 49%;">←</button>
<button id="jog_next_pose_btn" type="button" style="width: 49%;">→</button>
</td>
</tr>
<tr>
<td>
<button id="stop_robot_btn" type="button" style="width: 100%;">STOP ROBOT</button>
</td>
</tr>
<tr>
<td>
<button id="capture_img_robotcamera_calibration_btn" type="button" style="width: 100%;">Capture Image</button>
</td>
</tr>
<tr>
<td>
<img id="calibration_robotcamera_image"></img>
</td>
<td >
<div align="center" id="print_div_num_captured_robotcamera_calibration_imgs"></div>
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<!-- <h2>Modal Footer</h2> -->
<button type="button" id="btn_close_robotcamera_calibration">Cancel</button>
<button type="button" id="btn_robotcamera_calibrate_n_save">Calibrate & Save</button>
</div>
</div>
</div>
</template>
<!-- Camera Tracking Area Template -->
<template id="template_CameraTracking">
<table id="table_CameraTracking" border="1" > <!-- CELLPADDING="4" CELLSPACING="3"> -->
<tr>
<td > <button id="test_detection_btn" type="button" style="width: 100%;">Test Detection</button> </td>
</tr>
<tr>
<td>Selected Camera:
<div align="left" id="print_div_test_selected_camera"></div>
</td>
</tr>
<tr>
<td>Selected Visual:
<div align="left" id="print_div_test_selected_visual"></div>
</td>
</tr>
<tr>
<td>
<!-- <canvas id="camera_image" width="320" height="240"></canvas> -->
<img id="test_detection_result_image">
</td>
</tr>
<!-- <tr>
<td>Selected Camera Image Size:
<div align="left" id="print_div_test_selected_camera_img_size"></div>
</td>
</tr>
<tr>
<td>Selected Visual Image Size:
<div align="left" id="print_div_test_selected_visual_img_size"></div>
</td>
</tr> -->
<tr>
<td>Detected Object Size(width,height):
<div align="left" id="print_div_test_detected_obj_size"></div>
</td>
</tr>
<tr>
<td>Detected Object Center Coordinates in Camera Image Frame (x,y):
<div align="left" id="print_div_test_detected_obj_coordinates"></div>
</td>
</tr>
<tr>
<td>Detected Object Rotation Angle (+: CCW, -: CW):
<div align="left" id="print_div_test_detected_obj_angle"></div>
</td>
</tr>
</table>
</template>
<!-- print_div for debug texts -->
<template id="template_print_div">
<div id="print_div"></div>
</template>
<!-- Blockly Generated Code Area Template -->
<template id="template_BlocklyCode">
<table id="table_BlocklyCode" border="1" > <!-- -->
<!-- <Tr>
<TH align="left"> <H4>JavaScript Code:</H4> </TH>
</Tr>
<tr>
<td>
<textarea readonly id="textareaBlocklyJS" placeholder="Blockly generated Javascript code will be seen here.."> </textarea>
</td>
</tr> -->
<Tr>
<TH align="left"> <H4>Python Code:</H4> </TH>
</Tr>
<tr>
<td>
<textarea readonly id="textareaBlocklyPy" placeholder="Blockly generated Python code will be seen here.."> </textarea>
</td>
</tr>
<tr style="height: 10%;">
<td>
<button id="execute_blockly_btn" type="button">Execute Blockly Code</button>
</td>
</tr>
</table>
</template>
<!-- Blockly File Browser -->
<template id="template_BlocklyBrowser">
<table id="table_BlocklyBrowser" border="1" >
<Tr>
<TH align="center" COLSPAN="3"> <H3>Blockly Browser</H3> </TH>
</Tr>
<Tr>
<TH align="center" COLSPAN="3"> <H4>Saved Blocks</H4> </TH>
</Tr>
<tr>
<td COLSPAN="3">
<select id="saved_blocks_list" name="saved_blocks_list" size="5" multiple style="height:100%; width:100%; font-size: 16px;">
<!-- <option value="0,0,0,0,0,0,0">0,0,0,0,0,0,0</option> -->
</select>
</td>
</tr>
<tr>
<td> <button id="save_blocks_btn" type="button" style="width: 100%;">SAVE</button> </td>
<td> <button id="save_as_blocks_btn" type="button" style="width: 100%;">SAVE AS</button> </td>
<td> <button id="edit_blocks_name_btn" type="button" style="width: 100%;">EDIT NAME</button> </td>
</tr>
<tr>
<td> <button id="load_blocks_btn" type="button" style="width: 100%;">LOAD</button> </td>
<td> <button id="clear_blocks_btn" type="button" style="width: 100%;">CLEAR</button> </td>
<td> <button id="delete_blocks_btn" type="button" style="width: 100%;">DELETE</button> </td>
</tr>
</table>
</template>
<!-- Blockly Interface Template -->
<template id="template_BlocklyWorkspace">
<table id="table_BlocklyWorkspace" > <!-- border="1" -->
<tr>
<td id="blocklyArea">
<div id="blocklyDiv"></div>
<!-- Blockly Structure of the toolbox -->
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" >
<category name="Logic" colour="%{BKY_LOGIC_HUE}">
<category name="If">
<block type="controls_if"></block>
<block type="controls_if">
<mutation else="1"></mutation>
</block>
<block type="controls_if">
<mutation elseif="1" else="1"></mutation>
</block>
</category>
<category name="Boolean" colour="%{BKY_LOGIC_HUE}">
<block type="logic_compare"></block>
<block type="logic_operation"></block>
<block type="logic_negate"></block>
<block type="logic_boolean"></block>
<block type="logic_null"></block>
<block type="logic_ternary"></block>
</category>
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Loops" colour="%{BKY_LOOPS_HUE}">
<block type="controls_repeat_ext">
<value name="TIMES">
<block type="math_number">
<field name="NUM">10</field>
</block>
</value>
</block>
<block type="controls_whileUntil"></block>
<block type="controls_for">
<field name="VAR">i</field>
<value name="FROM">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
<value name="TO">
<block type="math_number">
<field name="NUM">10</field>
</block>
</value>
<value name="BY">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
</block>
<block type="controls_forEach"></block>
<block type="controls_flow_statements"></block>
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Math" colour="%{BKY_MATH_HUE}">
<block type="math_number">
<field name="NUM">123</field>
</block>
<block type="math_arithmetic"></block>
<block type="math_single"></block>
<block type="math_trig"></block>
<block type="math_constant"></block>
<block type="math_number_property"></block>
<block type="math_round"></block>
<block type="math_on_list"></block>
<block type="math_modulo"></block>
<block type="math_constrain">
<value name="LOW">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
<value name="HIGH">
<block type="math_number">
<field name="NUM">100</field>
</block>
</value>
</block>
<block type="math_random_int">
<value name="FROM">
<block type="math_number">
<field name="NUM">1</field>
</block>
</value>
<value name="TO">
<block type="math_number">
<field name="NUM">100</field>
</block>
</value>
</block>
<block type="math_random_float"></block>
<block type="math_atan2"></block>
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Lists" colour="%{BKY_LISTS_HUE}">
<block type="lists_create_empty"></block>
<block type="lists_create_with"></block>
<block type="lists_repeat">
<value name="NUM">
<block type="math_number">
<field name="NUM">5</field>
</block>
</value>
</block>
<block type="lists_length"></block>
<block type="lists_isEmpty"></block>
<block type="lists_indexOf"></block>
<block type="lists_getIndex"></block>
<block type="lists_setIndex"></block>
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Text" colour="%{BKY_TEXTS_HUE}">
<block type="text"></block>
<block type="text_length"></block>
<block type="text_print"></block>
<!-- <block type="print_div"></block> -->
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sep></sep>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Variables" custom="VARIABLE" colour="%{BKY_VARIABLES_HUE}">
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Functions" custom="PROCEDURE" colour="%{BKY_PROCEDURES_HUE}">
</category>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<sep></sep>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<category name="Robot" colour="0">
<category name="JointSpaceJog">
<block type="robot_jog_joint_not_relative">
<value name="DEGREE">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
</block>
<block type="robot_jog_joint_relative">
<value name="DEGREE">
<block type="math_number">
<field name="NUM">5</field>
</block>
</value>
</block>
<block type="robot_jog_joints_not_relative">
<value name="DEGREE_1">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
<value name="DEGREE_2">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>
<value name="DEGREE_3">
<block type="math_number">
<field name="NUM">0</field>
</block>
</value>