Add ability query camera results outside of PhotonPoseEstimator (#786)

This commit is contained in:
PJ Reiniger
2023-02-09 14:43:52 -05:00
committed by GitHub
parent 6886663688
commit 0255798d6c
3 changed files with 22 additions and 0 deletions

View File

@@ -212,6 +212,19 @@ public class PhotonPoseEstimator {
}
PhotonPipelineResult cameraResult = camera.getLatestResult();
return update(cameraResult);
}
/**
* Updates the estimated position of the robot. Returns empty if there are no cameras set or no
* targets were found from the cameras.
*
* @param cameraResult The latest pipeline result from the camera
* @return an EstimatedRobotPose with an estimated pose, and information about the camera(s) and
* pipeline results used to create the estimate
*/
public Optional<EstimatedRobotPose> update(PhotonPipelineResult cameraResult) {
if (!cameraResult.hasTargets()) {
return Optional.empty();
}