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
271 stars 187 forks source link

PhotonCamera Question #354

Open icemannie opened 2 years ago

icemannie commented 2 years ago

Have Gloworm 2021-01-11 lite running on a Limelight 2 to a Roborio. Was previously trying to set up Photonvision on a Romi with the same problem.

The photonvision network tables show up in Shuffleboard, and the driver mode and plpeline etries follow the camera web page settings. Problem I'm seeing is that camera.getPipeline() and camera.getDriverMode() don't follow the Network Table. (Only entries tested)

Copying the PhotonCamera code into a new class and changing

getDriverMode() from return driverMode to return driverModeEntry.getBoolean(false)

works.

mcm001 commented 2 years ago

Thanks! That's odd for sure. It looks like we internally cache the last value the entries were set to -- maybe those are somehow getting out of sync?

icemannie commented 2 years ago

The NetworkTableEntries for driverMode and pipelineIndex are read into booleans in the PhotonCamera(network table) constructor. So the booleans won't change when their respective entries change. The other methods all use the entries.

mcm001 commented 2 years ago

Yeah, it looks like we assume that the PhotonCamera will be the only thing changing the pipeline/driver mode-iness of the camera. Which Isn't The Case.

icemannie commented 2 years ago

The setDriverMode needs fixing also. The mode can just be set without reading the current state or use getDriverMode() instead of the boolean driverMode. The boolean can be removed. Same situation with pipeline index int.

team2194 commented 2 years ago

Found the same issue on setting the led mode. The PhotonCamera file as I am currently using is attached. PhotonCamera1.txt

mcm001 commented 2 years ago

If you'd like feel free to open a PR

mcm001 commented 2 years ago

Should have been addressed by #357

srimanachanta commented 11 months ago

Are the inconsistencies still present on 2024-beta?