Skip to content

Commit f7d2ed5

Browse files
Add timeout kwarg to referencing methods
For larger portals the referencing can take more than 30 seconds.
1 parent b467de4 commit f7d2ed5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cri_lib/cri_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def zero_all_joints(self) -> bool:
481481
else:
482482
return False
483483

484-
def reference_all_joints(self) -> bool:
484+
def reference_all_joints(self, *, timeout: float = 30) -> bool:
485485
"""Reference all joints. Long timout of 30 seconds.
486486
487487
Returns
@@ -493,7 +493,7 @@ def reference_all_joints(self) -> bool:
493493

494494
if (msg_id := self._send_command("CMD ReferenceAllJoints", True)) is not None:
495495
if (
496-
error_msg := self._wait_for_answer(f"{msg_id}", timeout=30.0)
496+
error_msg := self._wait_for_answer(f"{msg_id}", timeout=timeout)
497497
) is not None:
498498
logger.debug("Error in ReferenceAllJoints command: %s", error_msg)
499499
return False
@@ -502,7 +502,7 @@ def reference_all_joints(self) -> bool:
502502
else:
503503
return False
504504

505-
def reference_single_joint(self, joint: str) -> bool:
505+
def reference_single_joint(self, joint: str, *, timeout: float = 30) -> bool:
506506
"""Reference a single joint. Long timout of 30 seconds.
507507
508508
Parameters
@@ -528,7 +528,7 @@ def reference_single_joint(self, joint: str) -> bool:
528528
msg_id := self._send_command(f"CMD ReferenceSingleJoint {joint_msg}", True)
529529
) is not None:
530530
if (
531-
error_msg := self._wait_for_answer(f"{msg_id}", timeout=30.0)
531+
error_msg := self._wait_for_answer(f"{msg_id}", timeout=timeout)
532532
) is not None:
533533
logger.debug("Error in ReferenceSingleJoint command: %s", error_msg)
534534
return False

0 commit comments

Comments
 (0)