@@ -1109,7 +1109,7 @@ def _moveX(self, target: Union['Item', List[float], robomath.Mat], itemrobot: 'I
11091109 self ._check_status ()
11101110 if blocking :
11111111 #itemrobot.WaitMove()
1112- self .COM .settimeout (360000 )
1112+ self .COM .settimeout (max ( 360000 , self . TIMEOUT ) )
11131113 self ._check_status () #will wait here
11141114 self .COM .settimeout (self .TIMEOUT )
11151115
@@ -1163,7 +1163,7 @@ def MoveC(self, target1: Union['Item', List[float], robomath.Mat], target2: Unio
11631163 self ._check_status ()
11641164 if blocking :
11651165 #itemrobot.WaitMove()
1166- self .COM .settimeout (360000 )
1166+ self .COM .settimeout (max ( 360000 , self . TIMEOUT ) )
11671167 self ._check_status () #will wait here
11681168 self .COM .settimeout (self .TIMEOUT )
11691169
@@ -1450,7 +1450,7 @@ def output_reader(proc):
14501450 if self .NODELAY :
14511451 self .COM .setsockopt (socket .IPPROTO_TCP , socket .TCP_NODELAY , 1 )
14521452
1453- self .COM .settimeout (1 )
1453+ self .COM .settimeout (1 ) # Intentionally low timeout
14541454 try :
14551455 self .COM .connect ((self .IP , port ))
14561456 connected = self ._is_connected ()
@@ -1633,7 +1633,7 @@ def ItemUserPick(self, message: str = "Pick one item", itemtype_or_list: Union[i
16331633 for itm in itemtype_or_list :
16341634 self ._send_item (itm )
16351635
1636- self .COM .settimeout (3600 ) # wait up to 1 hour for user input
1636+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) ) # wait up to 1 hour for user input
16371637 item = self ._rec_item ()
16381638 self .COM .settimeout (self .TIMEOUT )
16391639 self ._check_status ()
@@ -1804,7 +1804,7 @@ def ShowMessage(self, message: str, popup: bool = True):
18041804 command = 'ShowMessage'
18051805 self ._send_line (command )
18061806 self ._send_line (message )
1807- self .COM .settimeout (3600 ) # wait up to 1 hour user to hit OK
1807+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) ) # wait up to 1 hour user to hit OK
18081808 self ._check_status ()
18091809 self .COM .settimeout (self .TIMEOUT )
18101810 else :
@@ -1920,7 +1920,7 @@ def AddFile(self, filename: str, parent: 'Item' = 0) -> 'Item':
19201920 self ._send_line (command )
19211921 self ._send_line (filename )
19221922 self ._send_item (parent )
1923- self .COM .settimeout (60 ) # 60 seconds timeout to add a file
1923+ self .COM .settimeout (max ( 60 , self . TIMEOUT ) ) # 60 seconds timeout to add a file
19241924 newitem = self ._rec_item ()
19251925 self .COM .settimeout (self .TIMEOUT )
19261926 self ._check_status ()
@@ -2172,7 +2172,7 @@ def ProjectPoints(self, points: Union[List[float], robomath.Mat], object_project
21722172 self ._send_matrix (points )
21732173 self ._send_item (object_project )
21742174 self ._send_int (projection_type )
2175- self .COM .settimeout (timeout ) # 30 seconds timeout
2175+ self .COM .settimeout (max ( timeout , self . TIMEOUT ))
21762176 projected_points = self ._rec_matrix () # will wait here
21772177 self .COM .settimeout (self .TIMEOUT )
21782178 self ._check_status ()
@@ -2228,7 +2228,7 @@ def Save(self, filename: str, itemsave: 'Item' = 0):
22282228 self ._send_line (command )
22292229 self ._send_line (filename )
22302230 self ._send_item (itemsave )
2231- self .COM .settimeout (60 )
2231+ self .COM .settimeout (max ( 60 , self . TIMEOUT ) )
22322232 self ._check_status ()
22332233 self .COM .settimeout (self .TIMEOUT )
22342234
@@ -2983,7 +2983,7 @@ def Command(self, cmd: str, value: Union[str, Dict, robomath.Mat, 'Item'] = '',
29832983 self ._send_item (None )
29842984 self ._send_line (str (cmd ))
29852985 self ._send_matrix (value )
2986- self .COM .settimeout (3600 )
2986+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
29872987 nmats = self ._rec_int ()
29882988 self .COM .settimeout (self .TIMEOUT )
29892989 mat2d_list = []
@@ -3017,7 +3017,7 @@ def Command(self, cmd: str, value: Union[str, Dict, robomath.Mat, 'Item'] = '',
30173017 self ._send_line (command )
30183018 self ._send_line (str (cmd ))
30193019 self ._send_line (value )
3020- self .COM .settimeout (3600 )
3020+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
30213021 line = self ._rec_line ()
30223022 self .COM .settimeout (self .TIMEOUT )
30233023 self ._check_status ()
@@ -3289,7 +3289,7 @@ def CalibrateTool(self, poses_xyzwpr: Union[List[robomath.Mat], List[List[float]
32893289 self ._send_array (algorithm )
32903290 self ._send_item (robot )
32913291 self ._send_item (tool )
3292- self .COM .settimeout (3600 )
3292+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
32933293 TCPxyz = self ._rec_array ()
32943294 self .COM .settimeout (self .TIMEOUT )
32953295 errorstats = self ._rec_array ()
@@ -3669,7 +3669,7 @@ def Cam2D_Snapshot(self, file_save_img: str = "", cam_handle: 'Item' = 0, params
36693669 self ._send_item (cam_handle )
36703670 self ._send_line (file_save_img )
36713671 self ._send_line (params )
3672- self .COM .settimeout (3600 )
3672+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
36733673 if len (file_save_img ) == 0 :
36743674 # If the file name is empty we are expecting a byte array as PNG file
36753675 success = self ._rec_bytes ()
@@ -3958,7 +3958,7 @@ def Popup_ISO9283_CubeProgram(self, robot: 'Item' = 0) -> 'Item':
39583958 command = 'Popup_ProgISO9283'
39593959 self ._send_line (command )
39603960 self ._send_item (robot )
3961- self .COM .settimeout (3600 )
3961+ self .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
39623962 iso_program = self ._rec_item ()
39633963 self .COM .settimeout (self .TIMEOUT )
39643964 self ._check_status ()
@@ -4138,7 +4138,7 @@ def PluginCommand(self, plugin_name: str, plugin_command: str = "", value: str =
41384138 self ._send_line (plugin_name )
41394139 self ._send_line (plugin_command )
41404140 self ._send_line (str (value ))
4141- self .COM .settimeout (3600 * 24 * 7 )
4141+ self .COM .settimeout (max ( 3600 * 24 * 7 , self . TIMEOUT ) )
41424142 result = self ._rec_line ()
41434143 self .COM .settimeout (self .TIMEOUT )
41444144 self ._check_status ()
@@ -5195,7 +5195,7 @@ def setMachiningParameters(self, ncfile: str = '', part: 'Item' = 0, params: str
51955195 self .link ._send_line (ncfile )
51965196 self .link ._send_item (part )
51975197 self .link ._send_line (params )
5198- self .link .COM .settimeout (3600 )
5198+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
51995199 newprog = self .link ._rec_item ()
52005200 self .link .COM .settimeout (self .link .TIMEOUT )
52015201 status = self .link ._rec_int () / 1000.0
@@ -6175,7 +6175,7 @@ def MoveJ_Test(self, j1: Union[List[float], robomath.Mat], j2: Union[List[float]
61756175 self .link ._send_array (j1 )
61766176 self .link ._send_array (j2 )
61776177 self .link ._send_int (minstep_deg * 1000 )
6178- self .link .COM .settimeout (3600 ) # wait up to 1 hour
6178+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ))
61796179 collision = self .link ._rec_int ()
61806180 self .link .COM .settimeout (self .link .TIMEOUT )
61816181 self .link ._check_status ()
@@ -6209,7 +6209,7 @@ def MoveJ_Test_Blend(self, j1: Union[List[float], robomath.Mat], j2: Union[List[
62096209 self .link ._send_array (j3 )
62106210 self .link ._send_int (minstep_deg * 1000.0 )
62116211 self .link ._send_int (blend_deg * 1000.0 )
6212- self .link .COM .settimeout (3600 )
6212+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
62136213 collision = self .link ._rec_int ()
62146214 self .link .COM .settimeout (self .link .TIMEOUT )
62156215 self .link ._check_status ()
@@ -6239,7 +6239,7 @@ def MoveL_Test(self, j1: Union[List[float], robomath.Mat], pose: robomath.Mat, m
62396239 self .link ._send_array (j1 )
62406240 self .link ._send_pose (pose )
62416241 self .link ._send_int (minstep_mm * 1000 )
6242- self .link .COM .settimeout (3600 ) # wait up to 1 hour
6242+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ))
62436243 collision = self .link ._rec_int ()
62446244 self .link .COM .settimeout (self .link .TIMEOUT )
62456245 self .link ._check_status ()
@@ -6464,7 +6464,7 @@ def WaitMove(self, timeout: float = 360000):
64646464 self .link ._send_line (command )
64656465 self .link ._send_item (self )
64666466 self .link ._check_status ()
6467- self .link .COM .settimeout (timeout )
6467+ self .link .COM .settimeout (max ( timeout , self . TIMEOUT ) )
64686468 self .link ._check_status () #will wait here
64696469 self .link .COM .settimeout (self .link .TIMEOUT )
64706470 #busy = self.link.Is_Busy(self.item)
@@ -6587,7 +6587,7 @@ def MakeProgram(self, folder_path: str = '', run_mode: int = RUNMODE_MAKE_ROBOTP
65876587 self .link ._send_item (self )
65886588 self .link ._send_line (folder_path )
65896589 self .link ._send_int (run_mode )
6590- self .link .COM .settimeout (300 ) # wait up to 5 minutes for the program to generate
6590+ self .link .COM .settimeout (max ( 300 , self . TIMEOUT )) # wait at least 5 minutes for the program to generate
65916591 prog_status = self .link ._rec_int ()
65926592 self .link .COM .settimeout (self .link .TIMEOUT )
65936593 prog_log_str = self .link ._rec_line ()
@@ -6836,7 +6836,7 @@ def waitDI(self, io_var: Union[int, str], io_value: Union[int, float, str], time
68366836 self .link ._send_line (str (io_var ))
68376837 self .link ._send_line (str (io_value ))
68386838 self .link ._send_int (timeout_ms * 1000 )
6839- self .link .COM .settimeout (3600 * 24 * 7 ) # wait up to 1 week
6839+ self .link .COM .settimeout (max ( 3600 * 24 * 7 , self . TIMEOUT ))
68406840 self .link ._check_status ()
68416841 self .link .COM .settimeout (self .link .TIMEOUT )
68426842
@@ -7136,7 +7136,7 @@ def Update(self, check_collisions: int = COLLISION_OFF, timeout_sec: float = 360
71367136 self .link ._send_line (command )
71377137 self .link ._send_item (self )
71387138 self .link ._send_array ([check_collisions , mm_step , deg_step ])
7139- self .link .COM .settimeout (timeout_sec ) # wait up to 1 hour user to hit OK
7139+ self .link .COM .settimeout (max ( timeout_sec , self . TIMEOUT )) # wait at least up to 1 hour user to hit OK
71407140 values = self .link ._rec_array ().tolist ()
71417141 self .link .COM .settimeout (self .link .TIMEOUT )
71427142 readable_msg = self .link ._rec_line ()
@@ -7213,7 +7213,7 @@ def InstructionListJoints(self, mm_step: float = 10, deg_step: float = 5, save_t
72137213 self .link ._send_item (self )
72147214 self .link ._send_array ([mm_step , deg_step , float (collision_check ), float (flags ), float (time_step )])
72157215 joint_list = save_to_file
7216- self .link .COM .settimeout (3600 )
7216+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
72177217 if save_to_file is None :
72187218 self .link ._send_line ('' )
72197219 joint_list = self .link ._rec_matrix ()
@@ -7337,7 +7337,7 @@ def setParam(self, param: str, value: Union[str, Dict, bytes, 'Item', bool, robo
73377337 self .link ._send_item (self )
73387338 self .link ._send_line (str (param ))
73397339 self .link ._send_matrix (value )
7340- self .link .COM .settimeout (3600 )
7340+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
73417341 nmats = self .link ._rec_int ()
73427342 self .link .COM .settimeout (self .link .TIMEOUT )
73437343 mat2d_list = []
@@ -7376,7 +7376,7 @@ def setParam(self, param: str, value: Union[str, Dict, bytes, 'Item', bool, robo
73767376 self .link ._send_line (str (param ))
73777377 self .link ._send_line (value )
73787378
7379- self .link .COM .settimeout (3600 )
7379+ self .link .COM .settimeout (max ( 3600 , self . TIMEOUT ) )
73807380 line = self .link ._rec_line ()
73817381 self .link .COM .settimeout (self .link .TIMEOUT )
73827382
0 commit comments