From: iefomit Date: Thu, 16 Apr 2026 23:32:21 +0000 (-0700) Subject: added null checks X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=5568a764c85224d8937dca7615aa7fd7e14febf9;p=FRC2026.git added null checks for sim to work --- diff --git a/src/main/deploy/pathplanner/autos/New Auto.auto b/src/main/deploy/pathplanner/autos/New Auto.auto deleted file mode 100644 index d4dfd7b..0000000 --- a/src/main/deploy/pathplanner/autos/New Auto.auto +++ /dev/null @@ -1,25 +0,0 @@ -{ - "version": "2025.0", - "command": { - "type": "sequential", - "data": { - "commands": [ - { - "type": "named", - "data": { - "name": "Stop Hood Down" - } - }, - { - "type": "named", - "data": { - "name": null - } - } - ] - } - }, - "resetOdom": true, - "folder": null, - "choreoAuto": false -} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index fa9b0d4..c928267 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -21,6 +21,7 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.CommandScheduler; import edu.wpi.first.wpilibj2.command.InstantCommand; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; +import frc.robot.commands.DoNothing; import frc.robot.commands.LogCommand; import frc.robot.commands.drive_comm.DefaultDriveCommand; import frc.robot.commands.gpm.AutoShootCommand; @@ -165,7 +166,9 @@ public class RobotContainer { // put the Chooser on the SmartDashboard SmartDashboard.putData("Auto chooser", autoChooser); - SmartDashboard.putData("Lock Shooting", new LockedShoot(turret, drive, hood, shooter)); + if (turret != null && drive != null && hood != null && shooter != null) { + SmartDashboard.putData("Lock Shooting", new LockedShoot(turret, drive, hood, shooter)); + } if (turret != null) { turret.setDefaultCommand(new Superstructure(turret, drive, hood, shooter, spindexer)); @@ -175,7 +178,9 @@ public class RobotContainer { CommandScheduler.getInstance().schedule(new BrownOutControl(shooter, spindexer, turret, intake, hood, drive)); } - drive.setDefaultCommand(new DefaultDriveCommand(drive, driver)); + if (drive != null && driver != null) { + drive.setDefaultCommand(new DefaultDriveCommand(drive, driver)); + } break; } @@ -338,6 +343,9 @@ public class RobotContainer { } public Command getDefaultAuto() { + if (spindexer == null || turret == null || hood == null || intake == null) { + return new DoNothing(); + } ParallelCommandGroup defaultShoot = new ParallelCommandGroup( new RunSpindexer(spindexer, turret, hood, intake) );