Skip to content

Commit 490c725

Browse files
committed
[fix] fix ft_sensor_get_error
1 parent 5a86d4a commit 490c725

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

doc/api/xarm_api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
xArm-Python-SDK API Documentation (V1.14.6): class XArmAPI in module xarm.wrapper.xarm_api
1+
xArm-Python-SDK API Documentation (V1.14.7): class XArmAPI in module xarm.wrapper.xarm_api
22

33
## class __XArmAPI__
44
****************************************
@@ -1673,9 +1673,9 @@ xArm-Python-SDK API Documentation (V1.14.6): class XArmAPI in module xarm.wrappe
16731673
>     2: Contact Connection
16741674
> :return: tuple((code, state)), only when code is 0, the returned result is correct.
16751675
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
1676-
>     state: suction cup state
1677-
>         0: suction cup is off
1678-
>         1: suction cup is on
1676+
>     state: vacuum gripper state
1677+
>         0: vacuum gripper is off
1678+
>         1: vacuum gripper is on
16791679
16801680

16811681
#### def __get_version__(self):

doc/tool/gen_api.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
import pydoc
1313
import re
1414

15-
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
15+
curr_file_dir = os.path.dirname(__file__)
16+
sys.path.insert(0, os.path.join(curr_file_dir, '../..'))
1617

1718
from xarm.wrapper import XArmAPI
1819
from xarm.version import __version__
1920

2021
from doc.tool.markdown_doc import MarkdownDoc
2122

22-
open('../api/xarm_api.md', 'w', encoding='utf-8').write(
23+
doc_filepath = os.path.join(curr_file_dir, '../api/xarm_api.md')
24+
open(doc_filepath, 'w', encoding='utf-8').write(
2325
pydoc.render_doc(XArmAPI,
2426
title='xArm-Python-SDK API Documentation (V{}): %s'.format(__version__),
2527
renderer=MarkdownDoc()))

xarm/core/wrapper/uxbus_cmd.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -1247,21 +1247,27 @@ def ft_sensor_get_config(self):
12471247
]
12481248
return ret
12491249

1250-
@lock_require
12511250
def ft_sensor_get_error(self):
1252-
txdata = bytes([8])
1253-
txdata += convert.u16_to_bytes(0x0010)
1254-
ret = self.send_modbus_request(XCONF.UxbusReg.SERVO_R16B, txdata, 3)
1255-
if ret == -1:
1256-
return [XCONF.UxbusState.ERR_NOTTCP] * (7 + 1)
1251+
ret = self.servo_addr_r16(8, 0x0010)
1252+
if ret[0] in [0, 1, 2] and len(ret) > 1 and ret[1] == 27:
1253+
ret[0] = 0
1254+
return ret
12571255

1258-
ret = self.recv_modbus_response(XCONF.UxbusReg.SERVO_R16B, ret, 4, XCONF.UxbusConf.GET_TIMEOUT)
1259-
if ret[0] in [0, 1, 2]:
1260-
if convert.bytes_to_long_big(ret[1:5]) == 27:
1261-
return [ret[0], 0]
1262-
else:
1263-
return [ret[0], ret[3]]
1264-
return [ret[0], 0]
1256+
# @lock_require
1257+
# def ft_sensor_get_error(self):
1258+
# txdata = bytes([8])
1259+
# txdata += convert.u16_to_bytes(0x0010)
1260+
# ret = self.send_modbus_request(XCONF.UxbusReg.SERVO_R16B, txdata, 3)
1261+
# if ret == -1:
1262+
# return [XCONF.UxbusState.ERR_NOTTCP] * (7 + 1)
1263+
1264+
# ret = self.recv_modbus_response(XCONF.UxbusReg.SERVO_R16B, ret, 4, self._G_TOUT)
1265+
# if ret[0] in [0, 1, 2]:
1266+
# if convert.bytes_to_long_big(ret[1:5]) == 27:
1267+
# return [ret[0], 0]
1268+
# else:
1269+
# return [ret[0], ret[3]]
1270+
# return [ret[0], 0]
12651271

12661272
def cali_tcp_pose(self, four_pnts):
12671273
txdata = []

xarm/wrapper/xarm_api.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1922,9 +1922,9 @@ def get_vacuum_gripper(self, hardware_version=1):
19221922
2: Contact Connection
19231923
:return: tuple((code, state)), only when code is 0, the returned result is correct.
19241924
code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
1925-
state: suction cup state
1926-
0: suction cup is off
1927-
1: suction cup is on
1925+
state: vacuum gripper state
1926+
0: vacuum gripper is off
1927+
1: vacuum gripper is on
19281928
"""
19291929
return self._arm.get_suction_cup(hardware_version=hardware_version)
19301930

0 commit comments

Comments
 (0)