Skip to content

Commit 13d5c4b

Browse files
committed
run lint and prettier
1 parent 71ada5a commit 13d5c4b

File tree

1 file changed

+104
-64
lines changed

1 file changed

+104
-64
lines changed

src/niryo_one_python_generators.js

Lines changed: 104 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,11 +1645,12 @@ Blockly.Blocks['niryo_one_vision_is_object_detected'] = {
16451645

16461646
Blockly.Blocks['niryo_one_get_img_compressed'] = {
16471647
init: function () {
1648-
this.appendDummyInput()
1649-
.appendField('Get image compressed')
1648+
this.appendDummyInput().appendField('Get image compressed');
16501649
this.setOutput(true, 'String');
16511650
this.setColour(vision_color);
1652-
this.setTooltip('Get image from video stream in a compressed format. Returns string containing a JPEG compressed image.');
1651+
this.setTooltip(
1652+
'Get image from video stream in a compressed format. Returns string containing a JPEG compressed image.'
1653+
);
16531654
this.setHelpUrl('');
16541655
}
16551656
};
@@ -1662,7 +1663,9 @@ Blockly.Blocks['niryo_one_set_brightness'] = {
16621663
this.setPreviousStatement(true, null);
16631664
this.setNextStatement(true, null);
16641665
this.setColour(vision_color);
1665-
this.setTooltip('Modify video stream brightness.How much to adjust the brightness. 0.5 will give a darkened image, 1 will give the original image while 2 will enhance the brightness by a factor of 2.');
1666+
this.setTooltip(
1667+
'Modify video stream brightness.How much to adjust the brightness. 0.5 will give a darkened image, 1 will give the original image while 2 will enhance the brightness by a factor of 2.'
1668+
);
16661669
this.setHelpUrl('');
16671670
}
16681671
};
@@ -1675,7 +1678,9 @@ Blockly.Blocks['niryo_one_set_contrast'] = {
16751678
this.setPreviousStatement(true, null);
16761679
this.setNextStatement(true, null);
16771680
this.setColour(vision_color);
1678-
this.setTooltip('Modify video stream contrast. While a factor of 1 gives original image. Making the factor towards 0 makes the image greyer, while factor>1 increases the contrast of the image.');
1681+
this.setTooltip(
1682+
'Modify video stream contrast. While a factor of 1 gives original image. Making the factor towards 0 makes the image greyer, while factor>1 increases the contrast of the image.'
1683+
);
16791684
this.setHelpUrl('');
16801685
}
16811686
};
@@ -1688,18 +1693,21 @@ Blockly.Blocks['niryo_one_set_saturation'] = {
16881693
this.setPreviousStatement(true, null);
16891694
this.setNextStatement(true, null);
16901695
this.setColour(vision_color);
1691-
this.setTooltip('Modify video stream saturation. How much to adjust the saturation. 0 will give a black and white image, 1 will give the original image while 2 will enhance the saturation by a factor of 2.');
1696+
this.setTooltip(
1697+
'Modify video stream saturation. How much to adjust the saturation. 0 will give a black and white image, 1 will give the original image while 2 will enhance the saturation by a factor of 2.'
1698+
);
16921699
this.setHelpUrl('');
16931700
}
16941701
};
16951702

16961703
Blockly.Blocks['niryo_one_get_image_parameters'] = {
16971704
init: function () {
1698-
this.appendDummyInput()
1699-
.appendField('Get image parameters');
1705+
this.appendDummyInput().appendField('Get image parameters');
17001706
this.setOutput(true, 'String');
17011707
this.setColour(vision_color);
1702-
this.setTooltip('Get last stream image parameters: Brightness factor, Contrast factor, Saturation factor.');
1708+
this.setTooltip(
1709+
'Get last stream image parameters: Brightness factor, Contrast factor, Saturation factor.'
1710+
);
17031711
this.setHelpUrl('');
17041712
}
17051713
};
@@ -1709,29 +1717,22 @@ Blockly.Blocks['niryo_one_get_target_pose_from_rel'] = {
17091717
this.appendDummyInput().appendField('Get robot pose relative to pose');
17101718
this.appendDummyInput()
17111719
.appendField('x')
1712-
.appendField(
1713-
new Blockly.FieldNumber(0, 0, 1, 0.001),
1714-
'POSE_X'
1715-
)
1720+
.appendField(new Blockly.FieldNumber(0, 0, 1, 0.001), 'POSE_X')
17161721
.appendField('y')
1717-
.appendField(
1718-
new Blockly.FieldNumber(0, 0, 1, 0.001),
1719-
'POSE_Y'
1720-
)
1722+
.appendField(new Blockly.FieldNumber(0, 0, 1, 0.001), 'POSE_Y')
17211723
.appendField('z')
1722-
.appendField(
1723-
new Blockly.FieldNumber(0, 0, 1, 0.001),
1724-
'POSE_Z'
1725-
)
1724+
.appendField(new Blockly.FieldNumber(0, 0, 1, 0.001), 'POSE_Z');
17261725
this.appendValueInput('HEIGHT_OFFSET')
17271726
.setCheck('Number')
17281727
.appendField('with heigh offset');
1729-
this.appendValueInput('WORKSPACE_NAME')
1728+
this.appendValueInput('WORKSPACE_NAME')
17301729
.setCheck('String')
17311730
.appendField('in workspace');
17321731
this.setOutput(true, 'niryo_one_pose');
17331732
this.setColour(vision_color);
1734-
this.setTooltip('Given a pose (x_rel, y_rel, yaw_rel) relative to a workspace, this function returns the robot pose in which the current tool will be able to pick an object at this pose. The height_offset argument (in m) defines how high the tool will hover over the workspace. If height_offset = 0, the tool will nearly touch the workspace.');
1733+
this.setTooltip(
1734+
'Given a pose (x_rel, y_rel, yaw_rel) relative to a workspace, this function returns the robot pose in which the current tool will be able to pick an object at this pose. The height_offset argument (in m) defines how high the tool will hover over the workspace. If height_offset = 0, the tool will nearly touch the workspace.'
1735+
);
17351736
this.setHelpUrl('');
17361737
}
17371738
};
@@ -1747,13 +1748,15 @@ Blockly.Blocks['niryo_one_get_target_pose_from_cam'] = {
17471748
.appendField('with height offset');
17481749
this.appendValueInput('SHAPE')
17491750
.setCheck('niryo_one_vision_shape')
1750-
.appendField('for object of shape')
1751+
.appendField('for object of shape');
17511752
this.appendValueInput('COLOR')
17521753
.setCheck('niryo_one_vision_color')
17531754
.appendField('and color');
17541755
this.setOutput(true, 'niryo_one_pose');
17551756
this.setColour(vision_color);
1756-
this.setTooltip('First detects the specified object using the camera and then returns the robot pose in which the object can be picked with the current tool');
1757+
this.setTooltip(
1758+
'First detects the specified object using the camera and then returns the robot pose in which the object can be picked with the current tool'
1759+
);
17571760
this.setHelpUrl('');
17581761
}
17591762
};
@@ -1769,13 +1772,15 @@ Blockly.Blocks['niryo_one_move_to_object'] = {
17691772
.appendField('with height offset');
17701773
this.appendValueInput('SHAPE')
17711774
.setCheck('niryo_one_vision_shape')
1772-
.appendField('for object of shape')
1775+
.appendField('for object of shape');
17731776
this.appendValueInput('COLOR')
17741777
.setCheck('niryo_one_vision_color')
17751778
.appendField('and color');
17761779
this.setOutput(true, 'niryo_one_pose');
17771780
this.setColour(vision_color);
1778-
this.setTooltip('Same as get_target_pose_from_cam but directly moves to this position');
1781+
this.setTooltip(
1782+
'Same as get_target_pose_from_cam but directly moves to this position'
1783+
);
17791784
this.setHelpUrl('');
17801785
}
17811786
};
@@ -1785,7 +1790,9 @@ Blockly.Blocks['niryo_one_get_camera_intrinsics'] = {
17851790
this.appendDummyInput().appendField('Get camera intrinsics');
17861791
this.setOutput(true, 'String');
17871792
this.setColour(vision_color);
1788-
this.setTooltip('Get calibration object: camera intrinsics, distortions coefficients');
1793+
this.setTooltip(
1794+
'Get calibration object: camera intrinsics, distortions coefficients'
1795+
);
17891796
this.setHelpUrl('');
17901797
}
17911798
};
@@ -1795,8 +1802,8 @@ Blockly.Blocks['niryo_one_save_workspace_from_robot_poses'] = {
17951802
this.appendValueInput('WORKSPACE_NAME')
17961803
.setCheck('String')
17971804
.appendField('Save workspace under name');
1798-
this.appendDummyInput().appendField('from the 4 corners defined by')
1799-
this.appendDummyInput().appendField('\n')
1805+
this.appendDummyInput().appendField('from the 4 corners defined by');
1806+
this.appendDummyInput().appendField('\n');
18001807
this.appendValueInput('POSE_1')
18011808
.setCheck('niryo_one_pose')
18021809
.appendField('pose 1');
@@ -1812,7 +1819,9 @@ Blockly.Blocks['niryo_one_save_workspace_from_robot_poses'] = {
18121819
this.setPreviousStatement(true, null);
18131820
this.setNextStatement(true, null);
18141821
this.setColour(vision_color);
1815-
this.setTooltip('Save workspace by giving the poses of the robot to point its 4 corners with the calibration Tip. Corners should be in the good order. Markers’ pose will be deduced from these poses');
1822+
this.setTooltip(
1823+
'Save workspace by giving the poses of the robot to point its 4 corners with the calibration Tip. Corners should be in the good order. Markers’ pose will be deduced from these poses'
1824+
);
18161825
this.setHelpUrl('');
18171826
}
18181827
};
@@ -1822,8 +1831,8 @@ Blockly.Blocks['niryo_one_save_workspace_from_points'] = {
18221831
this.appendValueInput('WORKSPACE_NAME')
18231832
.setCheck('String')
18241833
.appendField('Save workspace under name');
1825-
this.appendDummyInput().appendField('from the 4 corners defined by')
1826-
this.appendDummyInput().appendField('\n')
1834+
this.appendDummyInput().appendField('from the 4 corners defined by');
1835+
this.appendDummyInput().appendField('\n');
18271836
this.appendValueInput('POINT_1')
18281837
.setCheck('niryo_one_point')
18291838
.appendField('point 1');
@@ -1839,7 +1848,9 @@ Blockly.Blocks['niryo_one_save_workspace_from_points'] = {
18391848
this.setPreviousStatement(true, null);
18401849
this.setNextStatement(true, null);
18411850
this.setColour(vision_color);
1842-
this.setTooltip('Save workspace by giving the points of worskpace’s 4 corners. Points are written as [x, y, z] Corners should be in the good order.');
1851+
this.setTooltip(
1852+
'Save workspace by giving the points of worskpace’s 4 corners. Points are written as [x, y, z] Corners should be in the good order.'
1853+
);
18431854
this.setHelpUrl('');
18441855
}
18451856
};
@@ -3551,16 +3562,19 @@ BlocklyPy['niryo_one_get_target_pose_from_rel'] = function (block) {
35513562
var height_offset_value =
35523563
BlocklyPy.valueToCode(block, 'HEIGHT_OFFSET', BlocklyPy.ORDER_ATOMIC) ||
35533564
'(0)';
3554-
height_offset_value = height_offset_value.replace('(', '').replace(')', '');
3565+
height_offset_value = height_offset_value.replace('(', '').replace(')', '');
35553566

35563567
var workspace_name =
35573568
BlocklyPy.valueToCode(block, 'WORKSPACE_NAME', BlocklyPy.ORDER_ATOMIC) ||
35583569
'(0)';
35593570
workspace_name = workspace_name.replace('(', '').replace(')', '');
35603571

35613572
var code =
3562-
'n.get_target_pose_from_rel(' + workspace_name + ', ' +
3563-
height_offset_value + ', ' +
3573+
'n.get_target_pose_from_rel(' +
3574+
workspace_name +
3575+
', ' +
3576+
height_offset_value +
3577+
', ' +
35643578
value_x +
35653579
', ' +
35663580
value_y +
@@ -3579,23 +3593,29 @@ BlocklyPy['niryo_one_get_target_pose_from_cam'] = function (block) {
35793593
var height_offset_value =
35803594
BlocklyPy.valueToCode(block, 'HEIGHT_OFFSET', BlocklyPy.ORDER_ATOMIC) ||
35813595
'(0)';
3582-
height_offset_value = height_offset_value.replace('(', '').replace(')', '');
3596+
height_offset_value = height_offset_value.replace('(', '').replace(')', '');
35833597

35843598
// Color (int) value (see g_shape_values at top of this file)
35853599
var value_color =
3586-
BlocklyPy.valueToCode(block, 'COLOR', BlocklyPy.ORDER_ATOMIC) ||
3587-
'(0)';
3600+
BlocklyPy.valueToCode(block, 'COLOR', BlocklyPy.ORDER_ATOMIC) || '(0)';
35883601
value_color = value_color.replace('(', '').replace(')', '');
35893602

35903603
// Shape (int) value (see g_shape_values at top of this file)
35913604
var value_shape =
3592-
BlocklyPy.valueToCode(block, 'SHAPE', BlocklyPy.ORDER_ATOMIC) ||
3593-
'(0)';
3605+
BlocklyPy.valueToCode(block, 'SHAPE', BlocklyPy.ORDER_ATOMIC) || '(0)';
35943606
value_shape = value_shape.replace('(', '').replace(')', '');
35953607

3596-
var code = 'n.get_target_pose_from_cam(' + workspace_name + ', ' + height_offset_value + ', ' + value_color + ', ' + value_shape + ')\n';
3608+
var code =
3609+
'n.get_target_pose_from_cam(' +
3610+
workspace_name +
3611+
', ' +
3612+
height_offset_value +
3613+
', ' +
3614+
value_color +
3615+
', ' +
3616+
value_shape +
3617+
')\n';
35973618
return [code, BlocklyPy.ORDER_NONE];
3598-
35993619
};
36003620

36013621
BlocklyPy['niryo_one_move_to_object'] = function (block) {
@@ -3607,31 +3627,37 @@ BlocklyPy['niryo_one_move_to_object'] = function (block) {
36073627
var height_offset_value =
36083628
BlocklyPy.valueToCode(block, 'HEIGHT_OFFSET', BlocklyPy.ORDER_ATOMIC) ||
36093629
'(0)';
3610-
height_offset_value = height_offset_value.replace('(', '').replace(')', '');
3630+
height_offset_value = height_offset_value.replace('(', '').replace(')', '');
36113631

36123632
// Color (int) value (see g_shape_values at top of this file)
36133633
var value_color =
3614-
BlocklyPy.valueToCode(block, 'COLOR', BlocklyPy.ORDER_ATOMIC) ||
3615-
'(0)';
3634+
BlocklyPy.valueToCode(block, 'COLOR', BlocklyPy.ORDER_ATOMIC) || '(0)';
36163635
value_color = value_color.replace('(', '').replace(')', '');
36173636

36183637
// Shape (int) value (see g_shape_values at top of this file)
36193638
var value_shape =
3620-
BlocklyPy.valueToCode(block, 'SHAPE', BlocklyPy.ORDER_ATOMIC) ||
3621-
'(0)';
3639+
BlocklyPy.valueToCode(block, 'SHAPE', BlocklyPy.ORDER_ATOMIC) || '(0)';
36223640
value_shape = value_shape.replace('(', '').replace(')', '');
36233641

3624-
var code = 'n.move_to_object(' + workspace_name + ', ' + height_offset_value + ', ' + value_color + ', ' + value_shape + ')\n';
3642+
var code =
3643+
'n.move_to_object(' +
3644+
workspace_name +
3645+
', ' +
3646+
height_offset_value +
3647+
', ' +
3648+
value_color +
3649+
', ' +
3650+
value_shape +
3651+
')\n';
36253652
return [code, BlocklyPy.ORDER_NONE];
3626-
36273653
};
36283654

36293655
BlocklyPy['niryo_one_get_camera_intrinsics'] = function (block) {
36303656
var code = 'n.get_camera_intrinsics()\n';
36313657
return code;
36323658
};
36333659

3634-
BlocklyPy['niryo_one_save_workspace_from_robot_poses'] = function (block) {
3660+
BlocklyPy['niryo_one_save_workspace_from_robot_poses'] = function (block) {
36353661
var workspace_name =
36363662
BlocklyPy.valueToCode(block, 'WORKSPACE_NAME', BlocklyPy.ORDER_ATOMIC) ||
36373663
'(0)';
@@ -3665,15 +3691,22 @@ BlocklyPy['niryo_one_save_workspace_from_robot_poses'] = function (block) {
36653691
);
36663692
value_pose_4 = value_pose_4.replace('(', '').replace(')', '');
36673693

3668-
var code = 'n.save_workspace_from_robot_poses(' + workspace_name + ', ' +
3669-
value_pose_1 + ', ' +
3670-
value_pose_2 + ', ' +
3671-
value_pose_3 + ', ' +
3672-
value_pose_4 + ')\n';
3694+
var code =
3695+
'n.save_workspace_from_robot_poses(' +
3696+
workspace_name +
3697+
', ' +
3698+
value_pose_1 +
3699+
', ' +
3700+
value_pose_2 +
3701+
', ' +
3702+
value_pose_3 +
3703+
', ' +
3704+
value_pose_4 +
3705+
')\n';
36733706
return code;
36743707
};
36753708

3676-
BlocklyPy['niryo_one_save_workspace_from_points'] = function (block) {
3709+
BlocklyPy['niryo_one_save_workspace_from_points'] = function (block) {
36773710
var workspace_name =
36783711
BlocklyPy.valueToCode(block, 'WORKSPACE_NAME', BlocklyPy.ORDER_ATOMIC) ||
36793712
'(0)';
@@ -3707,15 +3740,22 @@ BlocklyPy['niryo_one_save_workspace_from_points'] = function (block) {
37073740
);
37083741
value_point_4 = value_point_4.replace('(', '').replace(')', '');
37093742

3710-
var code = 'n.save_workspace_from_points(' + workspace_name + ', ' +
3711-
value_point_1 + ', ' +
3712-
value_point_2 + ', ' +
3713-
value_point_3 + ', ' +
3714-
value_point_4 + ')\n';
3743+
var code =
3744+
'n.save_workspace_from_points(' +
3745+
workspace_name +
3746+
', ' +
3747+
value_point_1 +
3748+
', ' +
3749+
value_point_2 +
3750+
', ' +
3751+
value_point_3 +
3752+
', ' +
3753+
value_point_4 +
3754+
')\n';
37153755
return code;
37163756
};
37173757

3718-
BlocklyPy['niryo_one_delete_workspace'] = function (block) {
3758+
BlocklyPy['niryo_one_delete_workspace'] = function (block) {
37193759
var workspace_name =
37203760
BlocklyPy.valueToCode(block, 'WORKSPACE_NAME', BlocklyPy.ORDER_ATOMIC) ||
37213761
'(0)';

0 commit comments

Comments
 (0)