This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.py
executable file
·67 lines (48 loc) · 1.73 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
#!/usr/bin/env python3
from wpilib.command import Command
Command.isFinished = lambda x: False
from commandbased import CommandBasedRobot
from wpilib._impl.main import run
from wpilib import RobotBase
#from custom import driverhud
import controller.layout
import subsystems
import shutil, sys
from wpilib.command import Subsystem
from subsystems.monitor import Monitor as monitor
from subsystems.potentiometer import PotentiometerInterface as potentiometer
from subsystems.motors import Motors as motors
class KryptonBot(CommandBasedRobot):
'''Implements a Command Based robot design'''
def robotInit(self):
'''Set up everything we need for a working robot.'''
if RobotBase.isSimulation():
import mockdata
self.subsystems()
controller.layout.init()
#driverhud.init()
from commands.startupcommandgroup import StartUpCommandGroup
StartUpCommandGroup().start()
def autonomousInit(self):
'''This function is called each time autonomous mode starts.'''
pass
# Send field data to the dashboard
# Schedule the autonomous command
def handleCrash(self, error):
super().handleCrash()
pass
@classmethod
def subsystems(cls):
vars = globals()
module = sys.modules['robot']
for key, var in vars.items():
try:
if issubclass(var, Subsystem) and var is not Subsystem:
setattr(module, key, var())
except TypeError:
pass
if __name__ == '__main__':
if len(sys.argv) > 1 and sys.argv[1] == 'deploy':
shutil.rmtree('opkg_cache', ignore_errors=True)
shutil.rmtree('pip_cache', ignore_errors=True)
run(KryptonBot)