Skip to content

Commit b4cef6a

Browse files
committed
[fix] fix the return data format of get_c23_error_info/get_c38_error_info
1 parent 1a7a11f commit b4cef6a

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

doc/api/xarm_api.md

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

33
## class __XArmAPI__
44
****************************************
@@ -905,7 +905,7 @@ xArm-Python-SDK API Documentation (V1.13.21): class XArmAPI in module xarm.wrapp
905905
>
906906
> :return: tuple((code, err_info)), only when code is 0, the returned result is correct.
907907
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
908-
>     err_info: [servo_id, angle]
908+
>     err_info: [(servo_id, angle), ...]
909909
910910

911911
#### def __get_c24_error_info__(self, is_radian=None):
@@ -949,7 +949,7 @@ xArm-Python-SDK API Documentation (V1.13.21): class XArmAPI in module xarm.wrapp
949949
>
950950
> :return: tuple((code, err_info)), only when code is 0, the returned result is correct.
951951
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
952-
>     err_info: [servo_id, angle]
952+
>     err_info: [(servo_id, angle), ...]
953953
954954

955955
#### def __get_c60_error_info__(self):

xarm/core/comm/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def recv_report_proc(self):
197197
buffer = buffer[233:]
198198
continue
199199

200-
if convert.bytes_to_u32(buffer[0:4]) != size:
200+
if convert.bytes_to_u32(buffer[0:4]) != size and not (size_is_not_confirm and size == 245 and convert.bytes_to_u32(buffer[0:4]) == 233):
201201
logger.error('report data error, close, length={}, size={}'.format(convert.bytes_to_u32(buffer[0:4]), size))
202202
break
203203

xarm/core/wrapper/uxbus_cmd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,12 +1400,15 @@ def get_common_info(self, param_type):
14001400
data[1] = ret[1]
14011401
data.append(convert.bytes_to_fp32(ret[2:6]))
14021402
data.append(convert.bytes_to_fp32(ret[6:10]))
1403-
elif param_type in [102, 103, 104, 106]:
1403+
elif param_type in [102, 104]:
14041404
data[1] = ret[1]
14051405
data.append(convert.bytes_to_fp32(ret[2:]))
14061406
elif param_type == 105:
14071407
data[1] = convert.bytes_to_fp32(ret[1:])
14081408
data.append(convert.bytes_to_fp32(ret[5:]))
1409+
elif param_type in [103, 106]:
1410+
data[1] = ret[1]
1411+
data.extend(convert.bytes_to_fp32s(ret[2:], 7))
14091412
else:
14101413
data[0] = XCONF.UxbusState.ERR_PARAM
14111414
return data

xarm/version.py

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

xarm/wrapper/xarm_api.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4083,8 +4083,7 @@ def get_c37_error_info(self, is_radian=None):
40834083
ret = self._arm.get_common_info(102, return_val=False)
40844084
if ret[0] == 0 and len(ret) > 1 and len(ret[1]) > 1:
40854085
is_rad = self._is_radian if is_radian is None else is_radian
4086-
if not is_rad:
4087-
ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
4086+
ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
40884087
return ret
40894088

40904089
def get_c23_error_info(self, is_radian=None):
@@ -4095,13 +4094,18 @@ def get_c23_error_info(self, is_radian=None):
40954094
40964095
:return: tuple((code, err_info)), only when code is 0, the returned result is correct.
40974096
code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
4098-
err_info: [servo_id, angle]
4097+
err_info: [(servo_id, angle), ...]
40994098
"""
41004099
ret = self._arm.get_common_info(103, return_val=False)
41014100
if ret[0] == 0 and len(ret) > 1 and len(ret[1]) > 1:
41024101
is_rad = self._is_radian if is_radian is None else is_radian
4103-
if not is_rad:
4104-
ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
4102+
err_info = []
4103+
bits = ret[1][0]
4104+
for i in range(self.axis):
4105+
if (bits >> i) & 0x01:
4106+
err_info.append((i + 1, ret[1][i+1] if is_rad else math.degrees(ret[1][i+1])))
4107+
return 0, err_info
4108+
# ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
41054109
return ret
41064110

41074111
def get_c24_error_info(self, is_radian=None):
@@ -4117,8 +4121,7 @@ def get_c24_error_info(self, is_radian=None):
41174121
ret = self._arm.get_common_info(104, return_val=False)
41184122
if ret[0] == 0 and len(ret) > 1 and len(ret[1]) > 1:
41194123
is_rad = self._is_radian if is_radian is None else is_radian
4120-
if not is_rad:
4121-
ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
4124+
ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
41224125
return ret
41234126

41244127
def get_c60_error_info(self):
@@ -4142,11 +4145,16 @@ def get_c38_error_info(self, is_radian=None):
41424145
41434146
:return: tuple((code, err_info)), only when code is 0, the returned result is correct.
41444147
code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
4145-
err_info: [servo_id, angle]
4148+
err_info: [(servo_id, angle), ...]
41464149
"""
41474150
ret = self._arm.get_common_info(106, return_val=False)
41484151
if ret[0] == 0 and len(ret) > 1 and len(ret[1]) > 1:
41494152
is_rad = self._is_radian if is_radian is None else is_radian
4150-
if not is_rad:
4151-
ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
4153+
err_info = []
4154+
bits = ret[1][0]
4155+
for i in range(self.axis):
4156+
if (bits >> i) & 0x01:
4157+
err_info.append((i + 1, ret[1][i+1] if is_rad else math.degrees(ret[1][i+1])))
4158+
return 0, err_info
4159+
# ret[1][1] = ret[1][1] if is_rad else math.degrees(ret[1][1])
41524160
return ret

0 commit comments

Comments
 (0)