#include <photon/PhotonUtils.h>
|
| 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 to a target using the target's elevation.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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, using the robot's gyro.
|
| |
| 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 relative to the camera, the target relative to the field, and the robot relative to the camera.
|
| |
| 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 relative to the camera, and the target relative to the field.
|
| |
◆ CalculateDistanceToTarget()
| static wpi::units::meter_t photon::PhotonUtils::CalculateDistanceToTarget |
( |
wpi::units::meter_t | cameraHeight, |
|
|
wpi::units::meter_t | targetHeight, |
|
|
wpi::units::radian_t | cameraPitch, |
|
|
wpi::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 wpi::math::Transform2d photon::PhotonUtils::EstimateCameraToTarget |
( |
const wpi::math::Translation2d & | cameraToTargetTranslation, |
|
|
const wpi::math::Pose2d & | fieldToTarget, |
|
|
const wpi::math::Rotation2d & | gyroAngle ) |
|
inlinestatic |
Estimates a wpi::math::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 wpi::math::Pose2d representing the target position in the field coordinate system. |
| gyroAngle | The current robot gyro angle, likely from odometry. |
- Returns
- A wpi::math::Transform2d that takes us from the camera to the target.
◆ EstimateCameraToTargetTranslation()
| static wpi::math::Translation2d photon::PhotonUtils::EstimateCameraToTargetTranslation |
( |
wpi::units::meter_t | targetDistance, |
|
|
const wpi::math::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 wpi::math::Pose2d photon::PhotonUtils::EstimateFieldToCamera |
( |
const wpi::math::Transform2d & | cameraToTarget, |
|
|
const wpi::math::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 wpi::math::Pose2d photon::PhotonUtils::EstimateFieldToRobot |
( |
const wpi::math::Transform2d & | cameraToTarget, |
|
|
const wpi::math::Pose2d & | fieldToTarget, |
|
|
const wpi::math::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 wpi::math::Transform2d(3 inches, 0 inches, 0
degrees). |
- Returns
- The position of the robot in the field.
◆ EstimateFieldToRobot() [2/2]
| static wpi::math::Pose2d photon::PhotonUtils::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 ) |
|
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 wpi::math::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 wpi::math::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: