Add ignored cameras regex to command-line arguemnts (#849)

This adds a regex that ignores cameras if they match it, for if you have another piece of software running that needs a second camera, or if you have a webcam in your laptop that cscore hates.
This commit is contained in:
person4268
2023-06-03 21:04:04 -04:00
committed by GitHub
parent 80f479344d
commit 6d2eae7f20
20 changed files with 78 additions and 14 deletions

View File

@@ -233,7 +233,9 @@ public class PhotonPoseEstimator {
setLastPose(new Pose3d(lastPose));
}
/** @return The current transform from the center of the robot to the camera mount position */
/**
* @return The current transform from the center of the robot to the camera mount position
*/
public Transform3d getRobotToCameraTransform() {
return robotToCamera;
}

View File

@@ -40,7 +40,9 @@ import java.util.Set;
import org.photonvision.targeting.PhotonPipelineResult;
import org.photonvision.targeting.PhotonTrackedTarget;
/** @deprecated Use {@link PhotonPoseEstimator} */
/**
* @deprecated Use {@link PhotonPoseEstimator}
*/
@Deprecated
public class RobotPoseEstimator {
/**
@@ -345,27 +347,37 @@ public class RobotPoseEstimator {
return x.getTranslation().getDistance(y.getTranslation());
}
/** @param aprilTags the aprilTags to set */
/**
* @param aprilTags the aprilTags to set
*/
public void setAprilTags(AprilTagFieldLayout aprilTags) {
this.aprilTags = aprilTags;
}
/** @return the aprilTags */
/**
* @return the aprilTags
*/
public AprilTagFieldLayout getAprilTags() {
return aprilTags;
}
/** @return the strategy */
/**
* @return the strategy
*/
public PoseStrategy getStrategy() {
return strategy;
}
/** @param strategy the strategy to set */
/**
* @param strategy the strategy to set
*/
public void setStrategy(PoseStrategy strategy) {
this.strategy = strategy;
}
/** @return the referencePose */
/**
* @return the referencePose
*/
public Pose3d getReferencePose() {
return referencePose;
}

View File

@@ -36,12 +36,14 @@ public class CameraTargetRelation {
public final double camToTargDistXY;
public final Rotation2d camToTargYaw;
public final Rotation2d camToTargPitch;
/** Angle from the camera's relative x-axis */
public final Rotation2d camToTargAngle;
public final Transform3d targToCam;
public final Rotation2d targToCamYaw;
public final Rotation2d targToCamPitch;
/** Angle from the target's relative x-axis */
public final Rotation2d targToCamAngle;

View File

@@ -99,6 +99,7 @@ public final class OpenCVHelp {
}
return new MatOfPoint3f(points);
}
/**
* Returns a new 3d translation from this {@link Mat}. The opencv tvec is a vector with three
* elements representing {x, y, z} in the EDN coordinate system.
@@ -128,6 +129,7 @@ public final class OpenCVHelp {
rotation = rotationNWUtoEDN(rotation);
return new MatOfPoint3f(new Point3(rotation.getQuaternion().toRotationVector().getData()));
}
/**
* Returns a 3d rotation from this {@link Mat}. The opencv rvec Mat is a vector with three
* elements representing the axis scaled by the angle in the EDN coordinate system. (angle = norm,
@@ -228,6 +230,7 @@ public final class OpenCVHelp {
new Rotation3d(), CoordinateSystem.NWU(), CoordinateSystem.EDN())
.plus(CoordinateSystem.convert(rot, CoordinateSystem.EDN(), CoordinateSystem.NWU()));
}
/**
* Convert a rotation from EDN to NWU. For example, if you have a rotation X,Y,Z {1, 0, 0} in EDN,
* this would be XYZ {0, -1, 0} in NWU.
@@ -324,6 +327,7 @@ public final class OpenCVHelp {
corn.release();
return rect;
}
/**
* Gets the rotated rectangle with minimum area which bounds this contour.
*
@@ -338,6 +342,7 @@ public final class OpenCVHelp {
corn.release();
return rect;
}
/**
* Get the area in pixels of this target's contour. It's important to note that this may be
* different from the area of the bounding rectangle around the contour.
@@ -451,6 +456,7 @@ public final class OpenCVHelp {
if (alt != null) return new PNPResults(best, alt, errors[0] / errors[1], errors[0], errors[1]);
else return new PNPResults(best, errors[0]);
}
/**
* Finds the transformation that maps the camera's pose to the target pose. The camera's pose
* relative to the target is determined by the supplied 3d points of the target's model and their

View File

@@ -44,8 +44,10 @@ public class PNPResults {
* to the best solution.
*/
public final Transform3d alt;
/** If no alternate solution is found, this is bestReprojErr */
public final double altReprojErr;
/** If no alternate solution is found, this is 0 */
public final double ambiguity;

View File

@@ -41,6 +41,7 @@ public class RotTrlTransform3d {
public RotTrlTransform3d() {
this(new Rotation3d(), new Translation3d());
}
/**
* Creates a rotation-translation transformation from a Transform3d.
*
@@ -52,6 +53,7 @@ public class RotTrlTransform3d {
public RotTrlTransform3d(Transform3d trf) {
this(trf.getRotation(), trf.getTranslation());
}
/**
* A rotation-translation transformation.
*
@@ -65,6 +67,7 @@ public class RotTrlTransform3d {
this.rot = rot;
this.trl = trl;
}
/**
* The rotation-translation transformation that makes poses in the world consider this pose as the
* new origin, or change the basis to this pose.
@@ -86,10 +89,12 @@ public class RotTrlTransform3d {
public Transform3d getTransform() {
return new Transform3d(trl, rot);
}
/** The translation component of this transformation */
public Translation3d getTranslation() {
return trl;
}
/** The rotation component of this transformation */
public Rotation3d getRotation() {
return rot;

View File

@@ -153,6 +153,7 @@ public class VisionEstimation {
*/
public static class SVDResults {
public final RotTrlTransform3d trf;
/** If the result is invalid, this value is -1 */
public final double rmse;