}
public Translation2d getTarget(Pose2d drivePose) {
- return wantedState == WantedState.SHOOTING ? FieldConstants.getHubTranslation().toTranslation2d()
- : (FieldConstants.isOnLeftSideOfField(drivePose.getTranslation())
- //TODO: reversed for sm reason
- ? FieldConstants.getAllianceSideTranslation(false).toTranslation2d()
- : FieldConstants.getAllianceSideTranslation(true).toTranslation2d());
+ // return wantedState == WantedState.SHOOTING ? FieldConstants.getHubTranslation().toTranslation2d()
+ // : (FieldConstants.isOnLeftSideOfField(drivePose.getTranslation())
+ // //TODO: reversed for sm reason
+ // ? FieldConstants.getAllianceSideTranslation(false).toTranslation2d()
+ // : FieldConstants.getAllianceSideTranslation(true).toTranslation2d());
+ if (wantedState == WantedState.SHOOTING) {
+ return FieldConstants.getHubTranslation().toTranslation2d();
+ } else {
+ double targetY;
+ if (drivePose.getY() > 4.0) {
+ targetY = FieldConstants.FIELD_WIDTH * 1.5 - drivePose.getY();
+ } {
+ targetY = FieldConstants.FIELD_WIDTH * 0.5 - drivePose.getY();
+ }
+ return new Translation2d(FieldConstants.getAllianceSideTranslation(true).getX(), targetY);
+ }
}
-}
\ No newline at end of file
+}