-
Notifications
You must be signed in to change notification settings - Fork 0
/
elastic.py
71 lines (55 loc) · 2.05 KB
/
elastic.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from wpilib.shuffleboard import Shuffleboard
from wpilib.shuffleboard import BuiltInWidgets
from robotconfig import elasticConfig
from robotconfig import autonConfig
from wpilib import SmartDashboard
import wpilib
from wpilib.shuffleboard import Shuffleboard
class Elastic:
def __init__(self,autonPlans):
self.config = elasticConfig
self.autonPlans = autonPlans
self.autonConfig = autonConfig
self.selectedTaskKey = autonConfig['B_FAST_FOUR_NOTE_SUBWOOFER']
self.isNoteDetected = self.config["NOTE_IS_DETECTED"]
self.isNoteLeft = self.config["NOTE_ON_LEFT"]
self.isNoteRight = self.config["NOTE_ON_RIGHT"]
self.isNoteLoaded = self.config["NOTE_IS_LOADED"]
def displayMainWindow(self):
tab = "Main Window"
(Shuffleboard.getTab(tab)
.add("Note Detected!", self.isNoteDetected)
.withSize(4,4)
.withPosition(17,0)
.withWidget(BuiltInWidgets.kBooleanBox)
.getEntry())
(Shuffleboard.getTab(tab)
.add("Note on Left", self.isNoteLeft)
.withSize(4,4)
.withPosition(13,0)
.withWidget(BuiltInWidgets.kBooleanBox)
.getEntry())
(Shuffleboard.getTab(tab)
.add("Note on Right", self.isNoteRight)
.withSize(4,4)
.withPosition(21,0)
.withWidget(BuiltInWidgets.kBooleanBox)
.getEntry())
(Shuffleboard.getTab(tab)
.add("Note Loaded!",self.isNoteLoaded)
.withSize(4,4)
.withPosition(17,4)
.withWidget(BuiltInWidgets.kBooleanBox)
.getEntry())
def autonDisplay(self, default):
self.chooser = wpilib.SendableChooser()
self.chooser.setDefaultOption(default, default)
for plan in self.autonPlans:
self.chooser.addOption(plan, plan)
SmartDashboard.putData(self.chooser)
def getSelectedAuton(self):
return self.chooser.getSelected()
def putField(self, field):
SmartDashboard.putData(field)
def putNumber(self, key, num):
SmartDashboard.putNumber(key, num)