|
|
|
@ -55,6 +55,7 @@ class UGV_CLI:
@@ -55,6 +55,7 @@ class UGV_CLI:
|
|
|
|
|
'get_status': self.get_status, |
|
|
|
|
's': self.get_status, |
|
|
|
|
} |
|
|
|
|
self.ugv = None |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
@cli_cmd(names=["help", "h", "?"], description="Print this help message") |
|
|
|
@ -128,12 +129,21 @@ class UGV_CLI:
@@ -128,12 +129,21 @@ class UGV_CLI:
|
|
|
|
|
log.info("last status (%.4f seconds ago): %s", |
|
|
|
|
last_status_delay, self.ugv.last_status) |
|
|
|
|
|
|
|
|
|
def find_command(self, name): |
|
|
|
|
@staticmethod |
|
|
|
|
def find_command(name): |
|
|
|
|
for cmd in cli_commands: |
|
|
|
|
if name in cmd.names: |
|
|
|
|
return cmd |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
def complete_command(text, state): |
|
|
|
|
options = [name for cmd in cli_commands for name in cmd.names if name.startswith(text)] |
|
|
|
|
if state < len(options): |
|
|
|
|
return options[state] |
|
|
|
|
else: |
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
def start(self): |
|
|
|
|
self.is_running = True |
|
|
|
|
|
|
|
|
@ -144,6 +154,10 @@ class UGV_CLI:
@@ -144,6 +154,10 @@ class UGV_CLI:
|
|
|
|
|
ser = serial.serial_for_url(ser_url, baudrate=9600, parity=serial.PARITY_NONE, |
|
|
|
|
stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, |
|
|
|
|
timeout=0.5) |
|
|
|
|
|
|
|
|
|
readline.parse_and_bind("tab: complete") |
|
|
|
|
readline.set_completer(self.complete_command) |
|
|
|
|
|
|
|
|
|
self.ugv = UGVComms(ser) |
|
|
|
|
self.ugv.start() |
|
|
|
|
time.sleep(0.2) |
|
|
|
|