fixed another reconnection issue that only seems to occur with windows

This commit is contained in:
Simon Pirkelmann 2019-06-06 15:19:14 +02:00
parent 4bff8e1df5
commit 5bc1c9ca9f

View File

@ -51,10 +51,10 @@ class Robot:
# expected data: '(u1, u2)'\n"
# where ui = control for motor i
# ui \in [-1.0, 1.0]
try:
data = comm_socket.readline()
data_str = data.decode()
#print("Data received: {}".format(data_str))
try:
#print("processing data = {}".format(data_str))
l = data_str.strip('()\n').split(',')
#print("l = {}".format(l))
@ -74,6 +74,12 @@ class Robot:
print("Shutting down ...")
u1 = u2 = 0
listening = False
except Exception as e:
print("Some other error occured")
print("Exception: {}".format(e))
print("Shutting down ...")
u1 = u2 = 0
listening = False
finally:
self.m1.speed(u1)
self.m2.speed(u2)