WPI Raspberry Pi image is resetting exposure and gain?

Hey all. I’m working with the WPI Raspberry Pi vision image, and it’s working fine, except for a very, VERY annoying problem.

This happens regardless of the code that I’m using, so code shouldn’t be related much, but I’m testing right now with ChickenVision: https://github.com/team3997/ChickenVision

When I first start up the Pi and set the exposure + gain to values giving me a good image, so exposure_absolute = 1 and gain = 0, it’s all fine and dandy. I save the values, and reboot the Pi. Then the problem occurs: On the sliders, the exposure and gain are at the values they should be at: 1 and 0, respectively. However, the image looks as though both of those were reset to the original values, and is much brighter than I left it.

When I move the gain and exposure at all after booting, and then move them back to where I want them, it’s like they suddenly remember, “Oh, right, an exposure of 1 should actually look like a low exposure,” and the same for gain, and suddenly, the image looks correct.

If I don’t manually adjust the gain and exposure after booting, and I click the “Terminate” button in the “Vision Status” section to restart the code, the problem is fixed then as well.

If it’s relevant, I’m using a Logitech C270. What camera are you guys using?

Does anyone have any insight? I’m not sure where to go next with this, so any help is appreciated.

1 Like

When you say you “save the values” where are you saving them? In the webdash camera settings?

We have the same issue. Auto exposure is always the setting and we always need to switch it to manual exposure, despite having all other settings change :confused:

I have it set to manual exposure, and it still changes, but it’s good to know that you also have the problem.

Yeah, I save the settings in the “Custom Properties JSON” section. I made sure that I saved the correct JSON there.

Camera settings are finicky as they can have implicit ordering. Since you are writing custom code anyway, an easy workaround may be to simply set the exposure twice in code. Also, the JSON list is a list so you might be able to list the same setting twice or adjust the order.

I tried setting the exposure twice in code, as well as in JSON (I also did the gain twice in JSON as well) to no noticeable effect. I even tried editing runCamera to run the code, kill python3, and then run the code again, but that didn’t help. Do you have any other ideas?

Thanks for your help.

1 Like

I would take a look at cap.autoExpose in the ChickenVision.py source.

If you are running in “Driver” or “Cargo” mode, it will set the exposure mode to auto to my understanding.

Based on this line:

    tape = False

in the startCamera method, I would assume that it defaults to cargo mode.

Update:
I edited ChickenVision.py to remove cargo and driver mode. Not familiar with Python and didnt test, but give it a shot.

https://pastebin.com/xEB1ZQmk

We are also using the Logitech c270 and we’re also having the same problem. Everything works except that the camera won’t take the exposure settings after a restart.

If I try setting the exposure in code, I get an exception:

Exception in thread "main" VideoException [edu.wpi.cscore.VideoException: property write failed]
	at edu.wpi.cscore.CameraServerJNI.setCameraExposureManual(Native Method)
	at edu.wpi.cscore.VideoCamera.setExposureManual(VideoCamera.java:79)
	at Main.main(Main.java:259)

Has anyone figured out a work-around for this? Is there a specific ordering we should use when setting video properties?

great to hear that someone has the same issue with the same camera. We ended up finding a couple c615 cameras which are working great for us, haven’t managed to find a solution to the c270 problem yet :confused:

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