1010import edu .wpi .first .units .measure .Angle ;
1111import edu .wpi .first .wpilibj .DriverStation .Alliance ;
1212import edu .wpi .first .wpilibj .Joystick ;
13+ import edu .wpi .first .wpilibj .RobotController ;
1314import edu .wpi .first .wpilibj .XboxController ;
1415import edu .wpi .first .wpilibj .shuffleboard .Shuffleboard ;
1516import edu .wpi .first .wpilibj .shuffleboard .SuppliedValueWidget ;
4344import frc .robot .commands .elevator .ZeroElevatorCommand ;
4445import frc .robot .commands .robotState .AutoReefCycleCommand ;
4546import frc .robot .commands .robotState .DepthChargeHealthCheckCommand ;
46- import frc .robot .commands .robotState .FloorAlgaeCommand ;
47+ import frc .robot .commands .robotState .ForceBargeCommand ;
48+ import frc .robot .commands .robotState .ForceLowFloorAlgaeCommand ;
4749import frc .robot .commands .robotState .ForceProcessorCommand ;
4850import frc .robot .commands .robotState .HPAlgaeCommand ;
4951import frc .robot .commands .robotState .InterruptAutoCommand ;
5052import frc .robot .commands .robotState .LockWheelsCommand ;
5153import frc .robot .commands .robotState .OperatorRumbleCommand ;
5254import frc .robot .commands .robotState .ReefCycleCommand ;
53- import frc .robot .commands .robotState .ScoreAlgaeCommand ;
5455import frc .robot .commands .robotState .SetScoreSideCommand ;
5556import frc .robot .commands .robotState .SetScoreSideRightCommand ;
5657import frc .robot .commands .robotState .SetScoringLevelCommand ;
7071import frc .robot .subsystems .algae .AlgaeIOFX ;
7172import frc .robot .subsystems .algae .AlgaeSubsystem ;
7273import frc .robot .subsystems .auto .AutoSwitch ;
74+ import frc .robot .subsystems .battMon .BattMonHardware ;
7375import frc .robot .subsystems .battMon .BattMonSubsystem ;
7476import frc .robot .subsystems .biscuit .BiscuitIOFXS ;
7577import frc .robot .subsystems .biscuit .BiscuitSubsystem ;
@@ -108,6 +110,7 @@ public class RobotContainer {
108110 private final AlgaeIOFX algaeIO ;
109111 private final AlgaeSubsystem algaeSubsystem ;
110112
113+ private final BattMonHardware batMonIO ;
111114 private final BattMonSubsystem battMonSubsystem ;
112115
113116 private final BiscuitIOFXS biscuitIO ;
@@ -142,6 +145,10 @@ public class RobotContainer {
142145
143146 private final AutoSwitch autoSwitch ;
144147
148+ private boolean canivoreStatus = false ;
149+ private int rCanErrors = RobotController .getCANStatus ().receiveErrorCount ;
150+ private int tCanErrors = RobotController .getCANStatus ().transmitErrorCount ;
151+
145152 private final XboxController xboxController = new XboxController (1 );
146153 private final Joystick driveJoystick = new Joystick (0 );
147154 private final FlyskyJoystick flysky = new FlyskyJoystick (driveJoystick );
@@ -161,7 +168,8 @@ public RobotContainer() {
161168 algaeIO = new AlgaeIOFX ();
162169 algaeSubsystem = new AlgaeSubsystem (algaeIO );
163170
164- battMonSubsystem = new BattMonSubsystem ();
171+ batMonIO = new BattMonHardware ();
172+ battMonSubsystem = new BattMonSubsystem (batMonIO );
165173
166174 biscuitIO = new BiscuitIOFXS ();
167175 biscuitSubsystem = new BiscuitSubsystem (biscuitIO );
@@ -347,26 +355,29 @@ private void configureDriverBindings() {
347355 coralSubsystem ,
348356 biscuitSubsystem ,
349357 algaeSubsystem ),
350- () -> robotStateSubsystem .getIsAutoPlacing ()));
358+ () ->
359+ (robotStateSubsystem .getIsAutoPlacing ()
360+ && robotStateSubsystem .getCoralLevel () != ScoringLevel .L1 )));
351361
352362 new JoystickButton (driveJoystick , Button .M_SWE .id )
353363 .onTrue (
354- new ScoreAlgaeCommand (
364+ new ForceBargeCommand (
355365 robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
366+ // new ForceBargeCommand(
367+ // robotStateSubsystem, elevatorSubsystem, biscuitSubsystem, algaeSubsystem)); // for easy
368+ // swapping
369+ Command floorAlgaeCommand =
370+ // new FloorAlgaeCommand(
371+ // robotStateSubsystem, elevatorSubsystem, biscuitSubsystem, algaeSubsystem);
372+ new ForceLowFloorAlgaeCommand (
373+ robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ); // for easy
374+ // swapping
356375 new JoystickButton (driveJoystick , Button .SWF_UP .id )
357- .onTrue (
358- new FloorAlgaeCommand (
359- robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ))
360- .onFalse (
361- new FloorAlgaeCommand (
362- robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
376+ .onTrue (floorAlgaeCommand )
377+ .onFalse (floorAlgaeCommand );
363378 new JoystickButton (driveJoystick , Button .SWF_DWN .id )
364- .onTrue (
365- new FloorAlgaeCommand (
366- robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ))
367- .onFalse (
368- new FloorAlgaeCommand (
369- robotStateSubsystem , elevatorSubsystem , biscuitSubsystem , algaeSubsystem ));
379+ .onTrue (floorAlgaeCommand )
380+ .onFalse (floorAlgaeCommand );
370381
371382 // climb
372383 new JoystickButton (driveJoystick , Button .SWA .id )
@@ -636,6 +647,21 @@ private void configureMatchDashboard() {
636647 .withSize (1 , 1 )
637648 .withPosition (9 , 0 );
638649
650+ Shuffleboard .getTab ("Match" )
651+ .addBoolean ("CANivore Connected" , () -> canivoreStatus )
652+ .withSize (1 , 1 )
653+ .withPosition (2 , 2 );
654+
655+ Shuffleboard .getTab ("Match" )
656+ .addInteger ("CAN Recieve Errors" , () -> rCanErrors )
657+ .withSize (1 , 1 )
658+ .withPosition (3 , 2 );
659+
660+ Shuffleboard .getTab ("Match" )
661+ .addInteger ("CAN Transmit Errors" , () -> tCanErrors )
662+ .withSize (1 , 1 )
663+ .withPosition (4 , 2 );
664+
639665 // Shuffleboard.getTab("Match")
640666 // .addBoolean(
641667 // "Cams Connected",
@@ -799,6 +825,15 @@ public AutoSwitch getAutoSwitch() {
799825 return this .autoSwitch ;
800826 }
801827
828+ public void updateCanivoreStatus () {
829+ this .canivoreStatus = robotStateSubsystem .isCANivoreConnected ();
830+ }
831+
832+ public void updateCANErrorCount () {
833+ rCanErrors = RobotController .getCANStatus ().receiveErrorCount ;
834+ tCanErrors = RobotController .getCANStatus ().transmitErrorCount ;
835+ }
836+
802837 public void disableNoMotionCal () {
803838 if (RobotConstants .isComp ) {
804839 swerve .disableNoMotionCal ();
0 commit comments