This year our team wants to get the FMS alliance value and send it over to our Raspberry PI with wpilibpi to determine which ball color to track, meaning it can’t just be preloaded in the “Custom Properties Json” in the Vision Settings tab.
with open('/boot/frc.json') as f:
cameraConfig = json.load(f)
#print(cameraConfig)
camera = cameraConfig['cameras'][0]
print('CameraConfig: ', cameraConfig)
cs = CameraServer.getInstance()
cameraSettings = cs.startAutomaticCapture()
#print(cameraConfig)
res_width = camera['width']
res_height = camera['height']
cameraConfig['pixel format'] = 'mjpeg'
cameraConfig['FPS'] = 120
cameraConfig['height'] = 480
cameraConfig['width'] = 640
cameraConfig['brightness'] = 10
cameraConfig['exposure'] = 5
cameraConfig['contrast'] = 10
cameraConfig['saturation'] = 10
cameraConfig['hue'] = 10
cameraSettings.setConfigJson(json.dumps(cameraConfig))
Doing this sets pixel format, fps, height, width, brightness, and exposure correctly, but contrast, saturation, and hue aren’t. Does anyone have any ideas why? My camera does have values for those other settings that can be set, but they just won’t change. In the ‘source JSON config’ the values for the ones that work do change as well.