@@ -1342,72 +1342,73 @@ export default {
1342
1342
return [code, Blockly .Python .ORDER_ATOMIC ];
1343
1343
};
1344
1344
1345
- Blockly .Blocks [' coderbot_adv_findLogo' ] = {
1346
- /**
1347
- * Block for findLogo function.
1348
- * @this Blockly.Block
1349
- */
1350
- init : function () {
1351
- this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1352
- this .setColour (250 );
1353
- this .appendDummyInput ()
1354
- .appendField (Blockly .Msg .CODERBOT_SENSOR_FINDLOGO );
1355
- this .setOutput (true , ' Number' );
1356
- this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1357
- }
1358
- };
1359
-
1360
- Blockly .Python [' coderbot_adv_findLogo' ] = function (block ) {
1361
- // Boolean values true and false.
1362
- var code = ' get_cam().find_logo()' ;
1363
- return [code, Blockly .Python .ORDER_ATOMIC ];
1364
- };
1365
-
1366
- Blockly .Blocks [' coderbot_adv_find_class' ] = {
1367
- /**
1368
- * Block for find_class function.
1369
- * @this Blockly.Block
1370
- */
1371
- init : function () {
1372
- this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1373
- this .setColour (250 );
1374
- this .appendDummyInput ()
1375
- .appendField (Blockly .Msg .CODERBOT_SENSOR_FINDCLASS );
1376
- this .setOutput (true , ' String' );
1377
- this .setInputsInline (true );
1378
- this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1379
- }
1380
- };
1381
-
1382
- Blockly .Python [' coderbot_adv_find_class' ] = function (block ) {
1383
- // Boolean values true and false.
1384
- var name = ' get_cam().find_class()' ;
1385
- return [name, Blockly .Python .ORDER_ATOMIC ];
1386
- };
1387
-
1388
- Blockly .Blocks [' coderbot_adv_cnn_classify' ] = {
1389
- /**
1390
- * Block for find_class function.
1391
- * @this Blockly.Block
1392
- */
1393
- init : function () {
1394
- this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1395
- this .setColour (250 );
1396
- this .appendDummyInput ()
1397
- .appendField (Blockly .Msg .CODERBOT_SENSOR_FINDCLASS )
1398
- .appendField (new Blockly.FieldDropdown (CODERBOT_CNN_MODEL_LIST ), ' MODEL' );
1399
- this .setInputsInline (true );
1400
- this .setOutput (true , [' Array' ]);
1401
- this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1402
- }
1403
- };
1404
-
1405
- Blockly .Python [' coderbot_adv_cnn_classify' ] = function (block ) {
1406
- var model = block .getFieldValue (' MODEL' );
1407
- var class_scores = ' get_cam().cnn_classify("' + model + ' ")' ;
1408
- return [class_scores, Blockly .Python .ORDER_ATOMIC ];
1409
- };
1410
-
1345
+ Blockly .Blocks [' coderbot_adv_find_class' ] = {
1346
+ /**
1347
+ * Block for find_class function.
1348
+ * @this Blockly.Block
1349
+ */
1350
+ init : function () {
1351
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1352
+ this .setColour (250 );
1353
+ this .appendDummyInput ()
1354
+ .appendField (Blockly .Msg .CODERBOT_SENSOR_FINDCLASS );
1355
+ this .setOutput (true , ' String' );
1356
+ this .setInputsInline (true );
1357
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1358
+ }
1359
+ };
1360
+
1361
+ Blockly .Python [' coderbot_adv_find_class' ] = function (block ) {
1362
+ // Boolean values true and false.
1363
+ var name = ' get_cam().find_class()' ;
1364
+ return [name, Blockly .Python .ORDER_ATOMIC ];
1365
+ };
1366
+
1367
+ Blockly .Blocks [' coderbot_adv_cnn_classify' ] = {
1368
+ /**
1369
+ * Block for find_class function.
1370
+ * @this Blockly.Block
1371
+ */
1372
+ init : function () {
1373
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1374
+ this .setColour (250 );
1375
+ this .appendDummyInput ()
1376
+ .appendField (Blockly .Msg .CODERBOT_SENSOR_FINDCLASS )
1377
+ .appendField (new Blockly.FieldDropdown (CODERBOT_CNN_MODEL_LIST ), ' MODEL' );
1378
+ this .setInputsInline (true );
1379
+ this .setOutput (true , [' Array' ]);
1380
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1381
+ }
1382
+ };
1383
+
1384
+ Blockly .Python [' coderbot_adv_cnn_classify' ] = function (block ) {
1385
+ var model = block .getFieldValue (' MODEL' );
1386
+ var class_scores = ' get_cam().cnn_classify("' + model + ' ")' ;
1387
+ return [class_scores, Blockly .Python .ORDER_ATOMIC ];
1388
+ };
1389
+
1390
+ Blockly .Blocks [' coderbot_adv_cnn_detect_objects' ] = {
1391
+ /**
1392
+ * Block for find_class function.
1393
+ * @this Blockly.Block
1394
+ */
1395
+ init : function () {
1396
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1397
+ this .setColour (250 );
1398
+ this .appendDummyInput ()
1399
+ .appendField (Blockly .Msg .CODERBOT_SENSOR_FINDOBJECTS )
1400
+ .appendField (new Blockly.FieldDropdown (CODERBOT_CNN_MODEL_LIST ), ' MODEL' );
1401
+ this .setInputsInline (true );
1402
+ this .setOutput (true , [' Array' ]);
1403
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1404
+ }
1405
+ };
1406
+
1407
+ Blockly .Python [' coderbot_adv_cnn_detect_objects' ] = function (block ) {
1408
+ var model = block .getFieldValue (' MODEL' );
1409
+ var class_scores = ' get_cam().cnn_detect_objects("' + model + ' ")' ;
1410
+ return [class_scores, Blockly .Python .ORDER_ATOMIC ];
1411
+ };
1411
1412
Blockly .Blocks [' coderbot_event_generator' ] = {
1412
1413
init : function () {
1413
1414
this .appendDummyInput ()
@@ -1698,6 +1699,98 @@ export default {
1698
1699
var code = sbsPrefix + ' get_bot().get_sonar_distance(' + sonar + ' )' ;
1699
1700
return [code, Blockly .Python .ORDER_ATOMIC ];
1700
1701
};
1702
+
1703
+ Blockly .Blocks [' coderbot_mpu_get_accel' ] = {
1704
+ /**
1705
+ * Block for get_distance function.
1706
+ * @this Blockly.Block
1707
+ */
1708
+ init : function () {
1709
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1710
+ this .setColour (240 );
1711
+ this .appendDummyInput ()
1712
+ .appendField (Blockly .Msg .CODERBOT_MPU_GET_ACCEL )
1713
+ .appendField (new Blockly.FieldDropdown ([[Blockly .Msg .CODERBOT_MPU_AXIS_X , " 0" ],
1714
+ [Blockly .Msg .CODERBOT_MPU_AXIS_Y , " 1" ],
1715
+ [Blockly .Msg .CODERBOT_MPU_AXIS_Z , " 2" ]]), ' AXIS' );
1716
+ this .setOutput (true , ' Number' );
1717
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1718
+ }
1719
+ };
1720
+
1721
+ Blockly .Python [' coderbot_mpu_get_accel' ] = function (block ) {
1722
+ // Boolean values true and false.
1723
+ var axis = block .getFieldValue (' AXIS' );
1724
+ var code = ' get_bot().get_mpu_accel(' + axis + ' )' ;
1725
+ return [code, Blockly .Python .ORDER_ATOMIC ];
1726
+ };
1727
+
1728
+ Blockly .Blocks [' coderbot_mpu_get_gyro' ] = {
1729
+ /**
1730
+ * Block for get_distance function.
1731
+ * @this Blockly.Block
1732
+ */
1733
+ init : function () {
1734
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1735
+ this .setColour (240 );
1736
+ this .appendDummyInput ()
1737
+ .appendField (Blockly .Msg .CODERBOT_MPU_GET_GYRO )
1738
+ .appendField (new Blockly.FieldDropdown ([[Blockly .Msg .CODERBOT_MPU_AXIS_X , " 0" ],
1739
+ [Blockly .Msg .CODERBOT_MPU_AXIS_Y , " 1" ],
1740
+ [Blockly .Msg .CODERBOT_MPU_AXIS_Z , " 2" ]]), ' AXIS' );
1741
+ this .setOutput (true , ' Number' );
1742
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1743
+ }
1744
+ };
1745
+
1746
+ Blockly .Python [' coderbot_mpu_get_gyro' ] = function (block ) {
1747
+ // Boolean values true and false.
1748
+ var axis = block .getFieldValue (' AXIS' );
1749
+ var code = ' get_bot().get_mpu_gyro(' + axis + ' )' ;
1750
+ return [code, Blockly .Python .ORDER_ATOMIC ];
1751
+ };
1752
+
1753
+ Blockly .Blocks [' coderbot_mpu_get_heading' ] = {
1754
+ /**
1755
+ * Block for get_distance function.
1756
+ * @this Blockly.Block
1757
+ */
1758
+ init : function () {
1759
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1760
+ this .setColour (240 );
1761
+ this .appendDummyInput ()
1762
+ .appendField (Blockly .Msg .CODERBOT_MPU_GET_HEADING );
1763
+ this .setOutput (true , ' Number' );
1764
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1765
+ }
1766
+ };
1767
+
1768
+ Blockly .Python [' coderbot_mpu_get_heading' ] = function (block ) {
1769
+ // Boolean values true and false.
1770
+ var code = ' get_bot().get_mpu_heading()' ;
1771
+ return [code, Blockly .Python .ORDER_ATOMIC ];
1772
+ };
1773
+
1774
+ Blockly .Blocks [' coderbot_mpu_get_temp' ] = {
1775
+ /**
1776
+ * Block for get_distance function.
1777
+ * @this Blockly.Block
1778
+ */
1779
+ init : function () {
1780
+ this .setHelpUrl (Blockly .Msg .LOGIC_BOOLEAN_HELPURL );
1781
+ this .setColour (240 );
1782
+ this .appendDummyInput ()
1783
+ .appendField (Blockly .Msg .CODERBOT_MPU_GET_TEMP );
1784
+ this .setOutput (true , ' Number' );
1785
+ this .setTooltip (Blockly .Msg .LOGIC_BOOLEAN_TOOLTIP );
1786
+ }
1787
+ };
1788
+
1789
+ Blockly .Python [' coderbot_mpu_get_temp' ] = function (block ) {
1790
+ // Boolean values true and false.
1791
+ var code = ' get_bot().get_mpu_temp()' ;
1792
+ return [code, Blockly .Python .ORDER_ATOMIC ];
1793
+ };
1701
1794
},
1702
1795
1703
1796
toggleSidebar () {
0 commit comments