Skip to content

Commit

Permalink
hop to it !
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-Cushman committed Oct 28, 2024
1 parent b6a2005 commit 7be869f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/main/java/frc/robot/subsystems/vision/Limelight.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import frc.robot.util.Constants.CameraConstants;
import frc.robot.util.Constants.FieldConstants;
import frc.robot.util.calc.LimelightHelpers;
import frc.robot.util.calc.PoseCalculations;
import frc.robot.util.calc.LimelightHelpers.LimelightTarget_Fiducial;
import frc.robot.util.calc.LimelightHelpers.Results;

Expand Down Expand Up @@ -309,7 +310,9 @@ public boolean hasTarget() {
double singleTagAreaThreshold =
Robot.gameMode == GameMode.AUTONOMOUS
? CameraConstants.LIMELIGHT_3G_SINGLE_TA_CUTOFF_AUTO
: CameraConstants.LIMELIGHT_3G_SINGLE_TA_CUTOFF_TELE;
: PoseCalculations.onOppositeSide(robotPoseSupplier.get().getX())
? CameraConstants.LIMELIGHT_3G_SINGLE_TA_CUTOFF_TELE_PASS
: CameraConstants.LIMELIGHT_3G_SINGLE_TA_CUTOFF_TELE;

double doubleTagAreaThreshold =
Robot.gameMode == GameMode.AUTONOMOUS
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,7 @@ public static final class CameraConstants {

public static final double LIMELIGHT_3G_SINGLE_TA_CUTOFF_AUTO = 0.175;
public static final double LIMELIGHT_3G_SINGLE_TA_CUTOFF_TELE = 0.141;
public static final double LIMELIGHT_3G_SINGLE_TA_CUTOFF_TELE_PASS = 0.09;

public static final Pose3d LL3Pose =
new Pose3d(
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/util/auto/PathPlannerStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ private Command generateCenterDefaultCommand(int i, int endingNote, boolean goin
NamedCommands.getCommand("PrepareSWD")
),
NamedCommands.getCommand("ShootInstantlyWhenReady")
).onlyIf(() -> shooterSensor.getAsBoolean() || elevatorSensor.getAsBoolean()),
),
commandGroup.getRequirements());
}

Expand Down
16 changes: 14 additions & 2 deletions src/main/java/frc/robot/util/calc/PoseCalculations.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ private static double getChainIntercept(double x) {
return MathUtil.clamp(calculation, 0.725, ClimbConstants.EXTENSION_LIMIT_METERS);
}

/**
* Detects if the robot is in the opposite wing
* Uses the robot's x position to determine if it has crossed the opp wing line.
*
* @return true if the robot is in the opposing wing
*/
public static boolean onOppositeWing(double xPosition) {
return Robot.isRedAlliance()
? xPosition < FieldConstants.BLUE_WING_X
: xPosition > FieldConstants.RED_WING_X;
}

/**
* Detects if the robot is on the opposite side of the field.
* Uses the robot's x position to determine if it has crossed the centerline.
Expand All @@ -111,8 +123,8 @@ private static double getChainIntercept(double x) {
*/
public static boolean onOppositeSide(double xPosition) {
return Robot.isRedAlliance()
? xPosition < FieldConstants.BLUE_WING_X
: xPosition > FieldConstants.RED_WING_X;
? xPosition < FieldConstants.CENTERLINE_X
: xPosition > FieldConstants.CENTERLINE_X;
}

// Note: this method uses a static variable rather than a parameter
Expand Down

0 comments on commit 7be869f

Please sign in to comment.