diff --git a/utils.py b/utils.py index a2d8afe..85374c6 100644 --- a/utils.py +++ b/utils.py @@ -73,13 +73,13 @@ class RobotClient: print(f"{RED}DEBUG: Exception in recv loop: {e}{RESET}") break - def _send_single_json(self, cmd) -> dict: + def _send_single_json(self, cmd, timeout=5.0) -> dict: if DEBUG: print(f"{CYAN}DEBUG: sended:{RESET} {cmd}") self.sock.sendall(json.dumps(cmd).encode("utf-8")) try: - response = self._response_queue.get(timeout=5) + response = self._response_queue.get(timeout=timeout) try: extra = self._response_queue.get_nowait() raise RuntimeError( @@ -170,7 +170,7 @@ class RobotClient: def move_line(self, joint_radian: list) -> None: cmd = {"command": "move_line", "joint_radian": joint_radian} - ret = self._send_single_json(cmd) + ret = self._send_single_json(cmd, 10.0) if (ret.get("ret") != 0): raise RuntimeError(f"move_line failed: {ret}") self.wait_untill_motion_is_done(10.0)