#include <photon/PhotonUtils.h>
|
static units::meter_t | CalculateDistanceToTarget (units::meter_t cameraHeight, units::meter_t targetHeight, units::radian_t cameraPitch, units::radian_t targetPitch) |
| Algorithm from https://docs.limelightvision.io/en/latest/cs_estimating_distance.html Estimates range to a target using the target's elevation.
|
|
static frc::Translation2d | EstimateCameraToTargetTranslation (units::meter_t targetDistance, const frc::Rotation2d &yaw) |
| Estimate the Translation2d of the target relative to the camera.
|
|
static frc::Pose2d | EstimateFieldToRobot (units::meter_t cameraHeight, units::meter_t targetHeight, units::radian_t cameraPitch, units::radian_t targetPitch, const frc::Rotation2d &targetYaw, const frc::Rotation2d &gyroAngle, const frc::Pose2d &fieldToTarget, const frc::Transform2d &cameraToRobot) |
| Estimate the position of the robot in the field.
|
|
static frc::Transform2d | EstimateCameraToTarget (const frc::Translation2d &cameraToTargetTranslation, const frc::Pose2d &fieldToTarget, const frc::Rotation2d &gyroAngle) |
| Estimates a frc::Transform2d that maps the camera position to the target position, using the robot's gyro.
|
|
static frc::Pose2d | EstimateFieldToRobot (const frc::Transform2d &cameraToTarget, const frc::Pose2d &fieldToTarget, const frc::Transform2d &cameraToRobot) |
| Estimates the pose of the robot in the field coordinate system, given the position of the target relative to the camera, the target relative to the field, and the robot relative to the camera.
|
|
static frc::Pose2d | EstimateFieldToCamera (const frc::Transform2d &cameraToTarget, const frc::Pose2d &fieldToTarget) |
| Estimates the pose of the camera in the field coordinate system, given the position of the target relative to the camera, and the target relative to the field.
|
|
◆ CalculateDistanceToTarget()
static units::meter_t photon::PhotonUtils::CalculateDistanceToTarget |
( |
units::meter_t | cameraHeight, |
|
|
units::meter_t | targetHeight, |
|
|
units::radian_t | cameraPitch, |
|
|
units::radian_t | targetPitch ) |
|
inlinestatic |
Algorithm from https://docs.limelightvision.io/en/latest/cs_estimating_distance.html Estimates range to a target using the target's elevation.
This method can produce more stable results than SolvePNP when well tuned, if the full 6d robot pose is not required.
- Parameters
-
cameraHeight | The height of the camera off the floor. |
targetHeight | The height of the target off the floor. |
cameraPitch | The pitch of the camera from the horizontal plane. Positive valueBytes up. |
targetPitch | The pitch of the target in the camera's lens. Positive values up. |
- Returns
- The estimated distance to the target.
◆ EstimateCameraToTarget()
static frc::Transform2d photon::PhotonUtils::EstimateCameraToTarget |
( |
const frc::Translation2d & | cameraToTargetTranslation, |
|
|
const frc::Pose2d & | fieldToTarget, |
|
|
const frc::Rotation2d & | gyroAngle ) |
|
inlinestatic |
Estimates a frc::Transform2d
that maps the camera position to the target position, using the robot's gyro.
Note that the gyro angle provided must line up with the field coordinate system – that is, it should read zero degrees when pointed towards the opposing alliance station, and increase as the robot rotates CCW.
- Parameters
-
cameraToTargetTranslation | A Translation2d that encodes the x/y position of the target relative to the camera. |
fieldToTarget | A frc::Pose2d representing the target position in the field coordinate system. |
gyroAngle | The current robot gyro angle, likely from odometry. |
- Returns
- A frc::Transform2d that takes us from the camera to the target.
◆ EstimateCameraToTargetTranslation()
static frc::Translation2d photon::PhotonUtils::EstimateCameraToTargetTranslation |
( |
units::meter_t | targetDistance, |
|
|
const frc::Rotation2d & | yaw ) |
|
inlinestatic |
Estimate the Translation2d of the target relative to the camera.
- Parameters
-
targetDistance | The distance to the target. |
yaw | The observed yaw of the target. |
- Returns
- The target's camera-relative translation.
◆ EstimateFieldToCamera()
static frc::Pose2d photon::PhotonUtils::EstimateFieldToCamera |
( |
const frc::Transform2d & | cameraToTarget, |
|
|
const frc::Pose2d & | fieldToTarget ) |
|
inlinestatic |
Estimates the pose of the camera in the field coordinate system, given the position of the target relative to the camera, and the target relative to the field.
This only tracks the position of the camera, not the position of the robot itself.
- Parameters
-
cameraToTarget | The position of the target relative to the camera. |
fieldToTarget | The position of the target in the field. |
- Returns
- The position of the camera in the field.
◆ EstimateFieldToRobot() [1/2]
static frc::Pose2d photon::PhotonUtils::EstimateFieldToRobot |
( |
const frc::Transform2d & | cameraToTarget, |
|
|
const frc::Pose2d & | fieldToTarget, |
|
|
const frc::Transform2d & | cameraToRobot ) |
|
inlinestatic |
Estimates the pose of the robot in the field coordinate system, given the position of the target relative to the camera, the target relative to the field, and the robot relative to the camera.
- Parameters
-
cameraToTarget | The position of the target relative to the camera. |
fieldToTarget | The position of the target in the field. |
cameraToRobot | The position of the robot relative to the camera. If the camera was mounted 3 inches behind the "origin" (usually physical center) of the robot, this would be frc::Transform2d(3 inches, 0 inches, 0 degrees). |
- Returns
- The position of the robot in the field.
◆ EstimateFieldToRobot() [2/2]
static frc::Pose2d photon::PhotonUtils::EstimateFieldToRobot |
( |
units::meter_t | cameraHeight, |
|
|
units::meter_t | targetHeight, |
|
|
units::radian_t | cameraPitch, |
|
|
units::radian_t | targetPitch, |
|
|
const frc::Rotation2d & | targetYaw, |
|
|
const frc::Rotation2d & | gyroAngle, |
|
|
const frc::Pose2d & | fieldToTarget, |
|
|
const frc::Transform2d & | cameraToRobot ) |
|
inlinestatic |
Estimate the position of the robot in the field.
- Parameters
-
cameraHeightMeters | The physical height of the camera off the floor in meters. |
targetHeightMeters | The physical height of the target off the floor in meters. This should be the height of whatever is being targeted (i.e. if the targeting region is set to top, this should be the height of the top of the target). |
cameraPitchRadians | The pitch of the camera from the horizontal plane in radians. Positive values up. |
targetPitchRadians | The pitch of the target in the camera's lens in radians. Positive values up. |
targetYaw | The observed yaw of the target. Note that this must be CCW-positive, and Photon returns CW-positive. |
gyroAngle | The current robot gyro angle, likely from odometry. |
fieldToTarget | A frc::Pose2d representing the target position in the field coordinate system. |
cameraToRobot | The position of the robot relative to the camera. If the camera was mounted 3 inches behind the "origin" (usually physical center) of the robot, this would be frc::Transform2d(3 inches, 0
inches, 0 degrees). |
- Returns
- The position of the robot in the field.
The documentation for this class was generated from the following file: