Commit a621482e38867a65305089b296b1e2832a5c0210

Authored by Christopher Stone
1 parent a63df0ea
Exists in master

Minor cleaning up after earlier changes

robots/little_john/telemetry/code/monitor/graph_plotter_rewrite.py
1 1 #!/usr/bin/env python3
  2 +# Note that this should mostly work with python2, if necessary
2 3  
3 4 # Tool to draw live graphs of data coming in from serial port
4 5 # Written as a telemetry tool by:
... ... @@ -6,32 +7,31 @@
6 7  
7 8 # This code is incomplete, and is missing core features
8 9  
9   -import pyglet
10 10 #import math
11 11 #import time
12 12 #import serial
  13 +
  14 +import pyglet
13 15 import numpy
14 16 import os
15 17 import platform
16 18 import sys
17 19 import easygui
18 20 import logging
19   -from serialselect import selectserial
20 21  
  22 +from serialselect import selectserial
21 23 from colours import *
22 24  
23   -logging.basicConfig(format='%(levelname)s:\t%(message)s',
24   - level=logging.DEBUG)
  25 +logging.basicConfig(format='%(levelname)s:\t%(message)s', level=logging.DEBUG)
25 26 logging.info("Logging system active")
26 27  
27 28 datafeed = selectserial()
28 29  
29 30 if datafeed == None:
30   - message = "Failed to open serial port"
31   - logging.critical(message)
  31 + logging.critical("Failed to open serial port")
32 32 sys.exit()
33 33  
34   -if platform.system()=='Windows': #easier than passing vars
  34 +if platform.system()=='Windows':
35 35 os='Windows'
36 36 else:
37 37 os='Other'
... ... @@ -168,7 +168,7 @@ def pollSerial(elapsed):
168 168 if os=='Windows':
169 169 values = datafeed.readline().strip().split(b", ")
170 170 else:
171   - values = datafeed.readline().strip()#.split(', ')
  171 + values = datafeed.readline().strip()
172 172 values = str(values).split(", ")
173 173 testseries.addpoint(values)
174 174  
... ...
robots/little_john/telemetry/code/monitor/serialselect.py
... ... @@ -3,6 +3,7 @@
3 3 # The UoN Robot Wars Project, 2018
4 4  
5 5 def selectserial():
  6 + """Cross-platform function to find appropriate serial ports, query the user if necessary, and open one of them"""
6 7 import platform
7 8 import serial
8 9 import os
... ...