30#include <wpi/apriltag/AprilTagFieldLayout.hpp>
31#include <wpi/math/geometry/Pose3d.hpp>
32#include <wpi/math/geometry/Rotation3d.hpp>
33#include <wpi/math/geometry/Transform3d.hpp>
34#include <wpi/math/interpolation/TimeInterpolatableBuffer.hpp>
35#include <wpi/util/SmallVector.hpp>
73 std::span<const PhotonTrackedTarget> targets,
77 targetsUsed(targets.data(), targets.data() + targets.size()),
98 wpi::math::Transform3d robotToCamera);
114 return m_robotToCamera;
124 m_robotToCamera = robotToCamera;
136 wpi::math::Rotation2d heading) {
137 this->headingBuffer.AddSample(timestamp, heading);
149 wpi::math::Rotation3d heading) {
163 wpi::math::Rotation2d heading) {
164 headingBuffer.Clear();
178 wpi::math::Rotation3d heading) {
305 wpi::math::Pose3d seedPose,
bool headingFree,
double headingScaleFactor);
308 wpi::apriltag::AprilTagFieldLayout aprilTags;
310 wpi::math::Transform3d m_robotToCamera;
312 wpi::math::TimeInterpolatableBuffer<wpi::math::Rotation2d> headingBuffer;
314 inline static int InstanceCount = 1;
Eigen::Matrix< double, 8, 1 > DistortionMatrix
Definition PhotonCamera.h:200
Eigen::Matrix< double, 3, 3 > CameraMatrix
Definition PhotonCamera.h:199
Represents a pipeline result from a PhotonCamera.
Definition PhotonPipelineResult.h:34
The PhotonPoseEstimator class filters or combines readings from all the fiducials visible at a given ...
Definition PhotonPoseEstimator.h:87
std::optional< EstimatedRobotPose > EstimateAverageBestTargetsPose(PhotonPipelineResult cameraResult)
Return the average of the best target poses using ambiguity as weight.
void SetRobotToCameraTransform(wpi::math::Transform3d robotToCamera)
Useful for pan and tilt mechanisms, or cameras on turrets.
Definition PhotonPoseEstimator.h:123
std::optional< EstimatedRobotPose > EstimateClosestToCameraHeightPose(PhotonPipelineResult cameraResult)
Return the estimated position of the robot using the target with the lowest delta height difference b...
PhotonPoseEstimator(wpi::apriltag::AprilTagFieldLayout aprilTags, wpi::math::Transform3d robotToCamera)
Create a new PhotonPoseEstimator.
std::optional< EstimatedRobotPose > EstimateLowestAmbiguityPose(PhotonPipelineResult cameraResult)
Return the estimated position of the robot with the lowest position ambiguity from a List of pipeline...
wpi::apriltag::AprilTagFieldLayout GetFieldLayout() const
Get the AprilTagFieldLayout being used by the PositionEstimator.
Definition PhotonPoseEstimator.h:105
std::optional< EstimatedRobotPose > EstimateCoprocMultiTagPose(PhotonPipelineResult cameraResult)
Return the estimated position of the robot by using all visible tags to compute a single pose estimat...
void ResetHeadingData(wpi::units::second_t timestamp, wpi::math::Rotation3d heading)
Clears all heading data in the buffer, and adds a new seed.
Definition PhotonPoseEstimator.h:177
std::optional< EstimatedRobotPose > EstimateConstrainedSolvepnpPose(photon::PhotonPipelineResult cameraResult, photon::PhotonCamera::CameraMatrix cameraMatrix, photon::PhotonCamera::DistortionMatrix distCoeffs, wpi::math::Pose3d seedPose, bool headingFree, double headingScaleFactor)
Return the estimated position of the robot by solving a constrained version of the Perspective-n-Poin...
std::optional< EstimatedRobotPose > EstimatePnpDistanceTrigSolvePose(PhotonPipelineResult cameraResult)
Return the estimated position of the robot by using distance data from best visible tag to compute a ...
wpi::math::Transform3d GetRobotToCameraTransform()
Definition PhotonPoseEstimator.h:113
std::optional< EstimatedRobotPose > EstimateRioMultiTagPose(PhotonPipelineResult cameraResult, PhotonCamera::CameraMatrix camMat, PhotonCamera::DistortionMatrix distCoeffs)
Return the estimated position of the robot by using all visible tags to compute a single pose estimat...
void AddHeadingData(wpi::units::second_t timestamp, wpi::math::Rotation2d heading)
Add robot heading data to the buffer.
Definition PhotonPoseEstimator.h:135
void ResetHeadingData(wpi::units::second_t timestamp, wpi::math::Rotation2d heading)
Clears all heading data in the buffer, and adds a new seed.
Definition PhotonPoseEstimator.h:162
std::optional< EstimatedRobotPose > EstimateClosestToReferencePose(PhotonPipelineResult cameraResult, wpi::math::Pose3d referencePose)
Return the estimated position of the robot using the target with the lowest delta in the vector magni...
void AddHeadingData(wpi::units::second_t timestamp, wpi::math::Rotation3d heading)
Add robot heading data to the buffer.
Definition PhotonPoseEstimator.h:148
Definition VisionEstimation.h:30
PoseStrategy
Definition PhotonPoseEstimator.h:42
@ CONSTRAINED_SOLVEPNP
Definition PhotonPoseEstimator.h:50
@ LOWEST_AMBIGUITY
Definition PhotonPoseEstimator.h:43
@ AVERAGE_BEST_TARGETS
Definition PhotonPoseEstimator.h:47
@ PNP_DISTANCE_TRIG_SOLVE
Definition PhotonPoseEstimator.h:51
@ MULTI_TAG_PNP_ON_RIO
Definition PhotonPoseEstimator.h:49
@ CLOSEST_TO_CAMERA_HEIGHT
Definition PhotonPoseEstimator.h:44
@ CLOSEST_TO_LAST_POSE
Definition PhotonPoseEstimator.h:46
@ MULTI_TAG_PNP_ON_COPROCESSOR
Definition PhotonPoseEstimator.h:48
@ CLOSEST_TO_REFERENCE_POSE
Definition PhotonPoseEstimator.h:45
Definition PhotonPoseEstimator.h:54
bool headingFree
Definition PhotonPoseEstimator.h:55
double headingScalingFactor
Definition PhotonPoseEstimator.h:56
Definition PhotonPoseEstimator.h:59
wpi::math::Pose3d estimatedPose
The estimated pose.
Definition PhotonPoseEstimator.h:61
EstimatedRobotPose(wpi::math::Pose3d pose_, wpi::units::second_t time_, std::span< const PhotonTrackedTarget > targets, PoseStrategy strategy_)
Definition PhotonPoseEstimator.h:72
wpi::units::second_t timestamp
The estimated time the frame used to derive the robot pose was taken, in the same timebase as the Rob...
Definition PhotonPoseEstimator.h:64
wpi::util::SmallVector< PhotonTrackedTarget, 10 > targetsUsed
A list of the targets used to compute this pose.
Definition PhotonPoseEstimator.h:67
PoseStrategy strategy
The strategy actually used to produce this pose.
Definition PhotonPoseEstimator.h:70