forked from RVRProgramming/Diablo2018
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.py
55 lines (44 loc) · 1.75 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
from commandbased import CommandBasedRobot
import wpilib
class MyRobot(CommandBasedRobot):
# This runs as soon as the robot starts up.
def robotInit(self):
super().robotInit()
# Import and initialize commands.
import commands
self.teleDrive = commands.TeleDrive()
self.teleElevate = commands.TeleElevate()
self.autoDriveStraightPID = commands.AutoDriveStraightPID(5.5)
self.diagnostics = commands.Diagnostics()
self.disaDisableTalons = commands.DisaDisableTalons()
# Start displaying SmartDash diagnostics.
self.diagnostics.start()
# This runs in a loop alongside the current mode's periodic function.
def robotPeriodic(self):
super().robotPeriodic()
# This runs as soon as robotInit finishes, and every time the bot is disabled after that.
def disabledInit(self):
super().disabledInit()
self.disaDisableTalons.start()
# This runs in a loop while the bot is disabled.
def disabledPeriodic(self):
super().commandPeriodic()
# This runs at the beginning of autonomous.
def autonomousInit(self):
super().autonomousInit()
self.autoDriveStraightPID.start()
# This runs in a loop throughout autonomous.
def autonomousPeriodic(self):
super().autonomousPeriodic()
# This runs at the beginning of teleop.
def teleopInit(self):
super().teleopInit()
# Start all teleop controls.
self.teleDrive.start()
self.teleElevate.start()
# This runs in a loop throughout teleop.
def teleopPeriodic(self):
super().teleopPeriodic()
# Proprietary robotpy nonsense.
if __name__ == "__main__":
wpilib.run(MyRobot)