Evil Racoon Man is here to steal your trash

This commit is contained in:
Team578 Driver Station 2026-04-11 13:34:59 -04:00
parent b45ab87b34
commit 75cb1bb439
3 changed files with 21 additions and 13 deletions

View File

@ -99,7 +99,8 @@
], ],
"robotJoysticks": [ "robotJoysticks": [
{ {
"guid": "Keyboard0" "guid": "78696e70757401000000000000000000",
"useGamepad": true
} }
] ]
} }

View File

@ -84,7 +84,7 @@ public class RobotContainer {
m_driverController.y().whileTrue(new RelayCommand(hopperSubsystem, turretSubsystem, intakeSubsystem)); m_driverController.y().whileTrue(new RelayCommand(hopperSubsystem, turretSubsystem, intakeSubsystem));
m_driverController.start().whileTrue(intakeSubsystem.resetDeploy()); m_driverController.start().whileTrue(intakeSubsystem.resetDeploy());
m_driverController.x().toggleOnTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem)); m_driverController.x().toggleOnTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
m_driverController.b().toggleOnTrue(new ZoneCheck()); m_driverController.b().toggleOnTrue(new ZoneCheck(driveSubsystem));
} }
/** /**

View File

@ -9,20 +9,27 @@ import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.DriverStation.Alliance; import edu.wpi.first.wpilibj.DriverStation.Alliance;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants; import frc.robot.Constants;
import frc.robot.subsystems.DriveSubsystem;
public class ZoneCheck extends Command { public class ZoneCheck extends Command {
private AprilTagFieldLayout fieldTags = AprilTagFieldLayout.loadField(AprilTagFields.k2026RebuiltWelded);
private Zone zone; private Zone zone;
private DriveSubsystem driveSubsystem;
public ZoneCheck(DriveSubsystem driveSubsystem)
{
this.driveSubsystem = driveSubsystem;
}
public enum Zone { public enum Zone {
Blue, Blue,
Red, Red,
Neutral; Neutral,
INIT;
} }
@Override @Override
public void initialize() { public void initialize() {
zone = Zone.INIT;
} }
@Override @Override
@ -36,8 +43,10 @@ public class ZoneCheck extends Command {
System.out.println("Im Home"); System.out.println("Im Home");
case Neutral: case Neutral:
System.out.println("Uhhhhhhhh not red"); System.out.println("Uhhhhhhhh not red");
default: case Red:
System.out.println("BOOOOO, BOOOO RED"); System.out.println("BOOOOO, BOOOO RED");
default:
System.out.println("Where am I :(");
} }
} else { } else {
switch (zone) { switch (zone) {
@ -45,8 +54,10 @@ public class ZoneCheck extends Command {
System.out.println("Screw Blue"); System.out.println("Screw Blue");
case Neutral: case Neutral:
System.out.println("Uhhhhhhhh not red"); System.out.println("Uhhhhhhhh not red");
case Red:
System.out.println("BOOOOO, BOOOO RED");
default: default:
System.out.println("Im Home"); System.out.println("Where am I :(");
} }
} }
}); });
@ -57,14 +68,10 @@ public class ZoneCheck extends Command {
return false; return false;
} }
private double[] getBotPose() {
return LimelightHelpers.getBotPose_wpiBlue(Constants.CameraConstanst.BACK_CAMERA_NAME);
}
private void getZone() { private void getZone() {
if (getBotPose()[0] >= Constants.CameraConstanst.RED_ZONE_COOR[0]) { if (driveSubsystem.getBotPose().getX() >= Constants.CameraConstanst.RED_ZONE_COOR[0]) {
zone = Zone.Red; zone = Zone.Red;
} else if (getBotPose()[0] >= Constants.CameraConstanst.NEUTRAL_ZONE_COOR[0]) { } else if (driveSubsystem.getBotPose().getX() >= Constants.CameraConstanst.NEUTRAL_ZONE_COOR[0]) {
zone = Zone.Neutral; zone = Zone.Neutral;
} else { } else {
zone = Zone.Blue; zone = Zone.Blue;