forked from Telos4/RoboRally
fixed another reconnection issue that only seems to occur with windows
This commit is contained in:
parent
4bff8e1df5
commit
5bc1c9ca9f
|
@ -51,10 +51,10 @@ class Robot:
|
|||
# expected data: '(u1, u2)'\n"
|
||||
# where ui = control for motor i
|
||||
# ui \in [-1.0, 1.0]
|
||||
data = comm_socket.readline()
|
||||
data_str = data.decode()
|
||||
#print("Data received: {}".format(data_str))
|
||||
try:
|
||||
data = comm_socket.readline()
|
||||
data_str = data.decode()
|
||||
#print("Data received: {}".format(data_str))
|
||||
#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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user