-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrobotcontainer.py
More file actions
49 lines (39 loc) · 1.86 KB
/
robotcontainer.py
File metadata and controls
49 lines (39 loc) · 1.86 KB
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
#
# Copyright (c) FIRST and other WPILib contributors.
# Open Source Software; you can modify and/or share it under the terms of
# the WPILib BSD license file in the root directory of this project.
#
import commands2
import commands2.button
import commands2.cmd
from constants import Constants
from subsystems.coralcanon.coralcanon import CoralCanon
class RobotContainer:
"""
This class is where the bulk of the robot should be declared. Since Command-based is a
"declarative" paradigm, very little robot logic should actually be handled in the :class:`.Robot`
periodic methods (other than the scheduler calls). Instead, the structure of the robot (including
subsystems, commands, and button mappings) should be declared here.
"""
def __init__(self) -> None:
self._coral_canon = CoralCanon()
self._joystick = commands2.button.CommandXboxController(
Constants.OperatorIds.DRIVER_PORT
)
# Configure the button bindings
self.configureButtonBindings()
def configureButtonBindings(self) -> None:
"""
Use this method to define your button->command mappings. Buttons can be created by
instantiating a :GenericHID or one of its subclasses (Joystick or XboxController),
and then passing it to a JoystickButton.
"""
self._joystick.a().whileTrue(self._coral_canon.intake_command())
self._joystick.b().whileTrue(self._coral_canon.shoot_command())
self._joystick.y().whileTrue(self._coral_canon.backup_command())
self._joystick.x().whileTrue(self._coral_canon.shoot_L1_command())
def getAutonomousCommand(self) -> commands2.Command:
"""Use this to pass the autonomous command to the main {@link Robot} class.
:returns: the command to run in autonomous
"""
return commands2.cmd.print_("No autonomous command configured")