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"
|
# expected data: '(u1, u2)'\n"
|
||||||
# where ui = control for motor i
|
# where ui = control for motor i
|
||||||
# ui \in [-1.0, 1.0]
|
# ui \in [-1.0, 1.0]
|
||||||
|
try:
|
||||||
data = comm_socket.readline()
|
data = comm_socket.readline()
|
||||||
data_str = data.decode()
|
data_str = data.decode()
|
||||||
#print("Data received: {}".format(data_str))
|
#print("Data received: {}".format(data_str))
|
||||||
try:
|
|
||||||
#print("processing data = {}".format(data_str))
|
#print("processing data = {}".format(data_str))
|
||||||
l = data_str.strip('()\n').split(',')
|
l = data_str.strip('()\n').split(',')
|
||||||
#print("l = {}".format(l))
|
#print("l = {}".format(l))
|
||||||
|
@ -74,6 +74,12 @@ class Robot:
|
||||||
print("Shutting down ...")
|
print("Shutting down ...")
|
||||||
u1 = u2 = 0
|
u1 = u2 = 0
|
||||||
listening = False
|
listening = False
|
||||||
|
except Exception as e:
|
||||||
|
print("Some other error occured")
|
||||||
|
print("Exception: {}".format(e))
|
||||||
|
print("Shutting down ...")
|
||||||
|
u1 = u2 = 0
|
||||||
|
listening = False
|
||||||
finally:
|
finally:
|
||||||
self.m1.speed(u1)
|
self.m1.speed(u1)
|
||||||
self.m2.speed(u2)
|
self.m2.speed(u2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user