Browse Source

e32_client graceful exit

try-fix-comms-errors
Alex Mikhalev 6 years ago
parent
commit
39d6298c0d
  1. 0
      e32_client/requirements.txt
  2. 8
      e32_client/ugv.py

0
e32_client/requirements.txt

8
e32_client/ugv.py

@ -38,7 +38,7 @@ class UGVComms(E32): @@ -38,7 +38,7 @@ class UGVComms(E32):
def __rx_thread_entry(ugv: UGVComms):
while True:
while ugv.ser.is_open:
try:
msg = ugv.read_message()
if msg is not None:
@ -59,6 +59,7 @@ if __name__ == "__main__": @@ -59,6 +59,7 @@ if __name__ == "__main__":
# ugv.reset()
cmd_id = 1
time.sleep(0.2)
try:
while True:
gmsg = messages.GroundMessage()
gmsg.command.id = cmd_id
@ -67,7 +68,10 @@ if __name__ == "__main__": @@ -67,7 +68,10 @@ if __name__ == "__main__":
print("writing message: ", gmsg)
ugv.write_message(gmsg)
time.sleep(2.)
except KeyboardInterrupt:
print("exiting...")
finally:
ugv.ser.close()
rx_thread.In
rx_thread.join()

Loading…
Cancel
Save