Skip to content

Commit 0155da6

Browse files
committed
daniel was here
1 parent dd97944 commit 0155da6

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public static Command lookAt(
171171
// Construct command
172172
return Commands.run(
173173
() -> {
174+
174175
// Get linear velocity
175176
Translation2d linearVelocity =
176177
getLinearVelocityFromJoysticks(xSupplier.getAsDouble(), ySupplier.getAsDouble());

src/main/java/frc/robot/subsystems/vision/Vision.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@
1717
import edu.wpi.first.math.numbers.N1;
1818
import edu.wpi.first.math.numbers.N3;
1919
import edu.wpi.first.wpilibj.Alert;
20+
import edu.wpi.first.wpilibj.DriverStation;
2021
import edu.wpi.first.wpilibj.Alert.AlertType;
22+
import edu.wpi.first.wpilibj2.command.PrintCommand;
2123
import edu.wpi.first.wpilibj2.command.SubsystemBase;
2224
import frc.robot.subsystems.vision.VisionIO.PoseObservationType;
2325
import java.util.LinkedList;
2426
import java.util.List;
2527
import org.littletonrobotics.junction.Logger;
28+
import org.w3c.dom.ranges.DocumentRange;
2629

2730
public class Vision extends SubsystemBase {
2831
private final VisionConsumer consumer;
@@ -55,18 +58,13 @@ public Vision(VisionConsumer consumer, VisionIO... io) {
5558
* @param cameraIndex The index of the camera to use.
5659
*/
5760
public Rotation2d getTargetX(int cameraIndex) {
58-
// Add tag poses
59-
//for (int c = 0; c < 2; c++) {
60-
for (int tagId : inputs[0].tagIds) {
61-
// for (int tagId2 : inputs[1].tagIds) {
62-
63-
var tagPose = aprilTagLayout.getTagPose(tagId);
64-
// if (tagId == cameraIndex) {
65-
// DriverStation.reportWarning(Integer.toString(tagId), false);
66-
return tagPose.get().toPose2d().getRotation();
67-
//}
61+
for (int i: inputs[0].tagIds) {
62+
DriverStation.reportWarning(Integer.toString(i), false);
63+
var tagPose = aprilTagLayout.getTagPose(i);
64+
if (i == cameraIndex) {
65+
return Rotation2d.fromRotations(tagPose.get().getRotation().toRotation2d().getDegrees() * -1 * tagPose.get().getRotation().getX());
66+
}
6867
}
69-
// }
7068
return Rotation2d.kZero;
7169
}
7270

0 commit comments

Comments
 (0)