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