Skip to content

Commit ad67911

Browse files
committed
removed unused code
1 parent 32b7401 commit ad67911

File tree

2 files changed

+3
-53
lines changed

2 files changed

+3
-53
lines changed

src/main/java/frc/robot/commands/PathDriveCommand.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ protected IterativeTargetPoseSupplier targetPoseSupplier() {
151151

152152
/**
153153
* An {@code IterativeTargetPoseSupplier} is a {@code Supplier<Pose2d>} that
154-
* iterates over a number of {@code Supplier<Pose2d>}.
154+
* iterates over a number of {@code Supplier<Pose2d>}s.
155155
* The {@link get()} method of an {@code IterativeTargetPoseSupplier} returns
156156
* the {@code Pose2d} from the current {@code Supplier<Pose2d>} in iteration.
157157
*/
@@ -164,8 +164,7 @@ static class IterativeTargetPoseSupplier implements Supplier<Pose2d> {
164164
List<Supplier<Pose2d>> m_targetPoseSuppliers;
165165

166166
/**
167-
* The index indicating the current {@code Pose2d} to which the robot
168-
* should move.
167+
* The index indicating the current {@code Supplier<Pose2d>} in iteration.
169168
*/
170169
protected int m_targetPoseIndex = 0;
171170

src/main/java/frc/robot/subsystems/PoseEstimationSubsystem.java

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,6 @@ public Pose2d closestTagPose(double angleOfCoverageInDegrees, double distanceThr
176176
return i == null ? null : kFieldLayout.getTagPose(i).get().toPose2d();
177177
}
178178

179-
/**
180-
* Finds the {@code Pose2d} of the {@code AprilTag} that is closest (in terms of
181-
* angular displacement) to the robot when the specified {@code Translation2d}
182-
* is applied to the robot.
183-
*
184-
* @param translation a {@code Translation2d}
185-
* @param distanceThresholdInMeters the maximum distance (in meters) within
186-
* which {@code AprilTag}s are considered
187-
* @return the {@code Pose2d} of the {@code AprilTag} that is closest (in terms
188-
* of angular displacement) to the robot when the specified
189-
* {@code Translation2d} is applied to the robot
190-
*/
191-
public Pose2d closestTagPose(Translation2d translation, double distanceThresholdInMeters) {
192-
var pose = getEstimatedPose();
193-
if (translation.getNorm() > 0)
194-
pose = new Pose2d(pose.getTranslation(), translation.getAngle());
195-
var i = closestTagID(pose, distanceThresholdInMeters);
196-
return i == null ? null : kFieldLayout.getTagPose(i).get().toPose2d();
197-
}
198-
199179
/**
200180
* Determines the ID of the {@code AprilTag} that is closest to the specified
201181
* {@code Pose2d} ({@code null} if no such {@code AprilTag}).
@@ -227,35 +207,6 @@ public static Integer closestTagID(Pose2d pose, double angleOfCoverageInDegrees,
227207
return null;
228208
}
229209

230-
/**
231-
* Determines the ID of the {@code AprilTag} that is closest (in terms of
232-
* angular displacement) to the specified {@code Pose2d} ({@code null} if no
233-
* such {@code AprilTag}).
234-
*
235-
* @param pose a {@code Pose2d}
236-
* @param distanceThresholdInMeters the maximum distance (in meters) within
237-
* which {@code AprilTag}s are considered
238-
* @return the ID of the {@code AprilTag} that is closest (in terms of angular
239-
* displacement) to the specified {@code Pose2d} ({@code null} if no
240-
* such {@code AprilTag})
241-
*/
242-
public static Integer closestTagID(Pose2d pose, double distanceThresholdInMeters) {
243-
var s = kFieldLayout.getTags().stream()
244-
// consider only the tags facing toward the robot
245-
.filter(
246-
t -> Math.abs(
247-
t.pose.getTranslation().toTranslation2d().minus(pose.getTranslation()).getAngle()
248-
.minus(t.pose.toPose2d().getRotation()).getDegrees()) > 90)
249-
.filter(t -> Math.abs(translationalDisplacement(pose, t.pose.toPose2d())) < distanceThresholdInMeters)
250-
// only tags sufficently close
251-
.map(t -> Map.entry(t.ID, Math.abs(angularDisplacement(pose, t.pose.toPose2d()).getDegrees())));
252-
Optional<Entry<Integer, Double>> closest = s.reduce((e1, e2) -> e1.getValue() < e2.getValue() ? e1 : e2);
253-
if (closest.isPresent()) {
254-
return closest.get().getKey();
255-
} else
256-
return null;
257-
}
258-
259210
/**
260211
* Calculates the angular displacement from the estimated {@code Pose2d} of the
261212
* robot to the specified {@code AprilTag}.
@@ -266,7 +217,7 @@ public static Integer closestTagID(Pose2d pose, double distanceThresholdInMeters
266217
*/
267218
public Rotation2d angularDisplacement(int tagID) {
268219
try {
269-
return angularDisplacement(this.getEstimatedPose(), kFieldLayout.getTagPose(tagID).get().toPose2d());
220+
return angularDisplacement(getEstimatedPose(), kFieldLayout.getTagPose(tagID).get().toPose2d());
270221
} catch (Exception e) {
271222
return null;
272223
}

0 commit comments

Comments
 (0)