PhotonVision / photonvision

PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
https://photonvision.org
GNU General Public License v3.0
264 stars 180 forks source link

PhotonTrackedTarget::getYaw polarity inverted in simulation #1241

Closed willtoth closed 6 months ago

willtoth commented 6 months ago

Describe the bug When running on a robot, with the target to the left of center in the frame (so robot is turned clockwise w.r.t. the target), PhotonTrackedTarget::getYaw returns negative. However in simulation it returns positive yaw in degrees.

This forces using code like this:

if (Robot.isSimulation()) {
  rotation = Rotation2d.fromDegrees(target.getYaw());
} else {
  rotation = Rotation2d.fromDegrees(-target.getYaw());
}