Last active
October 21, 2022 14:20
-
-
Save acidzebra/30670c5556ea623cb30d497d754d2e3c to your computer and use it in GitHub Desktop.
workaround for the endless timeouts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
robot_connected = 0 | |
while robot_connected == 0: | |
try: | |
print("Connecting to Vector") | |
myrobot.connect(timeout=30) | |
robot_connected = 1 | |
sleep(2) | |
except anki_vector.exceptions.VectorNotFoundException as e: | |
print("Vector not found exception, sleeping for 60 secs and retrying. Error: " + repr(e)) | |
sleep(60) | |
robot_connected = 0 | |
except anki_vector.exceptions.VectorConnectionException as e: | |
if repr(e).find("DEADLINE_EXCEEDED") != -1: | |
print("ListAnimation SDK/OS timeout bug, we will keep trying to connect. Error: " + repr(e)) | |
myrobot.disconnect() | |
sleep(2) | |
robot_connected = 0 | |
elif repr(e).find("connection has been closed") != -1: | |
print("Vector closed connection, try rebooting Vector. Error: "+ repr(e)) | |
myrobot.disconnect() | |
sleep(60) | |
robot_connected = 0 | |
else: | |
print("A general error occurred: " + repr(e)) | |
myrobot.disconnect() | |
sleep(5) | |
robot_connected = 0 | |
sleep(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment