/
robot.py
85 lines (63 loc) · 2.29 KB
/
robot.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import wpilib
from wpilib import SmartDashboard
from commandbased import CommandBasedRobot
from wpilib.command import Scheduler
from robotMap import RobotMap
from helper import Creator
from oi import OI
from subsystems.drive import Drive
from subsystems.testelectronics import testElectronics
from subsystems.turret import Turret
from subsystems.limelight import Limelight
from subsystems.flywheel import Flywheel
from subsystems.intake import Intake
from subsystems.conveyor import Conveyor
from commands.teleop import TeleOp
class Robot(CommandBasedRobot):
def robotInit(self):
super().__init__(self)
# init robot subs and commands
self.Creator = Creator() # program to create robot parts for subs
self.botMap = RobotMap(self)
self.oi = OI(self)
self.teleop = TeleOp(self)
self.Drive = Drive(self)
self.Flywheel = Flywheel(self)
self.Limelight = Limelight(self)
self.Intake = Intake(self)
self.Conveyor = Conveyor(self)
self.Turret = Turret(self)
self.s = Scheduler
def robotPeriodic(self):
self.s.getInstance().run() # run auto
def log(self):
self.Flywheel.log()
def autonomousInit(self):
# choose auto program
"""self.selectedAuto.cancel()
self.selectedAuto = self.chooser.getSelected() # find what auto was selected
self.selectedAuto.start() # start chosen auto"""
pass
def autonomousPeriodic(self):
# cut auto if fail and go to driver
"""if self.OI.getMainController().getStartButton():
self.selectedAuto.cancel()
self.selectedAuto = self.teleOp
self.selectedAuto.start()
# self.s.getInstance().run() # run auto
self.log() # log important data on to smartdashboard"""
pass
def teleopInit(self):
# stops old auto and goes to teleop
# self.selectedAuto.cancel()
self.teleop.start() # start teleop"""
def teleopPeriodic(self):
# self.log() # log important data on to smartdashboard
self.log()
def disabledInit(self):
pass # nothing
def disabledPeriodic(self):
# self.log() # log important data on to smartdashboard
pass
if __name__ == '__main__':
wpilib.run(Robot)