-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.py
63 lines (43 loc) · 1.78 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
from commands2 import CommandScheduler, TimedCommandRobot
from wpilib import DataLogManager, DriverStation, RobotBase
from robot_container import RobotContainer
class OilSpill(TimedCommandRobot):
def __init__(self, period = 0.02) -> None:
super().__init__(period)
self.container = RobotContainer()
DriverStation.silenceJoystickConnectionWarning(not DriverStation.isFMSAttached())
if RobotBase.isReal():
DataLogManager.start("/home/lvuser/logs")
else:
DataLogManager.start()
DriverStation.startDataLog(DataLogManager.getLog())
DataLogManager.log("Robot initialized")
# Most of these are all here to suppress warnings
def robotPeriodic(self) -> None:
pass
def _simulationPeriodic(self) -> None:
pass
def autonomousInit(self) -> None:
DataLogManager.log("Autonomous period started")
selected_auto = self.container.get_autonomous_command()
if selected_auto is not None:
selected_auto.schedule()
def autonomousPeriodic(self) -> None:
pass
def autonomousExit(self) -> None:
DataLogManager.log("Autonomous period ended")
def teleopInit(self) -> None:
DataLogManager.log("Teleoperated period started")
def teleopExit(self) -> None:
DataLogManager.log("Teleoperated period ended")
def testInit(self):
DataLogManager.log("Test period started")
CommandScheduler.getInstance().cancelAll()
CommandScheduler.getInstance().disable()
def testExit(self):
DataLogManager.log("Test period ended")
CommandScheduler.getInstance().enable()
def disabledPeriodic(self) -> None:
pass
def teleopPeriodic(self) -> None:
pass