|
22 | 22 | import frc.robot.DeviceIDs.controllerIDs; |
23 | 23 | import frc.robot.commands.AddVisionMeasurement; |
24 | 24 | import frc.robot.commands.ResetPose; |
25 | | -import frc.robot.commands.states.Intaking; |
26 | | -import frc.robot.commands.states.RetractIntake; |
27 | | -import frc.robot.commands.states.Shooting; |
28 | 25 | import frc.robot.constants.ConstSystem; |
29 | 26 | import frc.robot.constants.ConstSystem.constControllers; |
30 | 27 | import frc.robot.subsystems.DriverStateMachine; |
@@ -59,16 +56,48 @@ public class RobotContainer { |
59 | 56 | private final StateMachine loggedStateMachineInstance = stateMachineInstance; |
60 | 57 | public static final RobotPoses robotPose = new RobotPoses(); |
61 | 58 | private final RobotPoses loggedRobotPose = robotPose; |
62 | | - public static final Intaking intaking = new Intaking(); |
63 | | - public static final RetractIntake retracting = new RetractIntake(); |
| 59 | + |
64 | 60 | public static final Vision visionInstance = new Vision(); |
65 | 61 | private final Vision loggedVisionInstance = visionInstance; |
66 | 62 | public static final Telemetry telemetryInstance = new Telemetry(); |
67 | 63 | private final Telemetry loggedTelemetryInstance = telemetryInstance; |
68 | | - public static final Shooting shooting = new Shooting(); |
69 | 64 | public static final ResetPose resetPose = new ResetPose(); |
70 | | - Command TRY_NONE = Commands.deferredProxy( |
71 | | - () -> stateMachineInstance.tryState(RobotState.NONE)); |
| 65 | + |
| 66 | + Command TRY_INTAKING = Commands.deferredProxy( |
| 67 | + () -> stateMachineInstance.tryState(RobotState.INTAKING)); |
| 68 | + |
| 69 | + Command TRY_SHOOTING = Commands.deferredProxy( |
| 70 | + () -> stateMachineInstance.tryState(RobotState.SHOOTING)); |
| 71 | + |
| 72 | + Command TRY_EJECTING_HOPPER = Commands.deferredProxy( |
| 73 | + () -> stateMachineInstance.tryState(RobotState.EJECTING_HOPPER)); |
| 74 | + |
| 75 | + Command TRY_REVERSING_SHOOTER = Commands.deferredProxy( |
| 76 | + () -> stateMachineInstance.tryState(RobotState.REVERSING_SHOOTER)); |
| 77 | + |
| 78 | + Command TRY_PREPANYWHERE = Commands.deferredProxy( |
| 79 | + () -> stateMachineInstance.tryState(RobotState.PREP_ANYWHERE)); |
| 80 | + |
| 81 | + Command TRY_PREPTRENCH = Commands.deferredProxy( |
| 82 | + () -> stateMachineInstance.tryState(RobotState.PREP_TRENCH)); |
| 83 | + |
| 84 | + Command TRY_PREPNEAUTRALTOALLIANCE = Commands.deferredProxy( |
| 85 | + () -> stateMachineInstance.tryState(RobotState.PREP_NEUTRAL_TO_ALLIANCE)); |
| 86 | + |
| 87 | + Command TRY_PREPOPPONENTOALLIANCE = Commands.deferredProxy( |
| 88 | + () -> stateMachineInstance.tryState(RobotState.PREP_OPPONENT_TO_ALLIANCE)); |
| 89 | + |
| 90 | + Command TRY_PREPTOWER = Commands.deferredProxy( |
| 91 | + () -> stateMachineInstance.tryState(RobotState.PREP_TOWER)); |
| 92 | + |
| 93 | + Command TRY_PREPHUB = Commands.deferredProxy( |
| 94 | + () -> stateMachineInstance.tryState(RobotState.PREP_HUB)); |
| 95 | + |
| 96 | + Command TRY_PREPCORNER = Commands.deferredProxy( |
| 97 | + () -> stateMachineInstance.tryState(RobotState.PREP_CORNER)); |
| 98 | + |
| 99 | + Command TRY_RETRACTING = Commands.deferredProxy( |
| 100 | + () -> stateMachineInstance.tryState(RobotState.PREP_CORNER)); |
72 | 101 |
|
73 | 102 | Command MANUAL = new DeferredCommand( |
74 | 103 | driverStateMachineInstance.tryState( |
@@ -102,16 +131,36 @@ public RobotContainer() { |
102 | 131 | } |
103 | 132 |
|
104 | 133 | private void configDriverBindings() { |
| 134 | + conDriver.btn_LeftTrigger |
| 135 | + .whileTrue(TRY_INTAKING); |
| 136 | + conDriver.btn_RightStick |
| 137 | + .onTrue(TRY_RETRACTING); |
| 138 | + conDriver.btn_South |
| 139 | + .whileTrue(TRY_EJECTING_HOPPER); |
| 140 | + conDriver.btn_East |
| 141 | + .whileTrue(TRY_REVERSING_SHOOTER); |
| 142 | + conDriver.btn_West |
| 143 | + .onTrue(TRY_PREPNEAUTRALTOALLIANCE); |
| 144 | + conDriver.btn_LeftStick |
| 145 | + .onTrue(TRY_PREPOPPONENTOALLIANCE); |
105 | 146 | conDriver.btn_RightTrigger |
106 | | - .whileTrue(intaking); |
| 147 | + .whileTrue(TRY_SHOOTING); |
| 148 | + conDriver.btn_A |
| 149 | + .onTrue(TRY_PREPTRENCH); |
| 150 | + conDriver.btn_B |
| 151 | + .onTrue(TRY_PREPCORNER); |
| 152 | + conDriver.btn_X |
| 153 | + .onTrue(TRY_PREPTOWER); |
| 154 | + conDriver.btn_Y |
| 155 | + .onTrue(TRY_PREPHUB); |
107 | 156 | conDriver.btn_RightBumper |
108 | | - .whileTrue(retracting); |
| 157 | + .onTrue(TRY_PREPANYWHERE); |
| 158 | + |
109 | 159 | // Example Pose Drive |
110 | | - conDriver.btn_X |
111 | | - .whileTrue(EXAMPLE_POSE_DRIVE) |
112 | | - .onFalse(Commands.runOnce(() -> driverStateMachineInstance.setDriverState(DriverState.MANUAL))); |
113 | | - conDriver.btn_LeftTrigger |
114 | | - .whileTrue(shooting); |
| 160 | + // conDriver.btn_X |
| 161 | + // .whileTrue(EXAMPLE_POSE_DRIVE) |
| 162 | + // .onFalse(Commands.runOnce(() -> |
| 163 | + // driverStateMachineInstance.setDriverState(DriverState.MANUAL))); |
115 | 164 | conDriver.btn_North |
116 | 165 | .onTrue(resetPose); |
117 | 166 | } |
|
0 commit comments