Skip to content

Commit 1ca478d

Browse files
committed
[fix] fix single joint control
1 parent 12317f5 commit 1ca478d

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

doc/api/xarm_api.md

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

33
## class __XArmAPI__
44
****************************************
@@ -2636,6 +2636,16 @@ xArm-Python-SDK API Documentation (V1.13.30): class XArmAPI in module xarm.wrapp
26362636
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
26372637
26382638

2639+
#### def __set_control_modbus_baudrate__(self, baud):
2640+
2641+
> Set the modbus baudrate of the control box
2642+
>
2643+
> :param baud: 4800/9600/19200/38400/57600/115200/230400/460800/921600/1000000/1500000/2000000/2500000
2644+
>
2645+
> :return: code
2646+
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
2647+
2648+
26392649
#### def __set_counter_increase__(self, val=1):
26402650

26412651
> Set counter plus value, only support plus 1
@@ -3489,15 +3499,6 @@ xArm-Python-SDK API Documentation (V1.13.30): class XArmAPI in module xarm.wrapp
34893499
> :return: code
34903500
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
34913501
3492-
#### def __set_control_modbus_baudrate__(self, baud):
3493-
3494-
> Set the modbus baudrate of the control box
3495-
>
3496-
> :param baud: 4800/9600/19200/38400/57600/115200/230400/460800/921600/1000000/1500000/2000000/2500000
3497-
>
3498-
> :return: code
3499-
>     code: See the [API Code Documentation](./xarm_api_code.md#api-code) for details.
3500-
35013502

35023503
#### def __set_timeout__(self, timeout):
35033504

xarm/version.py

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

xarm/x3/xarm.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, port=None, is_radian=False, do_not_open=False, instance=None,
4646
Base.__init__(self, port, is_radian, do_not_open, **kwargs)
4747

4848
def _is_out_of_tcp_range(self, value, i):
49-
if not self._check_tcp_limit or self._stream_type != 'socket' or not self._enable_report:
49+
if not self._check_tcp_limit or self._stream_type != 'socket' or not self._enable_report or value == math.inf:
5050
return False
5151
tcp_range = XCONF.Robot.TCP_LIMITS.get(self.axis).get(self.device_type, [])
5252
if 2 < i < len(tcp_range): # only limit rotate
@@ -63,7 +63,7 @@ def _is_out_of_tcp_range(self, value, i):
6363
return False
6464

6565
def _is_out_of_joint_range(self, angle, i):
66-
if not self._check_joint_limit or self._stream_type != 'socket' or not self._enable_report:
66+
if not self._check_joint_limit or self._stream_type != 'socket' or not self._enable_report or angle == math.inf:
6767
return False
6868
joint_limit = XCONF.Robot.JOINT_LIMITS.get(self.axis).get(self.device_type, [])
6969
if i < len(joint_limit):
@@ -132,12 +132,12 @@ def _set_position_absolute(self, x=None, y=None, z=None, roll=None, pitch=None,
132132
is_radian = self._default_is_radian if is_radian is None else is_radian
133133
only_check_type = kwargs.get('only_check_type', self._only_check_type)
134134
tcp_pos = [
135-
self._last_position[0] if x is None else float(x),
136-
self._last_position[1] if y is None else float(y),
137-
self._last_position[2] if z is None else float(z),
138-
self._last_position[3] if roll is None else to_radian(roll, is_radian),
139-
self._last_position[4] if pitch is None else to_radian(pitch, is_radian),
140-
self._last_position[5] if yaw is None else to_radian(yaw, is_radian),
135+
(math.inf if self.version_is_ge(2, 4, 100) else self._last_position[0]) if x is None else float(x),
136+
(math.inf if self.version_is_ge(2, 4, 100) else self._last_position[1]) if y is None else float(y),
137+
(math.inf if self.version_is_ge(2, 4, 100) else self._last_position[2]) if z is None else float(z),
138+
(math.inf if self.version_is_ge(2, 4, 100) else self._last_position[3]) if roll is None else to_radian(roll, is_radian),
139+
(math.inf if self.version_is_ge(2, 4, 100) else self._last_position[4]) if pitch is None else to_radian(pitch, is_radian),
140+
(math.inf if self.version_is_ge(2, 4, 100) else self._last_position[5]) if yaw is None else to_radian(yaw, is_radian),
141141
]
142142
motion_type = kwargs.get('motion_type', False)
143143
for i in range(3):
@@ -460,7 +460,7 @@ def set_servo_angle(self, servo_id=None, angle=None, speed=None, mvacc=None, mvt
460460
if servo_id is not None and servo_id != 8:
461461
if servo_id > self.axis or servo_id <= 0:
462462
return APIState.SERVO_NOT_EXIST
463-
angles = [None] * 7
463+
angles = [math.inf if self.version_is_ge(2, 4, 100) else None] * 7
464464
angles[servo_id - 1] = angle
465465
else:
466466
angles = angle

0 commit comments

Comments
 (0)