-
Notifications
You must be signed in to change notification settings - Fork 0
/
CANTables.py
44 lines (30 loc) · 855 Bytes
/
CANTables.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import time
from networktables import NetworkTable
# import colorama
# from colorama import Fore, Back, Style
# colorama.init()
# AUTHOR: Robbie Selwyn
IP = "roborio-8-frc.local"
NetworkTable.setIPAddress(IP)
NetworkTable.setClientMode()
NetworkTable.initialize()
table = NetworkTable.getTable("data_table")
recording = False
f = None
time.sleep(1)
print "Started Listening"
while True:
if table.getString("start", "") == "true" and not recording:
print "Received Start"
recording = True
f = open("can-data.csv", "w")
if table.getString("end", "") == "true" and recording:
print "Received End"
recording = False
f.close()
exit(0)
if recording:
#print table.getString("status","")
f.write(table.getString("status",""))
time.sleep(0.02)
# print "Wait"