Skip to content

Commit 7e0092e

Browse files
committed
[feat]1.add "get_tool_digital_input" interface;2.repair blockly "get_position" modules
1 parent d570a86 commit 7e0092e

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

doc/api/xarm_api.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
xArm-Python-SDK API Documentation (V1.14.7): class XArmAPI in module xarm.wrapper.xarm_api
1+
xArm-Python-SDK API Documentation (V1.14.11): class XArmAPI in module xarm.wrapper.xarm_api
22

33
## class __XArmAPI__
44
****************************************
@@ -1576,7 +1576,16 @@ xArm-Python-SDK API Documentation (V1.14.7): class XArmAPI in module xarm.wrappe
15761576

15771577
> Get the digital value of the specified Tool GPIO
15781578
>
1579-
> :param ionum: 0 or 1 or None(both 0 and 1), default is None
1579+
> :param ionum: 0 or 1 or or 2 or 3 or 4 (both 0 and 4), default is None
1580+
> :return: tuple((code, value or value list)), only when code is 0, the returned result is correct.
1581+
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
1582+
1583+
1584+
#### def __get_tool_digital_input__(self, ionum=None):
1585+
1586+
> Get the digital value of the specified Tool GPIO, Compared with the "get_tgpio_digital" interface, the value of TI2 is obtained when the ionum is not transmitted.
1587+
>
1588+
> :param ionum: 0 or 1 or or 2 or 3 or 4 (both 0 and 4), default is None
15801589
> :return: tuple((code, value or value list)), only when code is 0, the returned result is correct.
15811590
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
15821591

xarm/tools/blockly/_blockly_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ def _get_condition_expression(self, value_block, arg_map=None):
230230
is_axis = True if fields[0].text == 'axis' else False
231231
direction = int(fields[1].text)
232232
if is_axis:
233-
return 'round(self._arm.position_aa[{}], 2)'.format(direction-1)
233+
return 'round(self._arm.get_position_aa()[1][{}], 2)'.format(direction-1)
234234
else:
235-
return 'round(self._arm.position[{}], 2)'.format(direction-1)
235+
return 'round(self._arm.get_position()[1][{}], 2)'.format(direction-1)
236236
elif block.attrib['type'] == 'get_joint_angle':
237237
angle_li = ['J1', 'J2', 'J3', 'J4', 'J5', 'J6']
238238
fields = self._get_nodes('field', root=block)

xarm/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.14.10'
1+
__version__ = '1.14.11'

xarm/wrapper/xarm_api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,17 @@ def get_tgpio_digital(self, ionum=None):
18881888
code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
18891889
"""
18901890
return self._arm.get_tgpio_digital(ionum)
1891+
1892+
def get_tool_digital_input(self, ionum=None):
1893+
"""
1894+
Get the digital value of the specified Tool GPIO,Compared with the "get_tgpio_digital" interface,
1895+
the value of TI2 is obtained when the ionum is not transmitted.
1896+
1897+
:param ionum: 0 or 1 or or 2 or 3 or 4 (both 0 and 4), default is None
1898+
:return: tuple((code, value or value list)), only when code is 0, the returned result is correct.
1899+
code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
1900+
"""
1901+
return self._arm.get_tool_digital_input(ionum)
18911902

18921903
def set_tgpio_digital(self, ionum, value, delay_sec=None, sync=True):
18931904
"""

0 commit comments

Comments
 (0)