Skip to content

Commit ad2a59b

Browse files
authored
Merge pull request #66 from strykeforce/statesDrivePractice
States drive practice
2 parents 9078b25 + 181535a commit ad2a59b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1168
-660
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@
5757
"edu.wpi.first.math.**.proto.*",
5858
"edu.wpi.first.math.**.struct.*",
5959
],
60-
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx8G -Xms100m -Xlog:disable"
60+
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx16G -Xms100m -Xlog:disable"
6161
}

src/main/deploy/choreo/CTofetchPSlow.traj

Lines changed: 49 additions & 48 deletions
Large diffs are not rendered by default.

src/main/deploy/choreo/DTofetchPSlow.traj

Lines changed: 48 additions & 48 deletions
Large diffs are not rendered by default.

src/main/deploy/choreo/ETofetchPSlow.traj

Lines changed: 76 additions & 75 deletions
Large diffs are not rendered by default.

src/main/deploy/choreo/JTofetch.traj

Lines changed: 99 additions & 101 deletions
Large diffs are not rendered by default.

src/main/deploy/choreo/fetchPToCSlow.traj

Lines changed: 65 additions & 65 deletions
Large diffs are not rendered by default.

src/main/deploy/choreo/fetchPToDSlow.traj

Lines changed: 69 additions & 68 deletions
Large diffs are not rendered by default.

src/main/deploy/choreo/startToJ.traj

Lines changed: 89 additions & 67 deletions
Large diffs are not rendered by default.

src/main/java/frc/robot/Robot.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public void disabledPeriodic() {
7171
// if (!m_robotContainer.hasSwerveZeroed()) m_robotContainer.zeroSwerve();
7272

7373
m_robotContainer.getAutoSwitch().checkSwitch();
74+
m_robotContainer.updateCanivoreStatus();
75+
m_robotContainer.updateCANErrorCount();
7476
}
7577

7678
@Override

src/main/java/frc/robot/RobotContainer.java

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import edu.wpi.first.units.measure.Angle;
1111
import edu.wpi.first.wpilibj.DriverStation.Alliance;
1212
import edu.wpi.first.wpilibj.Joystick;
13+
import edu.wpi.first.wpilibj.RobotController;
1314
import edu.wpi.first.wpilibj.XboxController;
1415
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
1516
import edu.wpi.first.wpilibj.shuffleboard.SuppliedValueWidget;
@@ -43,14 +44,14 @@
4344
import frc.robot.commands.elevator.ZeroElevatorCommand;
4445
import frc.robot.commands.robotState.AutoReefCycleCommand;
4546
import 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;
4749
import frc.robot.commands.robotState.ForceProcessorCommand;
4850
import frc.robot.commands.robotState.HPAlgaeCommand;
4951
import frc.robot.commands.robotState.InterruptAutoCommand;
5052
import frc.robot.commands.robotState.LockWheelsCommand;
5153
import frc.robot.commands.robotState.OperatorRumbleCommand;
5254
import frc.robot.commands.robotState.ReefCycleCommand;
53-
import frc.robot.commands.robotState.ScoreAlgaeCommand;
5455
import frc.robot.commands.robotState.SetScoreSideCommand;
5556
import frc.robot.commands.robotState.SetScoreSideRightCommand;
5657
import frc.robot.commands.robotState.SetScoringLevelCommand;
@@ -70,6 +71,7 @@
7071
import frc.robot.subsystems.algae.AlgaeIOFX;
7172
import frc.robot.subsystems.algae.AlgaeSubsystem;
7273
import frc.robot.subsystems.auto.AutoSwitch;
74+
import frc.robot.subsystems.battMon.BattMonHardware;
7375
import frc.robot.subsystems.battMon.BattMonSubsystem;
7476
import frc.robot.subsystems.biscuit.BiscuitIOFXS;
7577
import 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

Comments
 (0)