@@ -928,4 +928,46 @@ public PhotonPipelineResult getLatestResult() {
928
928
return result ;
929
929
}
930
930
}
931
+
932
+
933
+ @ Test
934
+ public void meme () {
935
+ PhotonCameraInjector cameraOne = new PhotonCameraInjector ();
936
+
937
+ List <VisionTargetSim > simTargets =
938
+ aprilTags .getTags ().stream ()
939
+ .map ((AprilTag x ) -> new VisionTargetSim (x .pose , TargetModel .kAprilTag36h11 , x .ID ))
940
+ .toList ();
941
+
942
+ /* Compound Rolled + Pitched + Yaw */
943
+
944
+ Transform3d compoundTestTransform =
945
+ new Transform3d (
946
+ -Units .inchesToMeters (12 ),
947
+ -Units .inchesToMeters (11 ),
948
+ 3 ,
949
+ new Rotation3d (
950
+ Units .degreesToRadians (37 ), Units .degreesToRadians (6 ), Units .degreesToRadians (60 )));
951
+
952
+ var estimator =
953
+ new PhotonPoseEstimator (
954
+ aprilTags , PoseStrategy .CONSTRAINED_SOLVEPNP , compoundTestTransform );
955
+
956
+ /* this is the real pose of the robot base we test against */
957
+ var realPose = new Pose3d (7.3 , 4.42 , 0 , new Rotation3d (0 , 0 , 2.197 ));
958
+
959
+ PhotonCameraSim cameraOneSim =
960
+ new PhotonCameraSim (cameraOne , SimCameraProperties .PERFECT_90DEG ());
961
+ PhotonPipelineResult result =
962
+ cameraOneSim .process (
963
+ 1 , realPose .transformBy (estimator .getRobotToCameraTransform ()), simTargets );
964
+ cameraOneSim .submitProcessedFrame (result );
965
+
966
+ estimator .addHeadingData (result .getTimestampSeconds (), realPose .getRotation ().toRotation2d ());
967
+ Optional <EstimatedRobotPose > estimatedPose = estimator .update (result , cameraOne .getCameraMatrix (), cameraOne .getDistCoeffs (), Optional .of (new ConstrainedSolvepnpParams (true , 0 )));
968
+
969
+ System .out .println ("Ground truth: " + realPose );
970
+
971
+ System .out .println (estimatedPose );
972
+ }
931
973
}
0 commit comments