Cleaned up more ICamera related junk, which is no longer needed now that the definitions of the get yaw and pitch methods in IAprilTagProvider have changed

This commit is contained in:
Bradley Bickford 2024-01-15 16:31:16 -05:00
parent dd39baf182
commit f26c9e76c2
4 changed files with 6 additions and 47 deletions

View File

@ -96,8 +96,7 @@ public class RobotContainer {
primary::getLeftX,
primary::getLeftY,
OIConstants.kTeleopDriveDeadband,
ampTagID,
960 // TODO This is a guess, the vision system should be an ICamera and this should be vision.getWidth()
ampTagID
).until(
() -> MathUtil.applyDeadband(primary.getRightX(), OIConstants.kTeleopDriveDeadband) != 0
)
@ -109,8 +108,7 @@ public class RobotContainer {
primary::getLeftX,
primary::getLeftY,
OIConstants.kTeleopDriveDeadband,
sourceTagID,
960 // TODO This is a guess, the vision system should be an ICamera and this should be vision.getWidth()
sourceTagID
).until(
() -> MathUtil.applyDeadband(primary.getRightX(), OIConstants.kTeleopDriveDeadband) != 0
)
@ -122,8 +120,7 @@ public class RobotContainer {
primary::getLeftX,
primary::getLeftY,
OIConstants.kTeleopDriveDeadband,
speakerTag,
960 // TODO This is a guess, the vision system should be an ICamera and this should be vision.getWidth()
speakerTag
).until(
() -> MathUtil.applyDeadband(primary.getRightX(), OIConstants.kTeleopDriveDeadband) != 0
)

View File

@ -1,21 +0,0 @@
package frc.robot.interfaces;
/**
* An interface which ensures a class can provide common camera
* properties in a consistent way
*/
public interface ICamera {
/**
* Retrieves the width of the camera's resolution
*
* @return The width of the resolution, in pixels
*/
public double getWidth();
/**
* Retrieves the height of the camera's resolution
*
* @return The height of the resolution, in pixels
*/
public double getHeight();
}

View File

@ -315,7 +315,7 @@ public class Drivetrain extends SubsystemBase {
this);
}
public Command driveAprilTagLock(DoubleSupplier xSpeed, DoubleSupplier ySpeed, double deadband, int tagID, double cameraHorizontalResolution) {
public Command driveAprilTagLock(DoubleSupplier xSpeed, DoubleSupplier ySpeed, double deadband, int tagID) {
if (m_aprilTagProvider == null) {
return new PrintCommand("No AprilTag Provider Available");
}

View File

@ -12,17 +12,15 @@ import org.photonvision.PhotonUtils;
import org.photonvision.PhotonPoseEstimator.PoseStrategy;
import org.photonvision.targeting.PhotonPipelineResult;
import org.photonvision.targeting.PhotonTrackedTarget;
import org.photonvision.targeting.TargetCorner;
import edu.wpi.first.apriltag.AprilTagFieldLayout;
import edu.wpi.first.apriltag.AprilTagFields;
import edu.wpi.first.math.geometry.Transform3d;
import edu.wpi.first.math.util.Units;
import frc.robot.interfaces.IAprilTagProvider;
import frc.robot.interfaces.ICamera;
import frc.robot.interfaces.IVisualPoseProvider;
public class PhotonVision implements ICamera,IAprilTagProvider,IVisualPoseProvider {
public class PhotonVision implements IAprilTagProvider,IVisualPoseProvider {
private final PhotonCamera camera;
@ -30,11 +28,8 @@ public class PhotonVision implements ICamera,IAprilTagProvider,IVisualPoseProvid
private final double cameraHeightMeters;
private final double cameraPitchRadians;
private final double cameraWidth;
private final double cameraHeight;
public PhotonVision(String cameraName, Transform3d robotToCam, double cameraHeightMeters, double cameraPitchRadians,
double cameraWidth, double cameraHeight) throws IOException {
public PhotonVision(String cameraName, Transform3d robotToCam, double cameraHeightMeters, double cameraPitchRadians) throws IOException {
camera = new PhotonCamera(cameraName);
photonPoseEstimator = new PhotonPoseEstimator(
@ -48,18 +43,6 @@ public class PhotonVision implements ICamera,IAprilTagProvider,IVisualPoseProvid
this.cameraHeightMeters = cameraHeightMeters;
this.cameraPitchRadians = cameraPitchRadians;
this.cameraWidth = cameraWidth;
this.cameraHeight = cameraHeight;
}
@Override
public double getWidth() {
return cameraWidth;
}
@Override
public double getHeight() {
return cameraHeight;
}
@Override