-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrobot.py
54 lines (40 loc) · 1.72 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
import wpilib
from commandbased import CommandBasedRobot
import subsystems
import oi
from commands.shooter import Shooter
from commands.followjoystick import FollowJoystick
from commands.crossbow import Crossbow
from commands.autojoystick import AutoJoystick
class Marvin(CommandBasedRobot):
"""
This class runs a Command Based architecture, which separates the project
into subsystems and commands. Subsystems are interfaces to provide the
functionality, whereas commands use the functionality.
For more information on Command Based Programming, see `this link`_.
In addition to the methods down below, there are also methods such as
:func:`teleopPeriodic()` and :func:`autonomousPeriodic`.
"""
def robotInit(self):
"""
We use this method to declare the various, high-level objects for the
robot.
For example, we can use the create a CommandGroup object to store the
various process for our robot to run when we enable it.
"""
subsystems.init()
oi.init()
self.teleopProgram = wpilib.command.CommandGroup()
self.teleopProgram.addParallel(FollowJoystick())
self.teleopProgram.addParallel(Shooter())
self.autoProgram = wpilib.command.CommandGroup()
self.autoProgram.addParallel(AutoJoystick())
self.autoProgram.addParallel(Shooter())
self.autoProgram.addSequential(Crossbow(0.55, 0.5))
self.autoProgram.addSequential(Crossbow(-0.75, 1))
def teleopInit(self):
self.teleopProgram.start()
def autonomousInit(self):
self.autoProgram.start()
if __name__ == "__main__":
wpilib.run(Marvin, physics_enabled=True)