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

v2024.2.7 -> Limelight3 does not save any configuration settings(web ui) #1253

Closed JuliusZhou124 closed 6 months ago

JuliusZhou124 commented 6 months ago

Describe the bug Upon restarting, photonvision web ui does not save any camera name or configuration settings.

To Reproduce Steps to reproduce the behavior:

  1. Flash Limelight 3 through usb-c with balena etcher and new limelight3 image.
  2. Turn on computer and robot, connect to limelight3 through web-interface.
  3. Configure robot name, set pipeline to apriltag, set robot camera name to anything.
  4. Powercycle robot, connect to camera through web-interface again.
  5. See error.

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.

Please let me know of any useful keywords to use with journalctl. https://i.imgur.com/gzrpQLM.png <- Image of web ui after rebooting after changing config settings once. https://i.imgur.com/yeUo9SK.png <- Static IP works, and that config is saved.

Platform:

Additional context Add any other context about the problem here.

JuliusZhou124 commented 6 months ago

Journalctl logs - photonvision-journalctl.txt

crschardt commented 6 months ago

Thank you for posting the logs. On the second boot, it fails to match the camera to the one saved after the first boot:

First boot:

Dec 11 04:55:09 photonvision java[396]: [0:00:16.307421748] [863]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media1 and ISP device /dev/media3
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [DEBUG] Matching 1 new cameras!
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Detected unmatched physical camera: CameraInfo [cameraType=ZeroCopyPicambaseName=Camera Module v1, vid=-1, pid=-1, path=/base/soc/i2c0mux/i2c@1/ov5647@36, otherPaths=[]]
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Matching by usb port & name & USB VID/PID...
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Matching by usb port & USB VID/PID...
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Matching by base-name & usb port...
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Matching by base-name & USB VID/PID only...
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Matching by base-name only...
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [DEBUG] After matching loaded configs 1 cameras were unmatched.
Dec 11 04:55:09 photonvision java[396]: [2023-12-11 04:55:09] [Camera - VisionSourceManager] [INFO] Creating a new camera config for camera Camera_Module_v1
Dec 11 04:55:10 photonvision java[396]: [2023-12-11 04:55:10] [Camera - CameraConfiguration] [DEBUG] Creating USB camera configuration for UsbCamera Camera Module v1 (AKA Camera_Module_v1) at /base/soc/i2c0mux/i2c@1/ov5647@36

Second boot:

Dec 11 04:59:08 photonvision java[391]: [0:00:12.937781843] [660]  INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [DEBUG] Matching 1 new cameras!
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Detected unmatched physical camera: CameraInfo [cameraType=ZeroCopyPicambaseName=Camera Module v1, vid=-1, pid=-1, path=/base/soc/i2c0mux/i2c@1/ov5647@36, otherPaths=[]]
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [DEBUG] Trying to match 1 unmatched configs...
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Matching by usb port & name & USB VID/PID...
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Matching by usb port & USB VID/PID...
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Matching by base-name & usb port...
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Matching by base-name & USB VID/PID only...
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Matching by base-name only...
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [DEBUG] After matching loaded configs 1 cameras were unmatched.
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - VisionSourceManager] [INFO] Creating a new camera config for camera Camera_Module_v1 (1)
Dec 11 04:59:08 photonvision java[391]: [2023-12-11 04:59:08] [Camera - CameraConfiguration] [DEBUG] Creating USB camera configuration for UsbCamera Camera Module v1 (AKA Camera_Module_v1 (1)) at /base/soc/i2c0mux/i2c@1/ov5647@36

Since the camera names are the same, this makes me think that the settings aren't being saved correctly. Would you please export settings and post them here?

JuliusZhou124 commented 6 months ago

Here is the settings export: photonvision-settings-export.zip

Yea it looks like there is camera config being saved to the filesystem. The SQLlite seems to know the configs existed at some point though?

tablecamerascamerasCREATE TABLE cameras (
 unique_name TINYTEXT PRIMARY KEY,
 config_json text NOT NULL,
 drivermode_json text NOT NULL,
 pipeline_jsons mediumtext NOT NULL
, otherpaths_json TEXT NOT NULL DEFAULT '[]')-A
mcm001 commented 6 months ago

Does this happen with 2024.2.5, too? Is it in any way possible that the image is somehow broken? We've had a couple reports of weird behavior on 2024.2.7 now, which is a bit concerning

JuliusZhou124 commented 6 months ago

The issue is resolved on 2024.2.5. I reinstalled the image and jar and tried both reflashing and offline update from 2024.2.5. The issue still remained. Seems like an issue with 2024.2.7 specifically.

mcm001 commented 6 months ago

Odd thanks for testing. I decided to re run our CI pipeline on the 2024.2.7 release so maybe the new one will actually work, once that runs?

jasone commented 6 months ago

photonvision-journalctl.txt I'm going to pile on here with what appears to be the same problem, but on a Pi 4B using an OV9281 camera. I successfully configured a static IP address, calibrated the camera for an AprilTag pipeline, all on the first boot. On the second boot, the camera config appears not to have matched what was in the database, so there was an unused "OV9281" and a new "OV9281 (1)". Multiple reboots show that previous camera configs never match; I got up to "OV9281 (1) (2) (3) (4) (5)" during testing.

mcm001 commented 6 months ago

I'm in mobile still, but I think this has happened enough times that something seems to be up for sure. I'll look closer at logs, but do you see any funny prints from the VisionSourceManager matching process that indicate what's up?

jasone commented 6 months ago

I don't see any significant difference between the first and second boot in the log messages, aside from this line:

Dec 11 05:05:36 camera2 java[448]: [2023-12-11 05:05:36] [Camera - VisionSourceManager] [DEBUG] Trying to match 1 unmatched configs...

Every other line leading up to assigning a new camera name looks the same.

mcm001 commented 6 months ago

Here is the settings export: photonvision-settings-export.zip

Yea it looks like there is camera config being saved to the filesystem. The SQLlite seems to know the configs existed at some point though?


tablecamerascamerasCREATE TABLE cameras (

 unique_name TINYTEXT PRIMARY KEY,

 config_json text NOT NULL,

 drivermode_json text NOT NULL,

 pipeline_jsons mediumtext NOT NULL

, otherpaths_json TEXT NOT NULL DEFAULT '[]')-A

Yeah I agree. The database has cameras they just aren't getting matched. I think we found a array if condition that might cause this lol -- https://github.com/PhotonVision/photonvision/blob/ec6664566758d165b292690a087627b5ee785e77/photon-core/src/main/java/org/photonvision/vision/processes/VisionSourceManager.java#L403

image

JuliusZhou124 commented 6 months ago

The new release fixed our issue with the Limelight! Resolved as closed.