27#include <wpi/math/geometry/Pose2d.hpp>
28#include <wpi/math/geometry/Rotation2d.hpp>
29#include <wpi/math/geometry/Transform2d.hpp>
30#include <wpi/math/geometry/Translation2d.hpp>
31#include <wpi/units/angle.hpp>
32#include <wpi/units/length.hpp>
33#include <wpi/units/math.hpp>
54 wpi::units::meter_t cameraHeight, wpi::units::meter_t targetHeight,
55 wpi::units::radian_t cameraPitch, wpi::units::radian_t targetPitch) {
56 return (targetHeight - cameraHeight) /
57 wpi::units::math::tan(cameraPitch + targetPitch);
69 wpi::units::meter_t targetDistance,
const wpi::math::Rotation2d& yaw) {
70 return {targetDistance * yaw.Cos(), targetDistance * yaw.Sin()};
101 wpi::units::meter_t cameraHeight, wpi::units::meter_t targetHeight,
102 wpi::units::radian_t cameraPitch, wpi::units::radian_t targetPitch,
103 const wpi::math::Rotation2d& targetYaw,
104 const wpi::math::Rotation2d& gyroAngle,
105 const wpi::math::Pose2d& fieldToTarget,
106 const wpi::math::Transform2d& cameraToRobot) {
111 cameraPitch, targetPitch),
113 fieldToTarget, gyroAngle),
114 fieldToTarget, cameraToRobot);
135 const wpi::math::Translation2d& cameraToTargetTranslation,
136 const wpi::math::Pose2d& fieldToTarget,
137 const wpi::math::Rotation2d& gyroAngle) {
142 return wpi::math::Transform2d(cameraToTargetTranslation,
143 -gyroAngle - fieldToTarget.Rotation());
161 const wpi::math::Transform2d& cameraToTarget,
162 const wpi::math::Pose2d& fieldToTarget,
163 const wpi::math::Transform2d& cameraToRobot) {
165 .TransformBy(cameraToRobot);
179 const wpi::math::Transform2d& cameraToTarget,
180 const wpi::math::Pose2d& fieldToTarget) {
181 auto targetToCamera = cameraToTarget.Inverse();
182 return fieldToTarget.TransformBy(targetToCamera);
Definition PhotonUtils.h:36
static wpi::units::meter_t CalculateDistanceToTarget(wpi::units::meter_t cameraHeight, wpi::units::meter_t targetHeight, wpi::units::radian_t cameraPitch, wpi::units::radian_t targetPitch)
Algorithm from https://docs.limelightvision.io/en/latest/cs_estimating_distance.html Estimates range ...
Definition PhotonUtils.h:53
static wpi::math::Pose2d EstimateFieldToRobot(const wpi::math::Transform2d &cameraToTarget, const wpi::math::Pose2d &fieldToTarget, const wpi::math::Transform2d &cameraToRobot)
Estimates the pose of the robot in the field coordinate system, given the position of the target rela...
Definition PhotonUtils.h:160
static wpi::math::Pose2d EstimateFieldToCamera(const wpi::math::Transform2d &cameraToTarget, const wpi::math::Pose2d &fieldToTarget)
Estimates the pose of the camera in the field coordinate system, given the position of the target rel...
Definition PhotonUtils.h:178
static wpi::math::Translation2d EstimateCameraToTargetTranslation(wpi::units::meter_t targetDistance, const wpi::math::Rotation2d &yaw)
Estimate the Translation2d of the target relative to the camera.
Definition PhotonUtils.h:68
static wpi::math::Transform2d EstimateCameraToTarget(const wpi::math::Translation2d &cameraToTargetTranslation, const wpi::math::Pose2d &fieldToTarget, const wpi::math::Rotation2d &gyroAngle)
Estimates a wpi::math::Transform2d that maps the camera position to the target position,...
Definition PhotonUtils.h:134
static wpi::math::Pose2d EstimateFieldToRobot(wpi::units::meter_t cameraHeight, wpi::units::meter_t targetHeight, wpi::units::radian_t cameraPitch, wpi::units::radian_t targetPitch, const wpi::math::Rotation2d &targetYaw, const wpi::math::Rotation2d &gyroAngle, const wpi::math::Pose2d &fieldToTarget, const wpi::math::Transform2d &cameraToRobot)
Estimate the position of the robot in the field.
Definition PhotonUtils.h:100
Definition VisionEstimation.h:30