Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4+ Second loop overrun when seeing a tag for the first time #1792

Open
DJ-Laser opened this issue Feb 22, 2025 · 0 comments
Open

4+ Second loop overrun when seeing a tag for the first time #1792

DJ-Laser opened this issue Feb 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@DJ-Laser
Copy link

Describe the bug
Using the Advantagekit talonfx swerve example, we added cameras to or robot using photonvision.
Strangely, after turning the robot on the driver would sometimes lose control for 3-5 seconds, but only once per code initialization. When this happened the robot would either no respond to input if it wasn't moving, or it would keep driving and not respond to any input except the disable key.

The logs showed that the vision subsystem was the problem, taking 4+ seconds in the periodic method. I started debugging by commenting out sections of the code. The culprit was the function that handled getting the camera results so I commented out all the pose estimation code. That didn't fix it. I noticed that it happened then photonCamera.getAllUnreadResults() returned the max amount of results (20) So I tried clearing the array so that it would be empty, which didn't work. I evenually just decided to replace the photonCamera.getAllUnreadResults() with an empty list and that fixed it! I modiied the method to do nothing but call photonCamera.getAllUnreadResults() and the bug was back! It seems like something in that function is somehow taking 4+ seconds to execute :(

To Reproduce
Steps to reproduce the behavior:

  1. Clone the advantage kit vision example.
  2. Have 2 cameras plugged in and calibrated, set to 3d mode
  3. Start the robot so it cant see any tags
  4. Move the robot so it sees a tag for the first time
  5. Observe a loop overrun where Vision.periodic() is 4+ seconds

Screenshots / Videos
If applicable, add screenshots to help explain your problem. Additionally, provide journalctl logs and settings zip export. If your issue is regarding the web dashboard, please provide screenshots and the output of the browser console.

Platform:

  • Hardware Platform: Ubuntu Server 24.04.2 Minimal
  • Network Configuration: Ethernet to radio aux1 port, Rio to radio rio port
  • PhotonVision Version: v2025.1.1
  • Browser: Chrome 133.0.6943.127 (Official Build) (64-bit)
  • Camera(s) Used: 2x Arducam ov9281

Additional context
Only happens once per robot code init.
Running PhotonCamera.setVersionCheckEnabled(false); does not help

@DJ-Laser DJ-Laser added the bug Something isn't working label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant