2222import frc .robot .commands .elevator .JogElevatorCommand ;
2323import frc .robot .commands .elevator .SetElevatorPositionCommand ;
2424import frc .robot .commands .elevator .ZeroElevatorCommand ;
25+ import frc .robot .commands .robotState .ScoreReefManualCommand ;
26+ import frc .robot .commands .robotState .SetScoringLevelCommand ;
27+ import frc .robot .commands .robotState .StowCommand ;
2528import frc .robot .constants .ElevatorConstants ;
2629import frc .robot .constants .RobotConstants ;
2730import frc .robot .controllers .FlyskyJoystick ;
2831import frc .robot .controllers .FlyskyJoystick .Button ;
2932import frc .robot .subsystems .algae .AlgaeIOFX ;
3033import frc .robot .subsystems .algae .AlgaeSubsystem ;
34+ import frc .robot .subsystems .battMon .BattMonSubsystem ;
35+ import frc .robot .subsystems .biscuit .BiscuitIOFX ;
36+ import frc .robot .subsystems .biscuit .BiscuitSubsystem ;
37+ import frc .robot .subsystems .climb .ClimbSubsystem ;
3138import frc .robot .subsystems .coral .CoralIO ;
3239import frc .robot .subsystems .coral .CoralIOFX ;
3340import frc .robot .subsystems .coral .CoralSubsystem ;
3643import frc .robot .subsystems .elevator .ElevatorIO ;
3744import frc .robot .subsystems .elevator .ElevatorIOFX ;
3845import frc .robot .subsystems .elevator .ElevatorSubsystem ;
46+ import frc .robot .subsystems .funnel .FunnelIOFXS ;
47+ import frc .robot .subsystems .funnel .FunnelSubsystem ;
48+ import frc .robot .subsystems .led .LEDIO ;
49+ import frc .robot .subsystems .led .LEDSubsystem ;
50+ import frc .robot .subsystems .robotState .RobotStateSubsystem ;
51+ import frc .robot .subsystems .robotState .RobotStateSubsystem .ScoringLevel ;
52+ import frc .robot .subsystems .tagAlign .TagAlignSubsystem ;
53+ import frc .robot .subsystems .vision .VisionSubsystem ;
3954import org .strykeforce .telemetry .TelemetryController ;
4055import org .strykeforce .telemetry .TelemetryService ;
4156
4257public class RobotContainer {
58+ private final RobotStateSubsystem robotStateSubsystem ;
4359
44- private ElevatorIO elevatorIO ;
45- private ElevatorSubsystem elevatorSubsystem ;
60+ private final AlgaeIOFX algaeIO ;
61+ private final AlgaeSubsystem algaeSubsystem ;
62+
63+ private final BattMonSubsystem battMonSubsystem ;
64+
65+ private final BiscuitIOFX biscuitIO ;
66+ private final BiscuitSubsystem biscuitSubsystem ;
67+
68+ private final ClimbSubsystem climbSubsystem ;
4669
4770 private final CoralIO coralIO ;
4871 private final CoralSubsystem coralSubsystem ;
4972
50- private AlgaeIOFX algaeIO ;
51- private AlgaeSubsystem algaeSubsystem ;
73+ private final Swerve swerve ;
74+ private final DriveSubsystem driveSubsystem ;
75+
76+ private final ElevatorIO elevatorIO ;
77+ private final ElevatorSubsystem elevatorSubsystem ;
78+
79+ private final FunnelIOFXS funnelIO ;
80+ private final FunnelSubsystem funnelSubsystem ;
5281
53- private Swerve swerve ;
54- private DriveSubsystem driveSubsystem ;
82+ private final LEDIO ledIO ;
83+ private final LEDSubsystem ledSubsystem ;
84+
85+ private final TagAlignSubsystem tagAlignSubsystem ;
86+
87+ private final VisionSubsystem visionSubsystem ;
5588
5689 private final XboxController xboxController = new XboxController (1 );
5790 private final Joystick driveJoystick = new Joystick (0 );
58-
5991 private final FlyskyJoystick flysky = new FlyskyJoystick (driveJoystick );
92+
6093 private final TelemetryService telemetryService = new TelemetryService (TelemetryController ::new );
6194
6295 public RobotContainer () {
96+
6397 algaeIO = new AlgaeIOFX ();
6498 algaeSubsystem = new AlgaeSubsystem (algaeIO );
6599
66- swerve = new Swerve ();
67- driveSubsystem = new DriveSubsystem (swerve );
100+ battMonSubsystem = new BattMonSubsystem ();
101+
102+ biscuitIO = new BiscuitIOFX ();
103+ biscuitSubsystem = new BiscuitSubsystem (biscuitIO );
104+
105+ climbSubsystem = new ClimbSubsystem ();
68106
69107 coralIO = new CoralIOFX ();
70108 coralSubsystem = new CoralSubsystem (coralIO );
71109
110+ swerve = new Swerve ();
111+ driveSubsystem = new DriveSubsystem (swerve );
112+
72113 elevatorIO = new ElevatorIOFX ();
73114 elevatorSubsystem = new ElevatorSubsystem (elevatorIO );
74115
116+ funnelIO = new FunnelIOFXS ();
117+ funnelSubsystem = new FunnelSubsystem (funnelIO );
118+
119+ ledIO = new LEDIO ();
120+ ledSubsystem = new LEDSubsystem ();
121+
122+ visionSubsystem = new VisionSubsystem ();
123+
124+ tagAlignSubsystem = new TagAlignSubsystem (driveSubsystem , visionSubsystem );
125+
126+ robotStateSubsystem =
127+ new RobotStateSubsystem (
128+ algaeSubsystem ,
129+ battMonSubsystem ,
130+ biscuitSubsystem ,
131+ climbSubsystem ,
132+ coralSubsystem ,
133+ driveSubsystem ,
134+ elevatorSubsystem ,
135+ funnelSubsystem ,
136+ ledSubsystem ,
137+ tagAlignSubsystem ,
138+ visionSubsystem );
139+
140+ driveSubsystem .setRobotStateSubsystem (robotStateSubsystem );
141+
75142 configureTelemetry ();
76143 configureDriverBindings ();
77144 configureOperatorBindings ();
78145 }
79146
80147 private void configureTelemetry () {
81- telemetryService . register ( driveSubsystem );
82- telemetryService . register ( coralSubsystem );
83- telemetryService . register ( algaeSubsystem );
84- telemetryService . register ( elevatorSubsystem );
85- elevatorIO .registerWith (telemetryService );
148+ driveSubsystem . registerWith ( telemetryService );
149+ coralSubsystem . registerWith ( telemetryService );
150+ algaeSubsystem . registerWith ( telemetryService );
151+ elevatorSubsystem . registerWith ( telemetryService );
152+ funnelSubsystem .registerWith (telemetryService );
86153 telemetryService .start ();
87154 }
88155
@@ -93,9 +160,33 @@ private void configureDriverBindings() {
93160
94161 // Reset Gyro Command
95162 new JoystickButton (driveJoystick , Button .M_SWC .id ).onTrue (new ResetGyroCommand (driveSubsystem ));
163+ new JoystickButton (driveJoystick , Button .M_SWH .id )
164+ .onTrue (new ScoreReefManualCommand (robotStateSubsystem , elevatorSubsystem , coralSubsystem ));
96165 }
97166
98167 private void configureOperatorBindings () {
168+ // Set Levels
169+ new Trigger (() -> xboxController .getLeftTriggerAxis () > RobotConstants .kTriggerDeadband )
170+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L1 ));
171+ new JoystickButton (xboxController , XboxController .Button .kLeftBumper .value )
172+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L2 ));
173+ new JoystickButton (xboxController , XboxController .Button .kRightBumper .value )
174+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L3 ));
175+ new Trigger (() -> xboxController .getRightTriggerAxis () > RobotConstants .kTriggerDeadband )
176+ .onTrue (new SetScoringLevelCommand (robotStateSubsystem , ScoringLevel .L4 ));
177+
178+ // Stow
179+ new JoystickButton (xboxController , XboxController .Button .kBack .value )
180+ .onTrue (
181+ new StowCommand (
182+ robotStateSubsystem , elevatorSubsystem , coralSubsystem , biscuitSubsystem ));
183+
184+ // zero elevator, slated for removal
185+ new JoystickButton (xboxController , XboxController .Button .kX .value )
186+ .onTrue (new ZeroElevatorCommand (elevatorSubsystem ));
187+ }
188+
189+ private void configureTestOperatorBindings () {
99190 // Stop Coral
100191 new JoystickButton (xboxController , XboxController .Button .kB .value )
101192 .onTrue (new OpenLoopCoralCommand (coralSubsystem , 0 ));
0 commit comments