From 5a67fe5e8f6a720f46d075005ef6c5c74ccaa40d Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Wed, 8 May 2019 21:33:09 -0700 Subject: [PATCH] allow specifying serial device --- e32_client/ugv.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/e32_client/ugv.py b/e32_client/ugv.py index 7cd9907..97f67dc 100755 --- a/e32_client/ugv.py +++ b/e32_client/ugv.py @@ -103,9 +103,13 @@ class UGVComms(E32): continue def main(): - ser = serial.serial_for_url("/dev/ttyUSB2", baudrate=9600, parity=serial.PARITY_NONE, + if len(sys.argv) >= 2: + ser_url = sys.argv[1] + else: + ser_url = "hwgrep://" + ser = serial.serial_for_url(ser_url, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, - timeout=2.0) + timeout=1.0) ugv = UGVComms(ser) ugv.start() time.sleep(0.2)