-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrobotcontainer.py
39 lines (28 loc) · 1.26 KB
/
robotcontainer.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
import commands2
import ctre
import wpilib
import constants
from commands.drive_by_guitar import DriveByGuitar
from commands.drive_straight import DriveStraight
from subsystems.drivetrain import Drivetrain
from guitar import Guitar
class RobotContainer:
def __init__(self) -> None:
self.driverController = Guitar(constants.kdriverControllerPort)
self.frontLeft = ctre.TalonFX(constants.kfrontLeft)
self.backLeft = ctre.TalonFX(constants.kbackLeft)
self.frontRight = ctre.TalonFX(constants.kfrontRight)
self.backRight = ctre.TalonFX(constants.kbackRight)
self.timer = wpilib.Timer
# subsystems
self.drive = Drivetrain()
# chooser
self.chooser = wpilib.SendableChooser()
# Add commands to autonomous command chooser
self.driveStraight = DriveStraight(self.drive, constants.kdistanceToTravel)
self.chooser.setDefaultOption("Drive Straight", self.driveStraight)
wpilib.SmartDashboard.putData("Autonomous", self.chooser)
# ARCADE, OBJECTIVELY WAY BETTER - Pickle_Face5 & Wyatt
self.drive.setDefaultCommand(DriveByGuitar(self.drive, self.driverController))
def getAutonomousCommand(self) -> commands2.Command:
return self.chooser.getSelected()