mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
[photonlib] Simulation robustness (#874)
- `PNPResults` can now be empty (`isPresent` = false) - solvePNP methods actually handle errors and return empty `PNPResults` - This reveals an odd error where some inputs to `solvePNP_SQUARE()` resulted in an estimated transform with NaN values, and attempts to handle it - Overwrites java changes from #817 since #742 had duplicate fixes - Minor bugfixes
This commit is contained in:
@@ -70,7 +70,7 @@ public class PhotonCameraSim implements AutoCloseable {
|
||||
private long nextNTEntryTime = WPIUtilJNI.now();
|
||||
|
||||
private double maxSightRangeMeters = Double.MAX_VALUE;
|
||||
private static final double kDefaultMinAreaPx = 90;
|
||||
private static final double kDefaultMinAreaPx = 100;
|
||||
private double minTargetAreaPercent;
|
||||
private PhotonTargetSortMode sortMode = PhotonTargetSortMode.Largest;
|
||||
|
||||
@@ -356,6 +356,7 @@ public class PhotonCameraSim implements AutoCloseable {
|
||||
prop.getDistCoeffs(),
|
||||
tgt.getModel().vertices,
|
||||
noisyTargetCorners);
|
||||
if (!pnpSim.isPresent) continue;
|
||||
centerRot =
|
||||
prop.getPixelRot(
|
||||
OpenCVHelp.projectPoints(
|
||||
@@ -459,6 +460,8 @@ public class PhotonCameraSim implements AutoCloseable {
|
||||
ts.targetPoseEntry.set(poseData, receiveTimestamp);
|
||||
}
|
||||
|
||||
ts.cameraIntrinsicsPublisher.set(prop.getIntrinsics().getData(), receiveTimestamp);
|
||||
ts.cameraDistortionPublisher.set(prop.getDistCoeffs().getData(), receiveTimestamp);
|
||||
ts.heartbeatPublisher.set(heartbeatCounter++, receiveTimestamp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user