File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77import static edu .wpi .first .units .Units .*;
88
9- import edu .wpi .first .apriltag .AprilTagFieldLayout ;
10- import edu .wpi .first .apriltag .AprilTagFields ;
119import edu .wpi .first .math .MathUtil ;
1210import edu .wpi .first .math .geometry .Pose2d ;
1311import edu .wpi .first .math .geometry .Rotation2d ;
1816import edu .wpi .first .wpilibj2 .command .Commands ;
1917import edu .wpi .first .wpilibj2 .command .button .CommandXboxController ;
2018import frc .lib .Telemetry ;
21- import frc .robot .drive .AprilTagTargets ;
2219import frc .robot .drive .Drive ;
2320import frc .robot .drive .DriveFactory ;
2421import frc .robot .elevator .Elevator ;
@@ -59,13 +56,16 @@ private RobotContainer() {
5956
6057 drive = new Drive (DriveFactory .createSwerve ());
6158 drive .setTargetPose (new Pose2d (3.616 , -0.869 , Rotation2d .kZero ));
62- drive .setTargetPose (
63- () ->
64- drive
65- .getPose ()
66- .nearest (
67- AprilTagTargets .blueReefTargets (
68- AprilTagFieldLayout .loadField (AprilTagFields .k2025ReefscapeAndyMark ))));
59+ /*
60+ drive.setTargetPose(
61+ () ->
62+ drive
63+ .getPose()
64+ .nearest(
65+ AprilTagTargets.reefTargets(
66+ AprilTagFieldLayout.loadField(AprilTagFields.k2025ReefscapeAndyMark),
67+ DriverStation.getAlliance())));
68+ */
6969
7070 Telemetry .initializeTabs (elevator , pivot , drive );
7171
Original file line number Diff line number Diff line change 66import edu .wpi .first .math .geometry .Rotation2d ;
77import edu .wpi .first .wpilibj .DriverStation ;
88import java .util .List ;
9+ import java .util .Optional ;
910import java .util .function .Predicate ;
1011
1112public class AprilTagTargets {
@@ -39,10 +40,14 @@ public static List<Pose2d> redReefTargets(AprilTagFieldLayout layout) {
3940 }
4041
4142 public static List <Pose2d > reefTargets (
42- AprilTagFieldLayout layout , DriverStation .Alliance alliance ) {
43- return switch (alliance ) {
44- case Blue -> blueReefTargets (layout );
45- case Red -> redReefTargets (layout );
46- };
43+ AprilTagFieldLayout layout , Optional <DriverStation .Alliance > alliance ) {
44+ return alliance
45+ .map (
46+ value ->
47+ switch (value ) {
48+ case Blue -> blueReefTargets (layout );
49+ case Red -> redReefTargets (layout );
50+ })
51+ .orElseGet (List ::of );
4752 }
4853}
You can’t perform that action at this time.
0 commit comments