PhotonVision + SwervePoseEstimator produces wrong pose

At team 2914, we’re trying to use PhotonVision to get the robot’s pose on the field for auto and assistance during teleop. Currently, we get the pose from Photon if it exists, and call addVisionMeasurement on our SwervePoseEstimator. However, the poseEstimator’s data gets increasingly worse the farther away the robot is from the tag, even when we only drive the bot side to side. The pose’s rotation gets very off and at times the x and y goes to some other place on the map. Here are some photos.


1 Like

What are the origins of your two coordinate systems? PathPlanner sets (0, 0) in the bottom right. We aren’t using Photonvision, but are the two coordinate systems in line? I believe the limelight botpose versus PathPlanner have different origins, so that may be what you’re running into.

I think the two coordinate systems are the same. When the bot looks straight at the tag or is within cms from it, the pose is correct. It only starts to get distorted the farther away the bot is from the tag. I’ll try to get a video soon.

My team had a lot of trouble getting photonvision and pose estimation to work, here’s some things that we learned while troubleshooting:

  • Make sure your timestamping is correct
  • PhotonPoseEstimator and the SolvePnP Strategy are very useful for calculating pose before you pass it into a swerve pose estimator
  • It is much more reliable if you only calculate poses when you see more than one tag (hence SolvePnP)
  • Vision poses are much more accurate if the cameras are not perpendicular to the tags (the more angle the better, to a certain extent)
  • Using the distance from the tag as standard deviations helps to trust data closer to the tag - we use poseEstimator.addVisionMeasurement(pose, timestamp, VecBuilder.fill(distance / 2, distance / 2, 100));
6 Likes

Check your camera calibration, maybe you need to run it again. Can you post a screenshot of the calibration table?

Agree about bad calibration. Can you export settings and send the zip file here?

1080p:

  • Mean error: 0.64px
  • Standard deviation: 0.77px
  • Horizontal FOV: 67.87deg
  • Vertical FOV: 41.48deg
  • Diagonal FOV: 75.35deg

What do your other resolution Standard Deviations look like? Ours are all 0.17 or less.

I would try doing to the process again, and pay careful attention that it’s identifying the corners properly. In my experience, one misidentified photo can really throw things off.

I will also note that error and standard deviation are not necessarily a good indication of if you’re calibration is good or not. Are you following our suggestions regarding where to place the chess board when taking photos? Try out calibdb to get a sense for that

Wow, thank you so much for your suggestions. It’s working much better now and we’ll improve our calibration later :slight_smile:

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.