import edu.wpi.first.apriltag.AprilTagFields;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.util.Units;
+import edu.wpi.first.wpilibj.DriverStation.Alliance;
+import frc.robot.Robot;
public class FieldConstants {
/** Width of the field [meters] */
public static final AprilTagFieldLayout field = AprilTagFieldLayout.loadField(AprilTagFields.k2026RebuiltWelded);
/** Location of hub target */
- public static final Translation3d HUB_TRANSLATION3D = new Translation3d(Units.inchesToMeters(156.8), 4.035, Units.inchesToMeters(72));
+ public static final Translation3d HUB_BLUE =
+ new Translation3d(Units.inchesToMeters(156.8), 4.035, Units.inchesToMeters(72));
+ public static Translation3d getHubTranslation() {
+ if (Robot.getAlliance() == Alliance.Blue) {
+ return HUB_BLUE;
+ } else {
+ return new Translation3d(
+ field.getFieldLength() - HUB_BLUE.getX(),
+ HUB_BLUE.getY(),
+ HUB_BLUE.getZ()
+ );
+ }
+ }
}
\ No newline at end of file