@@ -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