Hi. Can somebody see what is wrong here: package frc.robot.subsystems;
import edu.wpi.first.wpilibj;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import com.photonvision.PhotonCamera;
import com.photonvision.targeting.PhotonTrackedTarget;
import edu.wpi.first.util.net.PortForwarder;
public class PhotonVision extends SubsystemBase {
private final PhotonCamera camera;
private PhotonTrackedTarget trackedTarget;
public double yaw;
public double pitch;
public double roll;
public double latency;
public double skew;
public boolean hasTarget;
public PhotonVision() {
camera = new PhotonCamera("Microsoft LifeCam HD-3000");
PortForwarder.add(5800, "photonvision", 5800);
camera.setPipelineIndex(0);
}
public boolean hasTarget() {
return hasTarget;
}
public double getSkew() {
return skew;
}
public double getYaw() {
return yaw;
}
public double getPitch() {
return pitch;
}
public double getRoll() {
return roll;
}
public double getLatency() {
return latency;
}
public void periodic() {
var result = camera.getLatestResult();
hasTarget = result.hasTargets();
if (hasTarget) {
trackedTarget = result.getBestTarget();
yaw = trackedTarget.getYaw();
roll = trackedTarget.getRoll();
pitch = trackedTarget.getPitch();
skew = trackedTarget.getSkew();
}
}
}